11.10. 使用 Ceph Orchestrator 设置自定义 NFS-Ganesha 配置
NFS-Ganesha 集群在默认配置块中定义。通过使用 Ceph 编排器,您可以自定义配置,其优先级高于默认配置块。
先决条件
- 一个正在运行的 Red Hat Ceph Storage 集群。
- 主机添加到集群中。
- 部署所有管理器、监控器和 OSD 守护进程。
-
使用
mgr/nfs
模块创建的 NFS-Ganesha 集群。
流程
登录到 Cephadm shell:
示例
[root@host01 ~]# cephadm shell
以下是 NFS-Ganesha 集群默认配置的示例:
示例
# {{ cephadm_managed }} NFS_CORE_PARAM { Enable_NLM = false; Enable_RQUOTA = false; Protocols = 4; } MDCACHE { Dir_Chunk = 0; } EXPORT_DEFAULTS { Attr_Expiration_Time = 0; } NFSv4 { Delegations = false; RecoveryBackend = 'rados_cluster'; Minor_Versions = 1, 2; } RADOS_KV { UserId = "{{ user }}"; nodeid = "{{ nodeid}}"; pool = "{{ pool }}"; namespace = "{{ namespace }}"; } RADOS_URLS { UserId = "{{ user }}"; watch_url = "{{ url }}"; } RGW { cluster = "ceph"; name = "client.{{ rgw_user }}"; } %url {{ url }}
自定义 NFS-Ganesha 集群配置。以下是自定义配置的两个示例:
更改日志级别:
示例
LOG { COMPONENTS { ALL = FULL_DEBUG; } }
添加自定义导出块:
创建用户。
注意在 FSAL 块中指定的用户应当具有适当的上限,以便 NFS-Ganesha 守护进程能访问 Ceph 集群。
语法
ceph auth get-or-create client.USER_ID mon 'allow r' osd 'allow rw pool=.nfs namespace=NFS_CLUSTER_NAME, allow rw tag cephfs data=FS_NAME' mds 'allow rw path=EXPORT_PATH'
示例
[ceph: root@host01 /]# ceph auth get-or-create client.f64f341c-655d-11eb-8778-fa163e914bcc mon 'allow r' osd 'allow rw pool=.nfs namespace=nfs_cluster_name, allow rw tag cephfs data=fs_name' mds 'allow rw path=export_path'
进入以下目录:
语法
cd /var/lib/ceph/DAEMON_PATH/
示例
[ceph: root@host01 /]# cd /var/lib/ceph/nfs/
如果
nfs
目录不存在,请在路径中创建一个目录。创建新配置文件:
语法
touch PATH_TO_CONFIG_FILE
示例
[ceph: root@host01 nfs]# touch nfs-ganesha.conf
通过添加自定义导出块来编辑配置文件。它创建一个导出,并且由 Ceph NFS 导出接口管理。
语法
EXPORT { Export_Id = NUMERICAL_ID; Transports = TCP; Path = PATH_WITHIN_CEPHFS; Pseudo = BINDING; Protocols = 4; Access_Type = PERMISSIONS; Attr_Expiration_Time = 0; Squash = None; FSAL { Name = CEPH; Filesystem = "FILE_SYSTEM_NAME"; User_Id = "USER_NAME"; Secret_Access_Key = "USER_SECRET_KEY"; } }
示例
EXPORT { Export_Id = 100; Transports = TCP; Path = /; Pseudo = /ceph/; Protocols = 4; Access_Type = RW; Attr_Expiration_Time = 0; Squash = None; FSAL { Name = CEPH; Filesystem = "filesystem name"; User_Id = "user id"; Secret_Access_Key = "secret key"; } }
对集群应用新配置:
语法
ceph nfs cluster config set CLUSTER_NAME -i PATH_TO_CONFIG_FILE
示例
[ceph: root@host01 nfs]# ceph nfs cluster config set nfs-ganesha -i /var/lib/ceph/nfs/nfs-ganesha.conf
这还会为自定义配置重启服务。
验证
列出服务:
示例
[ceph: root@host01 /]# ceph orch ls
列出主机、守护进程和进程:
语法
ceph orch ps --daemon_type=DAEMON_NAME
示例
[ceph: root@host01 /]# ceph orch ps --daemon_type=nfs
验证自定义配置:
语法
/bin/rados -p POOL_NAME -N CLUSTER_NAME get userconf-nfs.CLUSTER_NAME -
示例
[ceph: root@host01 /]# /bin/rados -p nfs-ganesha -N nfsganesha get userconf-nfs.nfsganesha -
其它资源
- 如需更多信息,请参阅 Red Hat Ceph Storage Operations 指南中的使用 Ceph Orchestrator 设置自定义 NFS-Ganesha 配置部分。