这篇文章主要介绍Gluster集群高可用性配置和节点增删的示例分析,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!
IP地址规划
#vi /etc/hosts 200.192.100.101 glusternode1 #节点1地址 200.192.100.102 glusternode2 #节点2地址 200.192.100.100 glustervip #gluster服务地址
Volume Bricks规划
在节点1,节点2上执行:
#mkdir /storage #mount /dev/vg01/lvstorage /storage
在节点1,节点2上安装keepalived:
#yum install keepalived #vi /etc/keepalived/keepalived.conf ! Configuration File for keepalived vrrp_script chk_gluster { script "/etc/keepalived/check_gluster.sh" interval 2 global_defs { router_id LVS_DEVEL } vrrp_instance VI_1 { state MASTER #备服务器要改为BACKUP interface eth0 virtual_router_id 101 priority 100 #备服务器优先级要降低 advert_int 1 authentication { auth_type PASS auth_pass Pass2020wd } track_script { chk_gluster } virtual_ipaddress { 200.192.100.100/24 } } } :wq #vi /etc/keepalived/check_gluster.sh #!/bin/bash num=$(netstat -lnupt |grep glusterd | wc -l) if [ $num -eq 0 ];then systemctl start glusterd gluster volume start storage force if [ $(netstat -lnupt |grep glusterd | wc -l) -eq 0 ];then systemctl stop keepalived fi fi :wq #给脚本权限 chmod +x /etc/keepalived/check_gluster.sh
在节点1上添加节点2: gluster peer probe glusternode2
在节点2上添加节点1: gluster peer probe glusternode1
查看节点状态
gluster peer status
建立复制卷:
#创建复制卷 gluster volume create storage replica 2 glusternode1:/storage glusternode2:storage #启动卷storage gluster volume start storage #查看卷状态 gluster volume status #查看卷信息 gluster volume info storage
在节点1,2上执行
systemctl enable keepalived systemctl start keepalived
mount -t glusterfs glustervip:/storage /home/data
在glusternode2上查看服务IP已经飘逸
ip -a|grep 200.192.100.100 gluster volume status #查看状态发现glusternode1已经断开连接
将glusternode1上的节点删除
#先去掉glusternode1上的brick gluster volume remove-brick iso replica 1 glusternode1:/storage force gluster volume status gluster peer status gluster peer detach glusternode1 #将glusternode1节点去掉 gluster peer status gluster volume status
等glusternode1节点故障修复完成后,将节点重新加回
gluster peer probe glusternode1 #添加节点 gluster peer status #将节点的brick重新加入 gluster volume add-brick iso replica 2 glusternode1:/storage force gluster volume status
以上是“Gluster集群高可用性配置和节点增删的示例分析”这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注亿速云行业资讯频道!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。