环境
  1. # cat /etc/redhat-release
  2. CentOS Linux release 7.5.1804 (Core)
  3. # ceph -v
  4. ceph version 12.2.8 (ae699615bac534ea496ee965ac6192cb7e0e07c0) luminous (stable)
  5. # ganesha.nfsd -v
  6. NFS-Ganesha Release = V2.5.5
  7. nfs-ganesha compiled on Sep 4 2018 at 15:28:48
  8. Release comment = GANESHA file server is 64 bits compliant and supports NFS v3,4.0,4.1 (pNFS) and 9P
  9. Git HEAD = f92d5d184274784956eb5017fd2df633bae49d2b
  10. Git Describe = V2.5.5-0-gf92d5d1

安装配置

1、安装编译需要的公共库
  1. # yum -y install gcc git cmake autoconf libtool bison flex doxygen openssl-devel gcc-c++ krb5-libs krb5-devel libuuid-devel nfs-utils
2、下载源码包
  1. # git clone -b V2.5-stable https://github.com/nfs-ganesha/nfs-ganesha.git --recursive

这个下载的如果比较慢的话,也可以直接通过云盘进行下载
链接:https://pan.baidu.com/s/175kkzNOWVjV8Xo_ClHhVVA 密码:2ivn
3、安装FSAL_RGW模块

  1. # yum -y install librgw2-devel
4、编译安装
  1. # cd nfs-ganesha/src/
  2. # mkdir build
  3. # cd build/
  4. # cmake -DUSE_FSAL_RGW=ON ../
  5. # make
  6. # make install

cmake编译过程,会输出以下信息,需要确保— USE_FSAL_RGW = ON,如果是OFF,建议核实一下是否有安装librgw2-devel,如果没有安装的话,先安装这个包,然后删掉build目录,重新进行cmake

  1. ……
  2. -- USE_FSAL_CEPH_MKNOD = OFF
  3. -- USE_FSAL_CEPH_SETLK = OFF
  4. -- USE_FSAL_CEPH_LL_LOOKUP_ROOT = ON
  5. -- USE_FSAL_RGW = ON
  6. ……
5、修改配置文件
  1. # vim /etc/ganesha/ganesha.conf
  2. EXPORT
  3. {
  4. Export_ID=1;
  5. Path = "/";
  6. Pseudo = "/";
  7. Access_Type = RW;
  8. Protocols = 4;
  9. Transports = TCP;
  10. FSAL {
  11. Name = RGW;
  12. User_Id = "admin";
  13. Access_Key_Id ="OZBC94UP6VNBSF4EXECI";
  14. Secret_Access_Key = "nrfuys9wMWE7A8TOOPKEMg6gNtM5dzWlVPPQBS9P";
  15. }
  16. }
  17. RGW {
  18. ceph_conf = "/etc/ceph/ceph.conf";
  19. name = "client.rgw.controller-0";
  20. cluster = "ceph";
  21. }

配置文件中的User_Id,Access_Key_Id,Secret_Access_Key这三项的值要替换成指定的s3用户信息。以admin用户为例,如果没有创建s3用户,可以使用命令radosgw-admin user create —uid=admin —display-name=admin进行创建,创建过程会输出这些信息。针对已经存在的s3用户,以admin用户为例,可以使用命令radosgw-admin user info –-uid=admin命令进程查询。
RGW配置项中的name值,可以使用命令ceph auth list进行查询。

6、启动ganesha-nfs
  1. # ganesha.nfsd -f /etc/ganesha/ganesha.conf -L /var/log/nfs-ganesha.log -N NIV_DEBUG
7、挂载
  1. # showmount -e
  2. Export list for controller-0:
  3. # mount -t nfs 10.0.10.10:/ /mnt/

因为rgw是没有文件系统的容量概念,所以挂载之后使用df是查询不到的,需要使用mount命令查看挂载信息

  1. # mount | grep mnt
  2. 10.0.10.10:/ on /mnt type nfs4 (rw,relatime,vers=4.1,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys