【实践】cephfs + Ganesha环境部署

说在前面的一些话,会对搭建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

 

1  如何获取

目前稳定版本是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

  

2  搭建NFS-Ganesha+CephFS服务器

2.1 软件环境

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)》 

2.2 构建Nfs-Ganesha

2.2.1 安装

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)

 

2.2.2 主要命令

 [ceph@node0 Ganesha]$ ganesha.nfsd-h

Usage: nfs-ganesha [-hd][-L<logfile>][-N <dbg_lvl>][-f <config_file>]
    [-v]                display version information
    [-L<logfile>]      set the defaultlogfile for the daemon
    [-N<dbg_lvl>]      set the verbositylevel
    [-f<config_file>]  set the config fileto be used
    [-p<pid_file>]     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]<epoch<]       overridesServerBootTime for ServerEpoch
    [-h]                display this help
----------------- Signals----------------
SIGUSR1    : Enable/Disable File Content Cache forcedflush
SIGTERM    : Cleanly terminate the program
------------- Default Values-------------
LogFile    : SYSLOG
PidFile    : /var/run/ganesha.pid
DebugLevel : NIV_EVENT
ConfigFile :/etc/ganesha/ganesha.conf
[ceph@node0 Ganesha]$

 

2.3 Export Cephfs卷

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<location_of_nfs-ganesha.conf_file> -L <location_of_log_file> -N<log_level> -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
 

3  NFS Client

只要支持mount.nfs,并且与NFS服务器是网络互连的,均可挂载nfs分区

#mkdir /mnt/nfs
#mount -t nfs 192.168.123.100://mnt/nfs

使用df –h观察,可发现挂载的nfs分区

  

4  参考文献

[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


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

YoungerChina

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值