【nfs-ganesha】nfs-ganesha编译选项

nfs-ganesha

安装相关依赖包:

yum install epel-release
yum install userspace-rcu-devel
yum install dbus-c++-devel.x86_64
yum install dbus-devel

yum install uuid uuid-devel
yum install libuuid libuuid-devel

// 解决:"sys/acl.h: No such file or directory"问题
yum install libacl.x86_64
yum install libacl-devel.x86_64

克隆源码到本地:

git clone -b V3-stable https://github.com/nfs-ganesha/nfs-ganesha.git --recursive

编译:

  cd nfs-ganesha
  cd src/
  mkdir build
  cd build/
  cmake -DUSE_FSAL_RGW=ON -DUSE_FSAL_CEPH=ON -DUSE_DBUS=ON ../

 

 /root/nfs-ganesha/src/build/ganesha.nfsd -L /var/log/ganesha.log -N NIV_DEBUG -f /etc/ganesha/ganesha.conf
/root/nfs-ganesha/src/build/ganesha.nfsd -L /var/log/ganesha.log -N NIV_FULL_DEBUG -f /etc/ganesha/ganesha.conf
/root/nfs-ganesha/src/build/ganesha.nfsd -L /var/log/ganesha.log -N NIV_FULL_DEBUG -f /etc/ganesha/ganesha.conf -F true

前端执行:

/root/nfs-ganesha/src/build/ganesha.nfsd -L /var/log/ganesha.log -N NIV_FULL_DEBUG -f /etc/ganesha/ganesha.conf -F true

 

v3挂载:

mount -t nfs -o nfsvers=3,noauto,noacl,hard,sync,proto=tcp 10.0.4.9:/cephfs /mnt

v4挂载:

mount -t nfs -o nfsvers=4.1,noauto,noacl,hard,sync,proto=tcp 10.0.4.9:/cephfs /mnt

 

nfs-ganesha编译:

先回顾一下nfs-ganesha 编译:
nfs-ganesha 是需要mkdir build 然后cd build 执行cmake -DXXXX=on/off ../src

nfs-ganesha 编译选项都是在源码中的src/CMakeLists.txt 关键字:

与之一样的编译选项:USE_FSAL_PROXY/USE_FSAL_VFS/USE_FSAL_XFS/USE_FSAL_GPFS/USE_FSAL_MEM/USE_FSAL_GLUSTER/USE_FSAL_CEPH_RGWFS
注意:(1) 如果找不到cephfs的库的话 即使设置为ON 也会修改为OFF (命令:ldconfig -p |grep cephfs) (2) 添加路径:src/fsal/CMakeLists.txt、

2.USE_FSAL_CEPH_RGWFS:build CEPH_RGWFS FSAL shared library 需要librgw.so(命令:ldconfig -p |grep rgw) rgw版本必须是大于1.1.6版本、
3.USE_FSAL_CEPH_MKNOD:宏定义 宏为:USE_FSAL_CEPH_MKNOD 该宏决定fsal_ceph_ll_mknod函数是否被编译
4.USE_FSAL_CEPH_SETLK:宏定义 宏为:USE_FSAL_CEPH_SETLK 该宏决定ceph_lock_op2函数是否被编译

