搜索

4.5. D3N 数据缓存

download PDF

datacenter-Data-Delivery Network (D3N)使用高速存储(如 NVMe )在访问端缓存数据集。这种缓存允许大型数据作业使用边缘每个 Rados 网关节点上可用的计算和快速存储资源。Rados 网关充当后端对象存储(OSD)的缓存服务器,将数据存储在本地以供重复使用。

注意

每次重启 Rados 网关时,会清除缓存目录的内容。

4.5.1. 添加 D3N 缓存目录

要在 RGW 上启用 D3N 缓存,您需要在 podman unit.run 中包含 D3N 缓存目录。

先决条件

  • 一个正在运行的 Red Hat Ceph Storage 集群。
  • 安装了 Ceph 对象网关.
  • 管理节点的根级别访问权限。
  • 每个 RGW 节点中有一个快速 NVMe 驱动器,用作本地缓存存储。

流程

  1. 为 NVMe 驱动器创建挂载点。

    语法

    mkfs.ext4 nvme-drive-path

    示例

    [ceph: root@host01 /]# mkfs.ext4 /dev/nvme0n1
    mount /dev/nvme0n1 /mnt/nvme0n1/

  2. 创建缓存目录路径。

    语法

    mkdir <nvme-mount-path>/cache-directory-name

    示例

    [ceph: root@host01 /]# mkdir /mnt/nvme0n1/rgw_datacache

  3. nvme-mount-pathrgw_d3n_l1_datacache_persistent_path 提供 +rwx 权限。

    语法

    chmod a+rwx nvme-mount-path ; chmod a+rwx rgw_d3n_l1_datacache_persistent_path

    示例

    [ceph: root@host01 /]# chmod a+rwx /mnt/nvme0n1 ; chmod a+rwx /mnt/nvme0n1/rgw_datacache/

  4. 使用 extra_container_args 创建/修改 RGW 规范文件,将 rgw_d3n_l1_datacache_persistent_path 添加到 podman unit.run 中。

    语法

    "extra_container_args:
              "-v"
              "rgw_d3n_l1_datacache_persistent_path:rgw_d3n_l1_datacache_persistent_path"
    			"

    示例

    [ceph: root@host01 /]# cat rgw-spec.yml
    	service_type: rgw
    	service_id: rgw.test
    	placement:
    		hosts:
    		    host1
    		    host2
    		extra_container_args:
    		    "-v"
    		    "/mnt/nvme0n1/rgw_datacache/:/mnt/nvme0n1/rgw_datacache/"

    注意

    如果单个主机上有多个 RGW 实例,则必须为每个实例创建一个单独的 rgw_d3n_l1_datacache_persistent_path,并在 extra_container_args 中添加每个路径。

    示例

    对于每个主机中的两个 RGW 实例,在 rgw_d3n_l1_datacache_persistent_path 下创建两个单独的 cache-directory/mnt/nvme0n1/rgw_datacache/rgw1/mnt/nvme0n1/rgw_datacache/rgw2

    rgw 规范文件中的 "extra_container_args" 示例:

    "extra_container_args:
    	"-v"
    	"/mnt/nvme0n1/rgw_datacache/rgw1/:/mnt/nvme0n1/rgw_datacache/rgw1/"
    	"-v"
    	"/mnt/nvme0n1/rgw_datacache/rgw2/:/mnt/nvme0n1/rgw_datacache/rgw2/"
    "

    rgw-spec.yml 示例:

    [ceph: root@host01 /]# cat rgw-spec.yml
    	service_type: rgw
    		service_id: rgw.test
    		placement:
    			hosts:
    				host1
    				host2
    			count_per_host: 2
    			extra_container_args:
    				"-v"
    				"/mnt/nvme0n1/rgw_datacache/rgw1/:/mnt/nvme0n1/rgw_datacache/rgw1/"
    				"-v"
    				"/mnt/nvme0n1/rgw_datacache/rgw2/:/mnt/nvme0n1/rgw_datacache/rgw2/"
  5. 重新部署 RGW 服务:

    示例

    [ceph: root@host01 /]# ceph orch apply -i rgw-spec.yml

4.5.2. 在 rados 网关上配置 D3N

您可以在现有 RGW 上配置 D3N 数据缓存,以提高 Red Hat Ceph Storage 集群中运行的 big-data 作业性能。

先决条件

  • 一个正在运行的 Red Hat Ceph Storage 集群。
  • 安装了 Ceph 对象网关.
  • 管理节点的根级别访问权限。
  • 一个快速的 NVMe 作为缓存存储。

添加所需的 D3N 相关配置

要在现有 RGW 上启用 D3N,需要为每个 Rados 网关客户端设置以下配置:

语法

# ceph config set <client.rgw> <CONF-OPTION> <VALUE>

  • rgw_d3n_l1_local_datacache_enabled=true
  • rgw_d3n_l1_datacache_persistent_path= 路径到缓存目录

    示例

    rgw_d3n_l1_datacache_persistent_path=/mnt/nvme/rgw_datacache/

  • rgw_d3n_l1_datacache_size=max_size_of_cache_in_bytes

    示例

    rgw_d3n_l1_datacache_size=10737418240

示例流程

  1. 创建 test 对象:

    注意

    测试对象需要大于 4 MB 才能缓存。

    示例

    [ceph: root@host01 /]# fallocate -l 1G ./1G.dat
    [ceph: root@host01 /]# s3cmd mb s3://bkt
    [ceph: root@host01 /]# s3cmd put ./1G.dat s3://bkt

  2. 执行对象的 GET

    示例

    [ceph: root@host01 /]# s3cmd get s3://bkt/1G.dat /dev/shm/1G_get.dat
    download: 's3://bkt/1G.dat' -> './1G_get.dat'  [1 of 1]
    1073741824 of 1073741824   100% in   13s    73.94 MB/s  done

  3. 验证缓存创建。将创建缓存,其名称由配置的 rgw_d3n_l1_datacache_persistent_path 中的对象 key-name 组成。

    示例

    [ceph: root@host01 /]# ls -lh /mnt/nvme/rgw_datacache
    
    rw-rr. 1 ceph ceph 1.0M Jun  2 06:18 cc7f967c-0021-43b2-9fdf-23858e868663.615391.1_shadow.ZCiCtMWeu_19wb100JIEZ-o4tv2IyA_1

  4. 为对象创建缓存后,该对象的下一个 GET 操作将从缓存访问,从而加快访问速度。

    示例

    [ceph: root@host01 /]# s3cmd get s3://bkt/1G.dat /dev/shm/1G_get.dat
    download: 's3://bkt/1G.dat' -> './1G_get.dat'  [1 of 1]
    1073741824 of 1073741824   100% in    6s   155.07 MB/s  done

    在上例中,为了演示缓存加速,我们正写入 RAM 驱动器(/dev/shm)。

其它资源

  • 有关使用高可用性的更多详细信息,请参阅 Red Hat Ceph Storage 故障排除指南中的 Ceph 子系统默认日志记录级别值 部分。
  • 有关使用高可用性的更多详细信息,请参阅 Red Hat Ceph Storage 故障排除指南中的 了解 Ceph 日志 部分。
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.