标签:nfs ganesha rpcidmapd rpcbind
初探nfs-ganesha
2016/11/18
1、使用方式 通过 nfs-ganesha 来输出 nfs 服务。 可以支持多种后端存储,详情请参考: https://github.com/nfs-ganesha/nfs-ganesha/wiki/Fsalsupport 本例示范的是 VFS 类型,glusterfs 类型的请参考该分类下的文档。 1)安装 [root@n57 ~]# yum install nfs-ganesha* -y 2)配置 [root@n57 ~]# vim /etc/ganesha/ganesha.conf %include "/etc/ganesha/conf.d/export.upload.conf" [root@n57 ~]# mkdir /etc/ganesha/conf.d [root@n57 ~]# vim /etc/ganesha/conf.d/export.upload.conf EXPORT { # Export Id (mandatory, each EXPORT must have a unique Export_Id) Export_Id = 77; # Exported path (mandatory) Path = /mnt/tba; # Pseudo Path (required for NFS v4) Pseudo = /upload; # Required for access (default is None) # Could use CLIENT blocks instead Access_Type = RW; # Exporting FSAL FSAL { Name = VFS; } } 3)启用服务 [root@n57 ~]# service rpcbind start [root@n57 ~]# service nfs-ganesha start 查看日志: [root@n57 ~]# tail /var/log/ganesha.log |grep NFS 18/11/2016 10:29:35 : epoch 582e678f : n57.test.com : ganesha.nfsd-4530[reaper] nfs_in_grace :STATE :EVENT :NFS Server Now IN GRACE 18/11/2016 10:29:35 : epoch 582e678f : n57.test.com : ganesha.nfsd-4530[main] nfs_start :NFS STARTUP :EVENT :------------------------------------------------- 18/11/2016 10:29:35 : epoch 582e678f : n57.test.com : ganesha.nfsd-4530[main] nfs_start :NFS STARTUP :EVENT : NFS SERVER INITIALIZED 18/11/2016 10:29:35 : epoch 582e678f : n57.test.com : ganesha.nfsd-4530[main] nfs_start :NFS STARTUP :EVENT :------------------------------------------------- 确认日志无异常。 [root@n57 ~]# chkconfig nfs-ganesha on 4)本机挂载测试 [root@n57 ~]# showmount -e localhost Export list for localhost: /mnt/tba (everyone) [root@n57 ~]# mount 127.0.0.1:/upload /media [root@n57 ~]# df -h |grep media 127.0.0.1:/upload 18G 2.5G 15G 15% /media [root@n57 ~]# cat /etc/mtab |grep upload 127.0.0.1:/upload /media nfs rw,vers=4,addr=127.0.0.1,clientaddr=127.0.0.1 0 0 默认使用的是 nfs-v4 来挂载,符合预期。 5)其他客户端挂载测试 因为是 nfs-v4 则需要考虑启用 rpcidmap 服务(可参考:“NFS服务使用小结”) 示例: [root@n34 ~]# yum install rpcbind nfs-utils [root@n34 ~]# mount 10.50.200.57:/upload /media/ [root@n34 ~]# ll /media/ -rw-r--r-- 1 4294967294 4294967294 451 Nov 16 13:57 1.log drwxr-xr-x 2 4294967294 4294967294 3896 Nov 16 10:55 lost+found [root@n34 ~]# umount /media/ [root@n34 ~]# service rpcidmapd start [root@n34 ~]# mount 10.50.200.57:/upload /media/ [root@n34 ~]# ll /media/ total 5 -rw-r--r-- 1 root root 451 Nov 16 13:57 1.log drwxr-xr-x 2 root root 3896 Nov 16 10:55 lost+found 否则请使用 nfs-v3 这个版本来规避 id 映射导致的权限问题。同时还要注意一点,v4的版本挂载点可以使用 Pseudo Path,而 v3 的版本则不行: [root@n34 ~]# umount /media [root@n34 ~]# service rpcidmapd stop [root@n34 ~]# mount -o vers=3 10.50.200.57:/mnt/tba /media/ [root@n34 ~]# ll /media/ total 5 -rw-r--r-- 1 root root 451 Nov 16 13:57 1.log drwxr-xr-x 2 root root 3896 Nov 16 10:55 lost+found [root@n34 ~]# umount /media
标签:nfs ganesha rpcidmapd rpcbind
原文地址:http://nosmoking.blog.51cto.com/3263888/1874320