作者:【吴业亮】
博客:http://blog.csdn.net/wylfengyujiancheng
1、安装集群软件
[node1&node2&node3]# yum install -y lvm2 cifs-utils quota psmisc pcs pacemaker corosync fence-agents-all resource-agents crmsh
2、启动服务并设置开机启动
[node1&node2&node3]# systemctl start pcsd
[node1&node2&node3]# systemctl enable pcsd
3、修改集群管理员密码
[node1&node2&node3]# echo Changeme_123 | passwd --stdin hacluster
Changing password for user hacluster.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
4、建立认证
[node1/node2/node3]# pcs cluster auth node1 node2 node3 -u hacluster -p Changeme_123 --force
Username: hacluster
Password:
node1: Authorized
node2: Authorized
5、配置集群
[node1/node2/node3]# pcs cluster setup --force --name openstack-cluster node1 node2 node3
Shutting down pacemaker/corosync services...
Redirecting to /bin/systemctl stop pacemaker.service
Redirecting to /bin/systemctl stop corosync.service
Killing any remaining services...
Removing all cluster configuration files...
node1: Succeeded
node2: Succeeded
6、启动集群
[node1/node2/node3]# pcs cluster start --all
node2: Starting Cluster...
node1: Starting Cluster...
7、设置集群开机启动
[node1/node2/node3]# pcs cluster enable --all
node1: Cluster Enabled
node2: Cluster Enabled
8、查看集群状态
[node1/node2/node3]# pcs status cluster
Cluster Status:
Last updated: Wed Jun 23 19:36:55 2017
Last change: Wed Jun 23 19:36:47 2017
Stack: corosync
Current DC: node1 (1) - partition with quorum
Version: 1.1.12-a14efad
2 Nodes configured
0 Resources configured
查看corosync状态
[node1/node2/node3]# pcs status corosync
Membership information
----------------------
Nodeid Votes Name
1 1 node1 (local)
2 1 node2
禁用stonith和quorum
# pcs property set stonith-enabled=false
# pcs property set no-quorum-policy=ignore
配置资源粘性
# pcs property set default-resource-stickiness="INFINITY"
# pcs property list
验证
# crm_verify -L -V
# pcs property set pe-warn-series-max=1000 \
pe-input-series-max=1000 \
pe-error-series-max=1000 \
cluster-recheck-interval=5min
设置浮动IP
pcs resource create vip ocf:heartbeat:IPaddr2 ip=172.16.8.50 cidr_netmask=24 op monitor interval=30s