RH236配置IP故障转移--配置NFS Ganesha

RH236配置IP故障转移–配置NFS Ganesha

本章节学习配置NFS Ganesha解决高可用问题。

RHCA专栏地址:https://blog.csdn.net/qq_41765918/category_11532281.html

NFS-Ganesha特征

NFS-ganesha是NFS的用户模式文件服务器。它支持NFSv3、NFSv4、NFSv4.1和pNFS(作为技术预览)。使用Corosync和Pacemaker提供的集群基础设施,NFS-Ganesha可以实现高可用性。

Red Hat Gluster存储的内置NFS服务器只支持NFSv3。如果需要NFSv4、Kerberos身份验证或加密,或者IP故障转移,管理员应该使用NFS-Ganesha。

重要:NFS-Ganesha不能与内置的NFSv3服务器同时运行。应该在所有将运行NFS- ganesha的节点上禁用NFS。


可参考官网进行导出的学习:

https://www.gluster.org/glusterfs-and-nfs-ganesha-integration/

https://docs.gluster.org/en/latest/Administrator-Guide/NFS-Ganesha-GlusterFS-Integration/


课本练习(以练习来进行了解)

[root@workstation ~]# lab ganesha setup

1. 在servera和serverb上安装所需的包。
# systemctl stop glusterd
# killall glusterfs
# killall glusterfsd
# yum -y install glusterfs-ganesha
2. 更新servera和serverb上的防火墙。

以允许pacemaker/corosync、NFS、portmapper以及mountd。

# firewall-cmd --permanent --add-service=high-availability --add-service=nfs --add-service=rpc-bind --add-service=mountd 
success
# firewall-cmd --reload
success
3. 按要求修改配置文件。
[root@servera ~]# cp /etc/ganesha/ganesha-ha.conf.sample /etc/ganesha/ganesha-ha.conf
[root@servera ~]# vim /etc/ganesha/ganesha-ha.conf
[root@servera ~]# egrep -v ^# /etc/ganesha/ganesha-ha.conf
HA_NAME="gls-ganesha"
HA_VOL_SERVER="servera"
HA_CLUSTER_NODES="servera.lab.example.com,serverb.lab.example.com"
VIP_servera_lab_example_com="172.25.250.16"
VIP_serverb_lab_example_com="172.25.250.17"

[root@servera ~]# scp /etc/ganesha/ganesha-ha.conf serverb:/etc/ganesha/
4. 按要求设置集群。

通过启用正确的服务、设置集群用户密码和彼此进行身份验证,准备好servera和serverb作为集群成员。

# systemctl enable pacemaker.service 
Created symlink from /etc/systemd/system/multi-user.target.wants/pacemaker.service to /usr/lib/systemd/system/pacemaker.service.
# systemctl enable pcsd.service 
Created symlink from /etc/systemd/system/multi-user.target.wants/pcsd.service to /usr/lib/systemd/system/pcsd.service.
# systemctl start pcsd.service

# echo redhat | passwd --stdin hacluster 
Changing password for user hacluster.
passwd: all authentication tokens updated successfully.

从servera系统,验证所有节点之间的pc通信。
[root@servera ~]# pcs cluster auth -u hacluster -p redhat servera.lab.example.com serverb.lab.example.com
servera.lab.example.com: Authorized
serverb.lab.example.com: Authorized
5. 创建一个SSH密钥对,以支持nfs-ganesha的免密登录。
[root@servera ~]# ssh-keygen -f /var/lib/glusterd/nfs/secret.pem -t rsa -N ''
Generating public/private rsa key pair.
Your identification has been saved in /var/lib/glusterd/nfs/secret.pem.
Your public key has been saved in /var/lib/glusterd/nfs/secret.pem.pub.
The key fingerprint is:
a4:bd:d2:9d:b8:13:1a:4f:0a:21:a4:2c:b8:85:d0:d1 root@servera.lab.example.com
The key's randomart image is:
+--[ RSA 2048]----+
| ..o             |
|. o E            |
|++      .        |
|=.o .  +         |
|.o . .. S        |
|.   . ..o+ .     |
|     ..*+.o      |
|      o.o.       |
|        ..       |
+-----------------+
[root@servera ~]# scp /var/lib/glusterd/nfs/secret.pem* serverb:/var/lib/glusterd/nfs/
root@serverb's password: 
secret.pem                                             100% 1675     1.6KB/s   00:00    
secret.pem.pub                                         100%  410     0.4KB/s   00:00
[root@servera ~]# ssh-copy-id -i /var/lib/glusterd/nfs/secret.pem.pub root@servera
[root@servera ~]# ssh-copy-id -i /var/lib/glusterd/nfs/secret.pem.pub root@serverb
6. 在两个节点上启动glusterd,并为glusterd启用共享存储。
在两个节点上启动glusterd
# systemctl start glusterd.service

