本节主要是使用nfs-kernel-server将cephfs或rbd映射为nfs。
1、安装nfs相关软件
apt-get install nfs-kernel-server apt-get install nfs-common
2、在ceph-0001挂载好fuse和rbd
ceph-fuse /mnt/fuse rbd map r1 mount -t ext4 /dev/rbd0 /mnt/rbd
3、配置exports文件
vi /etc/exports /mnt/fuse 192.168.1.0/24(rw,sync,no_root_squash,no_subtree_check,fsid=0) /mnt/rbd 192.168.1.0/24(rw,sync,no_root_squash,no_subtree_check)
4、更新配置
exportfs -a systemctl restart nfs-kernel-server showmount -e Export list for ceph-0001: /mnt/rbd 192.168.1.0/24 /mnt/fuse 192.168.1.0/24
5、到另一台机器进行挂载
mount -t nfs ceph-0001:/mnt/fuse /mnt/fuse --verbose mount.nfs: timeout set for Fri Jun 5 19:06:27 2020 mount.nfs: trying text-based options 'vers=4.2,addr=192.168.1.101,clientaddr=192.168.1.103' mount.nfs: mount(2): No such file or directory mount.nfs: trying text-based options 'addr=192.168.1.101' mount.nfs: prog 100003, trying vers=3, prot=6 mount.nfs: trying 192.168.1.101 prog 100003 vers 3 prot TCP port 2049 mount.nfs: prog 100005, trying vers=3, prot=17 mount.nfs: trying 192.168.1.101 prog 100005 vers 3 prot UDP port 39630 mount -t nfs ceph-0001:/mnt/rbd /mnt/rbd --verbose mount.nfs: timeout set for Fri Jun 5 19:06:36 2020 mount.nfs: trying text-based options 'vers=4.2,addr=192.168.1.101,clientaddr=192.168.1.103' mount.nfs: mount(2): No such file or directory mount.nfs: trying text-based options 'addr=192.168.1.101' mount.nfs: prog 100003, trying vers=3, prot=6 mount.nfs: trying 192.168.1.101 prog 100003 vers 3 prot TCP port 2049 mount.nfs: prog 100005, trying vers=3, prot=17 mount.nfs: trying 192.168.1.101 prog 100005 vers 3 prot UDP port 39630 ls /mnt/fuse fuse.txt volumes ls /mnt/rbd lost+found rbd1.txt