nfs-ganesha(用户态NFS)编译、安装和使用

前面的文章介绍了基于社区或自己项目编译rpm包搭建Ceph分布式存储集群的方法。本篇介绍使用nfs-ganesha源码编译、安装,客户端使用用户态nfs协议挂载使用Ceph文件存储和对象存储的方法。

<一> 编译与安装nfs-ganesha

一、 获取源码

源码可直接从github上git clone,也可以使用自己库维护的代码:
github:

git clone git@github.com:nfs-ganesha/nfs-ganesha.git
git checkout V3.4

自己库:

git clone XXXXX

二、 安装依赖

安装所需的依赖:

yum install gcc git cmake autoconf libtool bison flex
yum install libgssglue-devel openssl-devel nfs-utils-lib-devel doxygen redhat-lsb gcc-c++
yum -y install libcephfs-devel.x86_64 librgw-devel.x86_64 libuuid-devel userspace-rcu-devel

新建build目录并进入:

mkdir build && cd build

三、 构建cmake编译环境

cmake -DUSE_FSAL_RGW=ON -DUSE_FSAL_CEPH=ON ../src/

四、 编译并安装

make && make install

五、 配置systemctl启动

将源码目录:nfs-ganesha/src/scripts/systemd下,nfs-ganesha-lock.service.el7,nfs-ganesha.service.el7拷贝到/usr/lib/systemd/system/下,并去掉后缀.el7:

cd nfs-ganesha/src/scripts/systemd
cp –a nfs-ganesha-lock.service.el7 nfs-ganesha.service.el7 /usr/lib/systemd/system/
cd /usr/lib/systemd/system/
mv nfs-ganesha-lock.service.el7 nfs-ganesha-lock.service
mv nfs-ganesha.service.el7 nfs-ganesha.service

并重置systemctl:

systemctl daemon-reload

<二> 使用nfs-ganesha

一、 配置/etc/ganesha/ganesha.conf

文件存储
如果是文件存储,建议配置如下:

###################################################
#
# Ganesha Config Example
#
# This is a commented example configuration file for Ganesha.  It is not
# complete, but only has some common configuration options.  See the man pages
# for complete documentation.
#
###################################################

## These are core parameters that affect Ganesha as a whole.
NFS_CORE_PARAM {
	## Allow NFSv3 to mount paths with the Pseudo path, the same as NFSv4,
	## instead of using the physical paths.
	mount_path_pseudo = true;

	## Configure the protocols that Ganesha will listen for.  This is a hard
	## limit, as this list determines which sockets are opened.  This list
	## can be restricted per export, but cannot be expanded.
	Protocols = 3,4;
}

## These are defaults for exports.  They can be overridden per-export.
EXPORT_DEFAULTS {
	## Access type for clients.  Default is None, so some access must be
	## given either here or in the export itself.
	Access_Type = RW;
}

## Configure settings for the object handle cache
#MDCACHE {
	## The point at which object cache entries will start being reused.
	#Entries_HWMark = 100000;
#}

## Configure an export for some file tree
EXPORT {
	## Export Id (mandatory, each EXPORT must have a unique Export_Id)
	Export_Id = 12345;

	## Exported path (mandatory)
	Path = /;

	## Pseudo Path (required for NFSv4 or if mount_path_pseudo = true)
	Pseudo = /mnt/cephfs;

	## Restrict the protocols that may use this export.  This cannot allow
	## access that is denied in NFS_CORE_PARAM.
	Protocols = 3,4;

	## Access type for clients.  Default is None, so some access must be
	## given. It can be here, in the EXPORT_DEFAULTS, or in a CLIENT block
	Access_Type = RW;

	## Whether to squash various users.
	Squash = No_Root_Squash;

	## Allowed security types for this export
	#Sectype = sys,krb5,krb5i,krb5p;

	## Exporting FSAL
	FSAL { 
		Name = CEPH;
	}
}

# Config block for FSAL_CEPH
CEPH {
 	# Path to a ceph.conf file for this ceph cluster.
 	Ceph_Conf = /etc/ceph/ceph.conf;

 	# User file-creation mask. These bits will be masked off from the unix
 	# permissions on newly-created inodes.
 	umask = 0;
}

## Configure logging.  Default is to log to Syslog.  Basic logging can also be
## configured from the command line
LOG {
	## Default log level for all components
	Default_Log_Level = WARN;

	## Configure per-component log levels.
	#Components {
		#FSAL = INFO;
		#NFS4 = EVENT;
	#}

	## Where to log
	Facility {
		name = FILE;
		destination = "/var/log/ganesha.log";
		enable = active;
	}
}