[root@servera ~]# gluster volume set all cluster.enable-shared-storage enable
7. 在两个节点上配置nfs-ganesha,以便为挂载进程使用默认端口(20048/tcp/20048/UDP)。
# tail -f -n 10 /etc/ganesha/ganesha.conf 
NFS_Core_Param {
        #Use supplied name other tha IP In NSM operations
        NSM_Use_Caller_Name = true;
        #Copy lock states into "/var/lib/nfs/ganesha" dir
        Clustered = false;
        #Use a non-privileged port for RQuota
        Rquota_Port = 4501;
        MNT_Port=20048;
}
8. 启用集群服务,配置对应的挂载。
[root@servera ~]# gluster nfs-ganesha enable
Enabling NFS-Ganesha requires Gluster-NFS to be disabled across the trusted pool. Do you still want to continue?
 (y/n) y
This will take a few minutes to complete. Please wait ..
nfs-ganesha : success 
You have mail in /var/spool/mail/root

[root@servera ~]# gluster volume set custdata ganesha.enable on
volume set: success
9. 设置永久挂载。
[root@servera ~]# showmount -e
Export list for servera.lab.example.com:
/custdata (everyone)
[root@servera ~]# showmount -e 172.25.250.16
Export list for 172.25.250.16:
/custdata (everyone)
[root@servera ~]# showmount -e 172.25.250.17
Export list for 172.25.250.17:
/custdata (everyone)

[root@workstation ~]# mkdir /mnt/nfs
[root@workstation ~]# echo "172.25.250.16:/custdata /mnt/nfs nfs rw,vers=4 0 0" >> /etc/fstab 
[root@workstation ~]# mount -a
[root@workstation ~]# df -Th
Filesystem              Type      Size  Used Avail Use% Mounted on
/dev/vda1               xfs        10G  3.0G  7.1G  30% /
devtmpfs                devtmpfs  902M     0  902M   0% /dev
tmpfs                   tmpfs     920M   84K  920M   1% /dev/shm
tmpfs                   tmpfs     920M   17M  904M   2% /run
tmpfs                   tmpfs     920M     0  920M   0% /sys/fs/cgroup
tmpfs                   tmpfs     184M   16K  184M   1% /run/user/42
tmpfs                   tmpfs     184M     0  184M   0% /run/user/0
172.25.250.16:/custdata nfs4      2.0G   33M  2.0G   2% /mnt/nfs
10. 脚本评分。

[root@workstation ~]# lab ganesha grade


章节实验

[root@workstation ~]# lab ipfailover setup

1. 在serverc和serverd上安装所需的软件,并在这些机器上的防火墙上打开此设置所需的任何端口。
# yum -y install samba ctdb
# firewall-cmd --permanent --add-service=samba
# firewall-cmd --permanent --add-port=4379/tcp
# firewall-cmd --reload
2. 停止ctdbmeta卷,然后在serverc和serverd上设置相关的启动和停止触发程序,以便为CTDB使用ctdbmeta卷。还为两个节点上的Samba启用集群。
[root@serverc ~]# gluster volume stop ctdbmeta 
Stopping volume will make its data inaccessible. Do you want to continue? (y/n) y
volume stop: ctdbmeta: success

# vim /var/lib/glusterd/hooks/1/start/post/S29CTDBsetup.sh
# $META is the volume that will be used by CTDB as a shared filesystem.
# It is not desirable to use this volume for storing 'data' as well.
# META is set to 'all' (viz. a keyword and hence not a legal volume name)
# to prevent the script from running for volumes it was not intended.
# User needs to set META to the volume that serves CTDB lockfile.
META=ctdbmeta

