部署红帽pcs高可用集群详解
在日常工作过程中 , 我们总是要求服务器永久在线能给我们提供服务 , 可是服务器总是要维护的 , 那应该怎么样才能做到永久在线呢 , 此时就需要服务器的高可用技术 , 而红帽系提供了packmarker的技术来实现 , 我们具体来看看如何部署一个高可用的Linux集群吧 。
软件安装在每个节点上部署以下软件
for ip in {nodea,nodeb,nodec,noded};do ssh root@"$ip" "yum install pcs fence-agents-all fence-agents-rht -y";done
文章插图
启用并启动服务for ip in {nodea,nodeb,nodec,noded};do ssh root@"$ip" "systemctl enable pcsd;systemctl start pcsd";done
文章插图
规范化用户名和密码Pcsd服务使用hacluster这个用户用来集群通信和配置 , 所以建议在所有节点上使用相同的密码
for ip in {nodea,nodeb,nodec,noded};do ssh root@"$ip" "echo redhat | passwd --stdin hacluster";done
文章插图
开通防火墙规则for ip in {nodea,nodeb,nodec,noded};do ssh root@"$ip" "firewall-cmd --permanent --add-service=high-availability;firewall-cmd --reload";done
文章插图
授权各个节点登陆到节点A上
pcs cluster auth nodea.cluster0.example.com nodeb.cluster0.example.com nodec.cluster0.example.com noded.cluster0.example.com -u hacluster -p redhat
文章插图
部署集群pcs cluster setup --start --name bbs nodea.cluster0.example.com nodeb.cluster0.example.com nodec.cluster0.example.com noded.cluster0.example.com
文章插图
配置fence 设备pcs stonith create fence_nodea fence_rht port="nodea.cluster0.example.com" pcmk_host_list="nodea.cluster0.example.com" ipaddr="classroom.example.com"
pcs stonith create fence_nodeb fence_rht port="nodeb.cluster0.example.com" pcmk_host_list="nodeb.cluster0.example.com" ipaddr="classroom.example.com"
pcs stonith create fence_nodec fence_rht port="nodec.cluster0.example.com" pcmk_host_list="nodec.cluster0.example.com" ipaddr="classroom.example.com"
pcs stonith create fence_noded fence_rht port="noded.cluster0.example.com" pcmk_host_list="noded.cluster0.example.com" ipaddr="classroom.example.com"
文章插图
pcs stonith show
文章插图
启用集群默认情况下 , 集群节点重启后不会自动加入集群 , 我们可以用pcs cluster enable --all来设置自动启动服务
pcs cluster enable --all
文章插图
查看集群状态pcs cluster status
文章插图
推荐阅读
- 向美国靠拢?瑞典绕开华为部署5G!华为已2次起诉
- 一个人完成AI开发和部署 百度飞桨实现铁路货车车号精准检测
- 服务器|“按需定制”灵活部署,京东智联云“云服务”实力圈粉
- 红帽为CentOS的决定辩护 声称Stream版本可以覆盖当前95%的用户场景
- 最新,爱立信公布在英国部署5G计划!但仍与华为有差距?
- IPV6部署成果显著 中国电信助力加快网络强国建设
- 剑指微信,三大电信运营商开始规模化部署5G消息
- 基于在浪潮K1 Power部署Fabric网络的实践(一)
- BT选中爱立信为5G合作商 在伦敦等主要城市推进5G网络部署
- GPU|干货|基于 CPU 的深度学习推理部署优化实践