说在前面的一些话,会对搭建NFS-GANESHA环境有非常大的帮助:
在我的环境中,使用的是未Update版本的centos 7.2,并且将其中所有的package包均作为repo源配置给系统。参见方法文章所述。
如果您的环境是经过网络update过,那么在您搭建环境过程中也尽量应该保证网络畅通,以使得yum可用从网络上下载合适的rpm包,否则搭建过程的”寻找合适的rpm包“将使得您焦头烂额。。。。
作者:Younger Liu,
本作品采用知识共享署名-非商业性使用-相同方式共享 3.0 未本地化版本许可协议进行许可。
原文地址:http://blog.csdn.net/younger_china/article/details/73412191
目前稳定版本是V2.3.2,开发版本为V2.4-dev-20。
源码地址:
https://github.com/nfs-ganesha/nfs-ganesha/releases
rpm包下载地址:
http://dl.fedoraproject.org/pub/epel/7/x86_64/n/
MailList:
https://lists.sourceforge.net/lists/listinfo/nfs-ganesha-devel
BugList:
https://bugzilla.redhat.com/query.cgi
CentOS:7.2.1511
Nfs-Ganesha:V2.3.2
Ceph:10.2.0 (下载地址http://download.ceph.com/rpm-jewel/el7/x86_64/)
如文章《[CEPH]基于CentOS7部署Ceph集群(版本10.2.2)》
1. 获取nfs-ganesha相关源码
地址为https://github.com/nfs-ganesha/nfs-ganesha获取的是2.3-stable
进入src下查看相对应的ntirpc源码CommitID
然后下载ntirpc源码包。
2. 安装相关rpm包
[ceph@node0 nfs]$ sudo yum –yinstall cmake*
[ceph@node0 nfs]$ sudo yum –yinstall krb5*
[ceph@node0 nfs]$ sudo yum –yinstall bison*
[ceph@node0 nfs]$ sudo yum –yinstall flex*
3. 将ntirpc源码包复制到目录nfs-ganesha*/src/libntirpc中
4. 建立build目录
[ceph@node0 nfs-ganesha-2.3-stable]$mkdir build
[ceph@node0 nfs-ganesha-2.3-stable]$cd build/
[ceph@node0 nfs-ganesha-2.3-stable]$cmake –DUSE_FSAL_CEPH=ON ../src
[ceph@node0 nfs-ganesha-2.3-stable]$make
[ceph@node0 nfs-ganesha-2.3-stable]$sudo make install
Make install之后,“ganesha.nfsd”复制到 “/usr//bin”目录
5.问题找不到uuid/uuid.h
[ceph@node0 nfs-ganesha-2.3-stable]$sudo yum –y install uuid*
或者手动安装相匹配的libuuid和libuuid-devel
6.切记在编译nfs-ganesha之前一定要安装libcephfs,否则USE_FSAL_CEPH会一直是OFF状态
检查卷是否导出
#showmount -e localhost
Export list for node0
/ (everyone)
[ceph@node0 Ganesha]$ ganesha.nfsd-h
Usage: nfs-ganesha [-hd][-L][-N ][-f ]
[-v] display version information
[-L] set the defaultlogfile for the daemon
[-N] set the verbositylevel
[-f] set the config fileto be used
[-p] set the pid file
[-F] the program stays in foreground
[-R] daemon will manage RPCSEC_GSS(default is no RPCSEC_GSS)
[-T] dump the default configurationon stdout
[-E]
Conf文件存放在/etc/ganesha/ganesha.conf
1. Export配置文件
Export任何一个Cephfs卷或目录,为每一个conf文件创建EXPORT Block,例如,export.conf,下面是最简单的配置文件
EXPORT
{
Export_ID=1;
Path= “/”;
Pseudo= /nfsv4/pseudofs/ceph/;
Access_Type= RW;
NFS_Protocols= 4;
Transport_Protocols= TCP;
FSAL{
Name= CEPH;
}
}
2.确认将conf文件复制到/etc/ganesha目录下,并定义为ganesha.conf
3. 在ganesha.conf include 我们定义的配置文件,放到ganesha.conf末尾。
%include“ceph.conf”
4. 手动启动nfs-ganesha,
执行如下命令:
$sudo ganesha.nfsd -f -L -N -d
例如:
$sudo ganesha.nfsd -f /etc/ganesha/ganesha.conf-L nfs-ganesha.log -N NIV_DEBUG -d
其中:
nfs-ganesha.log 是ganesha.nfsd进程的日志文件
NIV_DEBUG是日志级别.
检查ganesha是否启动:
#ps -aux | grep ganesha
5. Enable/Disable File Content Cache forced flush
sudo killall -s SIGUSR1 ganesha.nfsd
6. 终止ganesha
sudo killall -s SIGTERM ganesha.nfsd
只要支持mount.nfs,并且与NFS服务器是网络互连的,均可挂载nfs分区
#mkdir /mnt/nfs
#mount -t nfs 192.168.123.100://mnt/nfs
使用df –h观察,可发现挂载的nfs分区
[01]http://fedoraproject.org/wiki/Changes/NFSGanesha
[02]https://github.com/nfs-ganesha/nfs-ganesha/wiki/ReleaseNotes_2.0
[03]http://blog.widodh.nl/2014/12/nfs-ganesha-with-libcephfs-on-ubuntu-14-04/
作者:Younger Liu,
本作品采用知识共享署名-非商业性使用-相同方式共享 3.0 未本地化版本许可协议进行许可。
原文地址:http://blog.csdn.net/younger_china/article/details/73412191