1 2 3 4 5 6 7
| 作者:李晓辉
联系方式:
1. 微信:Lxh_Chat
2. 邮箱:939958092@qq.com
|
创建文件系统
1
| [root@serverc ~]# ceph fs volume create lxhfsname-2 --placement='serverc.lab.example.com'
|
在MGR上安装必备软件
在 Ceph MGR 节点上安装 nfs-ganesha、nfs-ganesha-ceph、nfs-ganesha-rados-grace 和 nfs-ganesha-rados-urls 软件包
1
| [root@serverc ~]# yum install nfs-ganesha nfs-ganesha-ceph nfs-ganesha-rados-grace nfs-ganesha-rados-urls -y
|
开启nfs模块
1
| [root@serverc ~]# ceph mgr module enable nfs
|
创建nfs集群
1 2 3 4 5 6 7 8 9 10 11 12 13
| [root@serverc ~]# ceph nfs cluster create nfsclustername 'serverc.lab.example.com,servere.lab.example.com' NFS Cluster Created Successfully
[root@serverc ~]# ceph nfs cluster info { "nfsclustername": [ { "hostname": "serverc.lab.example.com", "ip": "172.25.250.12", "port": 2049 } ] }
|
导出 CephFS 文件系统
格式是:
1
| ceph nfs export create cephfs <fsname> <clusterid> <binding> [--readonly] [<path>]
|
我在nfs集群中,创建了/nfs1的路径
1 2 3 4 5 6 7 8
| [root@serverc ~]# ceph nfs export create cephfs nfsclustername lxhfsname-2 /nfs1 { "bind": "/nfs1", "fs": "lxhfsname-2", "path": "/", "cluster": "nfsclustername", "mode": "RW" }
|
查看具体的导出详情
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| [root@serverc ~]# ceph nfs export ls nfsclustername [ "/nfs1" ]
[root@serverc ~]# ceph nfs export info nfsclustername /nfs1
{ "access_type": "RW", "clients": [], "cluster_id": "nfsclustername", "export_id": 1, "fsal": { "fs_name": "lxhfsname-2", "name": "CEPH", "user_id": "nfs.nfsclustername.1" }, "path": "/", "protocols": [ 4 ], "pseudo": "/nfs1", "security_label": true, "squash": "none", "transports": [ "TCP" ] }
|
开启防火墙
1 2 3 4
| [root@serverc ~]# firewall-cmd --add-port=2049/tcp --permanent success [root@serverc ~]# firewall-cmd --reload success
|
客户端挂载nfs
先安装nfs客户端
1
| [root@clienta ~]# yum install nfs-utils -y
|
1 2 3
| [root@clienta ~]# mount -t nfs serverc:/nfs1 /mnt [root@clienta ~]# df -h | grep mnt clienta:/nfs1 190G 0 190G 0% /mnt
|
版权声明: 本博客中的内容未经允许不得转载和引用,转载和引用需获得作者同意, 作者微信: Lxh_Chat