3.4.2 Pacemaker(HA)

最后更新于:2022-04-02 07:38:26

#### 基础环境 ``` Server-1: 192.168.88.92 Server-2: 192.168.88.93 备注:Server-1和Server-2以下简称两台Server VIP: 192.168.88.94 ``` #### 服务器基础配置 ``` # 两台Server互相免密钥登录[步骤略] # 两台Server的/etc/hosts增加本机及对方主机名解析 192.168.88.92 c7-zbx-server-92 192.168.88.93 c7-zbx-server-93 ``` #### Pacemaker部署 ```shell # 基于Centos7 yum groupinstall ha -y systemctl start pcsd systemctl status pcsd echo 'noteshare.cn' | passwd --stdin hacluster # 创建集群 pcs cluster setup --name zabbix-cluster c7-zbx-server-92 c7-zbx-server-93 # 设置故障主机恢复后的行为 pcs resource defaults resource-stickiness=100 # 设置主机资源无法停止后的行为 pcs property set stonith-enabled=false # 配置虚拟IP pcs resource create VirtualIP ocf:heartbeat:IPaddr2 ip=10.15.205.94 cidr_netmask=16 nic=ens192 op monitor interval=5s --group zabbix-cluster # 配置服务启动 pcs resource create zabbix_server systemd:zabbix-server op monitor interval=10s # 配置资源绑定,VIP和资源绑定到一起 pcs constraint colocation add VirtualIP zabbix_server INFINITY --force # 设置VIP优先启动与zabbix_server pcs constraint order VirtualIP then zabbix_server ```
';