初探nfs-ganesha
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了初探nfs-ganesha相关的知识,希望对你有一定的参考价值。
初探nfs-ganesha
2016/11/18
1、使用方式 通过 nfs-ganesha 来输出 nfs 服务。 可以支持多种后端存储,详情请参考: https://github.com/nfs-ganesha/nfs-ganesha/wiki/Fsalsupport 本例示范的是 VFS 类型,glusterfs 类型的请参考该分类下的文档。 1)安装 [[email protected] ~]# yum install nfs-ganesha* -y 2)配置 [[email protected] ~]# vim /etc/ganesha/ganesha.conf %include "/etc/ganesha/conf.d/export.upload.conf" [[email protected] ~]# mkdir /etc/ganesha/conf.d [[email protected] ~]# 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)启用服务 [[email protected] ~]# service rpcbind start [[email protected] ~]# service nfs-ganesha start 查看日志: [[email protected] ~]# 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 :------------------------------------------------- 确认日志无异常。 [[email protected] ~]# chkconfig nfs-ganesha on 4)本机挂载测试 [[email protected] ~]# showmount -e localhost Export list for localhost: /mnt/tba (everyone) [[email protected] ~]# mount 127.0.0.1:/upload /media [[email protected] ~]# df -h |grep media 127.0.0.1:/upload 18G 2.5G 15G 15% /media [[email protected] ~]# 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服务使用小结”) 示例: [[email protected] ~]# yum install rpcbind nfs-utils [[email protected] ~]# mount 10.50.200.57:/upload /media/ [[email protected] ~]# 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 [[email protected] ~]# umount /media/ [[email protected] ~]# service rpcidmapd start [[email protected] ~]# mount 10.50.200.57:/upload /media/ [[email protected] ~]# 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 的版本则不行: [[email protected] ~]# umount /media [[email protected] ~]# service rpcidmapd stop [[email protected] ~]# mount -o vers=3 10.50.200.57:/mnt/tba /media/ [[email protected] ~]# 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 [[email protected] ~]# umount /media
以上是关于初探nfs-ganesha的主要内容,如果未能解决你的问题,请参考以下文章