对象存储
如果是对象存储,建议配置如下:

###################################################
#
# Ganesha Config Example
#
# This is a commented example configuration file for Ganesha.  It is not
# complete, but only has some common configuration options.  See the man pages
# for complete documentation.
#
###################################################

## These are core parameters that affect Ganesha as a whole.
NFS_CORE_PARAM {
        ## Allow NFSv3 to mount paths with the Pseudo path, the same as NFSv4,
        ## instead of using the physical paths.
        mount_path_pseudo = true;

        ## Configure the protocols that Ganesha will listen for.  This is a hard
        ## limit, as this list determines which sockets are opened.  This list
        ## can be restricted per export, but cannot be expanded.
        Protocols = 3,4;
}

## These are defaults for exports.  They can be overridden per-export.
EXPORT_DEFAULTS {
        ## Access type for clients.  Default is None, so some access must be
        ## given either here or in the export itself.
        Access_Type = RW;
}

## Configure settings for the object handle cache
MDCACHE {
        ## The point at which object cache entries will start being reused.
        #Entries_HWMark = 100000;
        Dir_Chunk = 512;
}

## Configure an export for some file tree
EXPORT {
        ## Export Id (mandatory, each EXPORT must have a unique Export_Id)
        Export_Id = 1234;

        ## Exported path (mandatory)
        Path = /;

        ## Pseudo Path (required for NFSv4 or if mount_path_pseudo = true)
        Pseudo = /mnt/cephfs;

        ## Restrict the protocols that may use this export.  This cannot allow
        ## access that is denied in NFS_CORE_PARAM.
        Protocols = 3,4;

        ## Access type for clients.  Default is None, so some access must be
        ## given. It can be here, in the EXPORT_DEFAULTS, or in a CLIENT block
        Access_Type = RW;

        ## Whether to squash various users.
        Squash = No_Root_Squash;
        Transports = TCP;

        ## Allowed security types for this export
        #Sectype = sys,krb5,krb5i,krb5p;

        ## Exporting FSAL
        FSAL {
                Name = RGW;
                User_id = "User1";
                Access_Key_Id = "XXXXXXXXXX";
                Secret_Access_Key = "XXXXXXXXXXXXX";
        }
}

RGW {
        ceph_conf = /etc/ceph/ceph.conf;
        cluster = ceph;
        name = client.rgw.ceph2.rgw1;
        #init_args = "-d --debug-rgw=16";
}

## Configure logging.  Default is to log to Syslog.  Basic logging can also be
## configured from the command line
LOG {
        ## Default log level for all components
        Default_Log_Level = WARN;

        ## Configure per-component log levels.
        #Components {
                #FSAL = INFO;
                #NFS4 = EVENT;
        #}

        ## Where to log
        Facility {
                name = FILE;
                destination = "/var/log/ganesha.log";
                enable = active;
        }
}

二、 启动nfs-ganesha服务

systemctl start nfs-ganesha
systemctl enable nfs-ganesha

三、客户端挂载

客户端可通过showmount –e XX.XX.XX.XX查看启用ganesha服务的节点提供的挂载目录,然后通过:

mount –t nfs4 XX.XX.XX.XX:/mnt/XX /home/XXX

