麒麟服务器高可用集群部署方案
概述
本文介绍基于银河麒麟服务器操作系统的高可用(HA)集群部署方案,使用Pacemaker和Corosync实现服务的故障自动切换?/p>
环境准备
- 至少两台银河麒麟服务器(node1, node2?/li>
- 共享存储或DRBD
- VIP(虚拟IP)用于服务访?/li>
- 各节点间网络互?/li>
安装高可用组?/h2>
# 在所有节点执?
yum install -y pacemaker corosync pcs fence-agents-all
配置hosts
# /etc/hosts
192.168.1.101 node1
192.168.1.102 node2
配置集群
1
设置hacluster密码
passwd hacluster
2
启动pcsd服务
systemctl enable pcsd --now
3
认证节点(在任一节点执行?/h3>
pcs host auth node1 node2 -u hacluster -p 密码
4
创建集群
pcs cluster setup mycluster node1 node2
5
启动集群
pcs cluster start --all
pcs cluster enable --all
配置VIP资源
pcs resource create VIP ocf:heartbeat:IPaddr2 \
ip=192.168.1.100 cidr_netmask=24 \
op monitor interval=30s