环境
# cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)
# ceph -v
ceph version 12.2.8 (ae699615bac534ea496ee965ac6192cb7e0e07c0) luminous (stable)
# ganesha.nfsd -v
NFS-Ganesha Release = V2.5.5
nfs-ganesha compiled on Sep 4 2018 at 15:28:48
Release comment = GANESHA file server is 64 bits compliant and supports NFS v3,4.0,4.1 (pNFS) and 9P
Git HEAD = f92d5d184274784956eb5017fd2df633bae49d2b
Git Describe = V2.5.5-0-gf92d5d1
安装配置
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、下载源码包
# 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模块
# yum -y install librgw2-devel
4、编译安装
# cd nfs-ganesha/src/
# mkdir build
# cd build/
# cmake -DUSE_FSAL_RGW=ON ../
# make
# make install
cmake编译过程,会输出以下信息,需要确保— USE_FSAL_RGW = ON,如果是OFF,建议核实一下是否有安装librgw2-devel,如果没有安装的话,先安装这个包,然后删掉build目录,重新进行cmake
……
-- USE_FSAL_CEPH_MKNOD = OFF
-- USE_FSAL_CEPH_SETLK = OFF
-- USE_FSAL_CEPH_LL_LOOKUP_ROOT = ON
-- USE_FSAL_RGW = ON
……
5、修改配置文件
# vim /etc/ganesha/ganesha.conf
EXPORT
{
Export_ID=1;
Path = "/";
Pseudo = "/";
Access_Type = RW;
Protocols = 4;
Transports = TCP;
FSAL {
Name = RGW;
User_Id = "admin";
Access_Key_Id ="OZBC94UP6VNBSF4EXECI";
Secret_Access_Key = "nrfuys9wMWE7A8TOOPKEMg6gNtM5dzWlVPPQBS9P";
}
}
RGW {
ceph_conf = "/etc/ceph/ceph.conf";
name = "client.rgw.controller-0";
cluster = "ceph";
}
配置文件中的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
# ganesha.nfsd -f /etc/ganesha/ganesha.conf -L /var/log/nfs-ganesha.log -N NIV_DEBUG
7、挂载
# showmount -e
Export list for controller-0:
# mount -t nfs 10.0.10.10:/ /mnt/
因为rgw是没有文件系统的容量概念,所以挂载之后使用df是查询不到的,需要使用mount命令查看挂载信息
# mount | grep mnt
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