挂载到客户端某个目录下,便可开始文件/对象存储的访问。

  • 2
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
Ceph是一个可靠的、数据自动重均衡、自动恢复的SDS(软件定义存储)分布式存储系统,功能主要有三大块:块存储、对象存储、文件系统。Ceph不但是提供了统一存储,并且同时还充分利用了客户端的计算能力,在存储每一个数据时,都会通过计算得出该数据存储的位置,尽量将数据分布均衡,同时由于Ceph的设计,采用了CRUSH算法、HASH环等方法,使得它不存在传统的单点故障的问题,且随着规模的扩大性能并不会受到影响。不管是私有云还是公有云,随着云架构的发展,Ceph 成为了OpenStack、Proxmox标配的后端存储,不光如此,就连目前最火的容器编排 Kubernetes 持久存储也都支持 Ceph ,让 Ceph 成为当前主流的存储系统,而对 Ceph 存储的学习也就变的刻不容缓。 该课程属于比较基础的 Ceph 存储课程,旨在让大家能快速上手对 Ceph 集群的部署以及操作,主要讲解以下几个方面: 1.     架构的介绍2.     集群的多种部署方式3.     块存储部署,客户端使用及快照、克隆和镜像4.     对象存储的部署及简单使用5.     Ceph FS 文件系统的部署、客户端使用及导出为NFS6.     集群的操作和管理,包括服务,集群扩展,缩减和集群维护7.     Ceph 基础知识的介绍,包括集群map,PG和身份验证8.     Ceph 集群的监控
### 回答1: Ceph NFS-Ganesha是一个在Ceph分布式存储系统上部署的NFS网关服务。Ceph是一个开源的分布式存储系统,它提供了高度可扩展的对象存储和块存储服务。而NFS-Ganesha是一个开源的用户空间NFS服务器,它允许将Ceph存储系统通过NFS协议暴露给客户端。 通过部署Ceph NFS-Ganesha用户可以使用标准的NFS协议从客户端访问Ceph存储。这样一来,用户可以像访问本地文件系统一样访问Ceph存储,而无需额外的客户端软件或驱动程序。这提供了更方便和统一的访问方式,并增强了Ceph存储的可用性和可访问性。 Ceph NFS-Ganesha提供了多种配置选项和管理功能,用户可以根据自己的需求和场景来灵活配置和管理NFS-Ganesha服务。它支持多种NFS协议版本(如NFSv3、NFSv4)和安全认证机制(如Kerberos、SASL),并提供了高级的特性,如文件锁定、ACL支持等。 此外,Ceph NFS-Ganesha还具备高可用性和容错性。通过多个NFS-Ganesha网关的部署,可以实现NFS服务的冗余和负载均衡。当某个网关节点故障时,其他节点可以接管服务,确保数据的持续可访问性。 总之,Ceph NFS-GaneshaCeph存储系统提供了一个方便、高效、可扩展的NFS接口,使得用户可以更加灵活地使用Ceph存储,并提供了高可用性和容错性保证。这是一个强大的工具,可用于构建大规模分布式存储和数据共享解决方案。 ### 回答2: Ceph NFS-Ganesha是一个基于Ceph存储集群的分布式文件系统解决方案。它结合了Ceph的高可用、可伸缩性和数据冗余特性,与NFS-Ganesha的协议转换能力相结合,提供了一种可靠、高效的共享文件系统。 在Ceph NFS-Ganesha中,NFS-Ganesha作为一个用户空间的文件系统服务器,负责将NFS请求转换为与Ceph存储集群通信的RADOS Gateway请求。RADOS Gateway是Ceph存储集群的一部分,负责与客户端通信,提供对象存储和块存储的功能。 通过将NFS请求转换为RADOS Gateway请求,Ceph NFS-Ganesha可以将数据分布到Ceph存储集群的多个节点上,实现数据的冗余和可靠性。同时,由于Ceph存储集群的分布式特性,可以实现高可用和可伸缩性,提供更好的性能和扩展性。 另外,Ceph NFS-Ganesha还支持多种认证机制,可以通过Kerberos、LDAP等方式进行用户认证和授权管理,以确保数据的安全性和访问控制。 总的来说,Ceph NFS-Ganesha是一个强大而灵活的分布式文件系统解决方案,结合了Ceph存储集群和NFS-Ganesha的优势,提供可靠、高效的共享文件系统功能。无论是在大规模的数据存储环境还是小型的个人或企业需求中,Ceph NFS-Ganesha都可以提供稳定、可靠的文件系统服务。 ### 回答3: Ceph NFS-Ganesha是一个基于Ceph存储系统的开源文件共享解决方案。它通过将Ceph的分布式存储和NFS协议相结合,为用户提供了一个可靠、高性能的共享文件系统。 NFS-Ganesha充分利用了Ceph的特性,如分布式存储、数据冗余和自动恢复等。它通过将Ceph集群的存储空间划分为多个块,每个块由多个存储节点组成,来实现数据的高可靠性和可扩展性。该解决方案还提供了快速的数据访问速度,支持高吞吐量和低延迟的文件访问。 NFS-Ganesha还具有灵活性和可配置性。用户可以根据自己的需求调整不同的参数,以优化性能和功能。它支持多种NFS版本,可以与其他存储系统和应用程序集成,并提供高级功能,如文件锁定、权限控制和文件级别的快照。 通过使用Ceph NFS-Ganesha用户可以轻松共享和访问数据。无论是在企业中的文件共享,还是在科学研究中的数据交换,都可以通过该解决方案实现高效的文件共享和传输。同时,Ceph的分布式存储能力保证了数据的可靠性和可扩展性,为用户提供了一个可靠的存储基础设施。 总之,Ceph NFS-Ganesha是一个功能强大的文件共享解决方案,它结合了Ceph的分布式存储和NFS协议,并提供了高性能、可靠性和可配置性,为用户提供了一个完整的文件共享和访问解决方案。无论是在企业还是科研领域,它都是一个值得考虑的选择。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值