# vim /var/lib/glusterd/hooks/1/stop/pre/S29CTDB-teardown.sh
# $META is the volume that will be used by CTDB as a shared filesystem.
# It is not desirable to use this volume for storing 'data' as well.
# META is set to 'all' (viz. a keyword and hence not a legal volume name)
# to prevent the script from running for volumes it was not intended.
# User needs to set META to the volume that serves CTDB lockfile.
META=ctdbmeta

添加clustering = yes 配置
# grep clustering -C 2 /etc/samba/smb.conf 

[global]
clustering=yes
#------------------------ AIO Settings ------------------------
#
3. 启动ctdbmeta卷,然后配置 CTDB使用您的serverc和serverd系统进行iP故障转移,使用172.25.250.18/24作为浮动iP地址。
[root@serverc ~]# gluster volume start ctdbmeta 
volume start: ctdbmeta: success

# vim /etc/ctdb/nodes
172.25.250.12
172.25.250.13

# vim /etc/ctdb/public_addresses	
# cat /etc/ctdb/public_addresses 
172.25.250.18/24 eth0

# systemctl enable ctdb
# systemctl start ctdb
4. 确保使用Samba导出custdata卷。记住为smbuser用户设置一个redhat Samba密码。

将smbuser的samba密码设置为redhat。因为ctdb将此更改传播到所有节点,所以此步骤只需要在单个主机上执行。

# smbpasswd -a smbuser
New SMB password: redhat
Retype new SMB password: redhat
Added user smbuser.

# gluster volume set labdata stat-prefetch off
# gluster volume set labdata server.allow-insecure on
# gluster volume set labdata storage.batch-fsync-delay-usec 0

serverc和serverd都需要更改:
# vim /etc/glusterfs/glusterd.vol
    option rpc-auth-allow-insecure on
# systemctl restart glusterd

[root@serverc ~]# gluster volume stop labdata
Stopping volume will make its data inaccessible. Do you want to continue? (y/n) y
volume stop: custdata: success
[root@serverc ~]# gluster volume start labdata
volume start: custdata: success
5. 在您的workstation系统上,使用Samba通过浮动IP地址在/mnt/custdata上持久地挂载custdata卷。
[root@workstation ~]# mkdir /mnt/labdata
[root@workstation ~]# echo "//172.25.250.18/gluster-labdata /mnt/labdata cifs user=smbuser,pass=redhat 0 0" >> /etc/fstab
[root@workstation ~]# mount -a
[root@workstation ~]# df -Th
Filesystem                      Type      Size  Used Avail Use% Mounted on
/dev/vda1                       xfs        10G  3.1G  7.0G  31% /
devtmpfs                        devtmpfs  902M     0  902M   0% /dev
tmpfs                           tmpfs     920M   84K  920M   1% /dev/shm
tmpfs                           tmpfs     920M   17M  904M   2% /run
tmpfs                           tmpfs     920M     0  920M   0% /sys/fs/cgroup
tmpfs                           tmpfs     184M   16K  184M   1% /run/user/42
tmpfs                           tmpfs     184M     0  184M   0% /run/user/0
//172.25.250.18/gluster-labdata cifs      2.0G   33M  2.0G   2% /mnt/labdata
6. 脚本评分

[root@workstation ~]# lab ipfailover grade

7. 重置环境

reset workstation,servera,serverb,serverc,serverd


总结

  • 介绍如何配置NFS Ganesha解决高可用问题。

以上就是【金鱼哥】的分享。希望能对看到此文章的小伙伴有所帮助。

如果这篇【文章】有帮助到你,希望可以给【金鱼哥】点个赞👍,创作不易,相比官方的陈述,我更喜欢用【通俗易懂】的文笔去讲解每一个知识点,如果有对【运维技术】感兴趣,也欢迎关注❤️❤️❤️ 【金鱼哥】❤️❤️❤️,我将会给你带来巨大的【收获与惊喜】💕💕!

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
### 回答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-Ganesha为Ceph存储系统提供了一个方便、高效、可扩展的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协议,并提供了高性能、可靠性和可配置性,为用户提供了一个完整的文件共享和访问解决方案。无论是在企业还是科研领域,它都是一个值得考虑的选择。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

IT民工金鱼哥

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

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

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

打赏作者

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

抵扣说明:

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

余额充值