5.USE_FSAL_CEPH_LL_LOOKUP_ROOT:宏定义 宏为:USE_FSAL_CEPH_LL_LOOKUP_ROOT 该宏决定fsal_status_t函数的不同逻辑
6.USE_FSAL_CEPH_STATX:宏定义 宏为:USE_FSAL_CEPH_STATX 该宏决定头文件Statx_compat.h中的一批静态内联函数是否被编译
7.USE_FSAL_CEPH_LL_DELEGATION:宏定义 宏为:USE_FSAL_CEPH_LL_DELEGATION 该宏决定ceph_deleg_cb ceph_lease_op2函数是否被编译
8.USE_FSAL_CEPH_LL_SYNC_INODE:宏定义 宏为:USE_FSAL_CEPH_LL_SYNC_INODE 该宏决定fsal_ceph_ll_setattr函数是否调用ceph_ll_sync_inode
9.USE_FSAL_PANFS: 默认为OFF 为ON时 在build/FSAL/FSAL_VFS下面产生panfs文件夹 paNFS是厂商Panasas的产品
10.USE_FSAL_NULL:默认ON 对应代码是src/FSAL/Stackable_FSALs/FSAL_NULL
11.USE_DBUS:默认OFF 为ON时,定义了一个宏USE_DBUS (https://github.com/nfs-ganesha/nfs-ganesha/wiki/Dbusinterface https://www.freedesktop.org/wiki/Software/dbus/).
ALLOCATOR:此设置是使用分配内存时 调用接口不同 3个赋值:jemalloc|tcmalloc|libc 默认使用jemalloc 如果没有安装jemalloc或是tcmalloc 最终会被设置为libc
13.ENABLE_LOCKTRACE:默认OFF 设置为ON时 跟Mdcache有关
14.USE_MAN_PAGE:默认为OFF 为ON时 主要是生成使用man命令查看相关信息
14.DEBUG_SYMS:默认为OFF 为ON 相当于加入-g 能够生成符号表 进行gdb调试
15.USE_GUI_ADMIN_TOOLS:默认为ON 与生成命令行工具有关 为ON时 需要安装PyQT 相关代码路径:nfs-ganesha/src/scripts/ganeshactl/Ganesha/QtUI
16.USE_ADMIN_TOOLS:默认为OFF 与命令行工具相关 为ON时 生成ganeshactl文件夹 相关代码路径:nfs-ganesha/src/scripts/ganeshactl/

 

nfs-ganesha默认编译选项

在build下 执行cmake ../XX/src
默认为ON的参数:

USE_FSAL_PROXY=ON
USE_FSAL_VFS=ON
USE_FSAL_XFS=ON
USE_FSAL_GPFS=ON
USE_FSAL_NULL=ON
USE_FSAL_MEM=ON
USE_BLKID = ON
_NO_XATTRD=ON
USE_GSS = ON
USE_9P=ON
_USE_9P=ON
USE_NFS3=ON
USE_NLM=ON
USE_GUI_ADMIN_TOOLS=ON

默认安装路径: 64位编译的话:LIB_INSTALL_DIR:PATH=/usr/lib64
默认配置路径: SYSCONFDIR:PATH=/etc
默认程序状态路径: SYSSTATEDIR:PATH=/var

 

综上,编译nfs-ganesha与RGW想配合的版本 编译选项:

USE_FSAL_XFS=ON ---> USE_FSAL_XFS=OFF
USE_FSAL_GPFS=ON ----> USE_FSAL_GPFS=OFF
USE_FSAL_CEPH_RGWFS=OFF -----> USE_FSAL_CEPH_RGWFS=ON

如果想编译调试版本:
DEBUG_SYMS=OFF ----> DEBUG_SYMS=ON

 

编译
1.非调试版本:cmake -DUSE_FSAL_XFS=OFF -DUSE_FSAL_GPFS=OFF -DUSE_FSAL_CEPH_RGWFS=ON -DUSE_ADMIN_TOOLS=ON -DUSE_DBUS=ON ../xxx/src
2.调试版本:cmake -DUSE_FSAL_XFS=OFF -DUSE_FSAL_GPFS=OFF -DUSE_FSAL_CEPH_RGWFS=ON -DUSE_ADMIN_TOOLS=ON -DUSE_DBUS=ON  -DDEBUG_SYMS=ON ../xxx/src

 

编译结果存放
nfs-ganesha/build/MainNFSD

 

相关安装
除了 https://github.com/nfs-ganesha/nfs-ganesha/wiki/Compiling 上面描述的依赖
还需要安装libcap(libcap-devel.x86_64) python(安装python 与生成命令行工具有关) jemalloc(可选)

nfs-ganesha需要安装的库及工具:例子centos7

1.userspace-rcu:yum install userspace-rcu.x86_64

2.rpmbuild:yum install rpm-build

 

注意

1.如果nfs-ganesha确实基于jemalloc编译的,那么nfs-ganesha运行环境上面也需要安装jemalloc
2.USE_FSAL_PANFS 此选项不要设置为ON (issue:https://github.com/nfs-ganesha/nfs-ganesha/issues/464)
3.使用jemalloc编译nfs-ganesha: issue:https://github.com/nfs-ganesha/nfs-ganesha/issues/465
4.-DUSE_GTEST=ON 需要安装LTTng Gperftools软件
5.src/config_parse/test_parse.c在编译config_parse是不被编译的
6. librgw相关:
//The RGW include headers RGW_INCLUDE_DIR:PATH=/usr   ----> /usr/include/rados librgw.h
//Path to a library. RGW_LIBRARY:FILEPATH=/usr/lib64/librgw.so
//The RGW libraries RGW_LIBRARY_DIR:PATH=/usr/lib64

 

nfs-ganesha挂载:

v4协议挂载:

mount -t nfs -o nfsvers=4.0,lock,proto=tcp, 192.168.19.101:/sunbin /mnt/sunbin01
mount -t nfs -o nfsvers=4.1,lock,proto=tcp, 192.168.19.101:/sunbin /mnt/sunbin01

v3协议挂载:

mount -t nfs -o nfsvers=3,lock,proto=tcp, 192.168.19.101:/sunbin /mnt/sunbin01

参考资料

1. 源码编译安装 ganesha

2. 配置ganesha-nfs对接rgw

3. 通过nfs-ganesha方式共享cephfs存储,nfs-ganesha使用方式与nfs一致

posted @ 2022-10-10 15:36  苏格拉底的落泪  阅读(671)  评论(0编辑  收藏  举报