目 录CONTENT

文章目录

安装pacemarker集群

所念皆星河
2024-01-02 / 0 评论 / 0 点赞 / 41 阅读 / 4626 字

前期配置免密登入 hosts配置

1.所有节点安装pacemarker每节点执行

# yum install pcs -y
# systemctl enable pcsd
# systemctl start pcsd

2.修改集群密码每节点执行

echo hacluster | passwd --stdin hacluster

3.认证配置节点单节点执行

[root@qigx1 ~]# pcs cluster auth qigx1 qigx2 qigx3 -u hacluster -p hacluster --force
qigx1: Authorized
qigx2: Authorized
qigx3: Authorized
[root@qigx1 ~]# 

4.创建pacemarker集群

[root@qigx1 ~]# pcs cluster setup --force --name pcs-cluster qigx1 qigx2 qigx3
Destroying cluster on nodes: qigx1, qigx2, qigx3...
qigx1: Stopping Cluster (pacemaker)...
qigx3: Stopping Cluster (pacemaker)...
qigx2: Stopping Cluster (pacemaker)...
qigx1: Successfully destroyed cluster
qigx2: Successfully destroyed cluster
qigx3: Successfully destroyed cluster

Sending 'pacemaker_remote authkey' to 'qigx1', 'qigx2', 'qigx3'
qigx1: successful distribution of the file 'pacemaker_remote authkey'
qigx2: successful distribution of the file 'pacemaker_remote authkey'
qigx3: successful distribution of the file 'pacemaker_remote authkey'
Sending cluster config files to the nodes...
qigx1: Succeeded
qigx2: Succeeded
qigx3: Succeeded

Synchronizing pcsd certificates on nodes qigx1, qigx2, qigx3...
qigx1: Success
qigx2: Success
qigx3: Success
Restarting pcsd on the nodes in order to reload the certificates...
qigx1: Success
qigx2: Success
qigx3: Success

[root@qigx1 ~]# pcs cluster start --all
qigx1: Starting Cluster (corosync)...
qigx2: Starting Cluster (corosync)...
qigx3: Starting Cluster (corosync)...
qigx1: Starting Cluster (pacemaker)...
qigx3: Starting Cluster (pacemaker)...
qigx2: Starting Cluster (pacemaker)...

[root@qigx1 ~]# pcs cluster enable --all
qigx1: Cluster Enabled
qigx2: Cluster Enabled
qigx3: Cluster Enabled

[root@qigx1 ~]# pcs status
Cluster name: pcs-cluster

WARNINGS:
No stonith devices and stonith-enabled is not false

Stack: corosync
Current DC: qigx3 (version 1.1.23-1.el7_9.1-9acf116022) - partition with quorum
Last updated: Wed Jan  3 01:58:03 2024
Last change: Wed Jan  3 01:56:27 2024 by hacluster via crmd on qigx3

3 nodes configured
0 resource instances configured

Online: [ qigx1 qigx2 qigx3 ]

No resources


Daemon Status:
  corosync: active/enabled
  pacemaker: active/enabled
  pcsd: active/enabled

5.设置集群属性

[root@qigx1 ~]# pcs property set pe-warn-series-max=1000 pe-input-series-max=1000 pe-error-series-max=100
[root@qigx1 ~]# pcs property set cluster-recheck-interval=5
[root@qigx1 ~]# pcs property set stonith-enabled=false
[root@qigx1 ~]# pcs property list

Cluster Properties:
 cluster-infrastructure: corosync
 cluster-name: pcs-cluster
 cluster-recheck-interval: 5
 dc-version: 1.1.23-1.el7_9.1-9acf116022
 have-watchdog: false
 pe-error-series-max: 100
 pe-input-series-max: 1000
 pe-warn-series-max: 1000
 stonith-enabled: false

6.设置vip

pcs resource create vip ocf:heartbeat:IPaddr2 ip=172.21.9.88 cidr_netmask=24 nic=eth0 op monitor interval=30s

7.集群相关操作

# 查看集群状态
# pcs status cluster
# 查看corosync状态;
# pcs status corosync
# 查看集群资源,即查看vip在哪台节点上
# pcs resource
web访问https://ip:2224 hacluster  hacluster
0

评论区