RHEL 10 两节点 HA:pcs/pacemaker 建集群与资源迁移
This content is not available in your language yet.
RHEL 10 的 HA 栈是 pcs + pacemaker + corosync。默认仓库不带,要先启用 highavailability repo;两节点集群能起来,但没有 fencing 就只是“实验集群”。本页在 390/393 上完整走一遍。
| 主机 | IP | 角色 |
|---|---|---|
| 390 | 192.168.2.232 | node 1 / DC |
| 393 | 192.168.2.235 | node 2 |
- pcs 0.12.2
- pacemaker 3.0.1
- corosync 3.1.10
E3 记录:plans/content-expansion/evidence/rhel/rhel-ha/run.json(5 步,含 auth/setup/quorum/resource)。
先给结论:先开 highavailability 仓库
Section titled “先给结论:先开 highavailability 仓库”只装 pcs 会报 “No matching Packages”,因为包在:
sudo subscription-manager repos --enable rhel-10-for-x86_64-highavailability-rpmssudo dnf -y install pcs pacemaker corosync fence-agents-all两台都要装,pcsd 要 active。
sudo passwd haclustersudo systemctl enable --now pcsdsudo firewall-cmd --add-service=high-availability --permanentsudo firewall-cmd --reloadsudo pcs host auth 192.168.2.232 192.168.2.235 -u hacluster192.168.2.235: Authorized192.168.2.232: Authorized两台 hacluster 密码必须一致;pcsd 默认 2224/tcp。
sudo pcs cluster setup hacluster 192.168.2.232 192.168.2.235 --startsudo pcs cluster enable --allsudo pcs property set stonith-enabled=falseCluster has been successfully set up.Starting cluster on hosts: '192.168.2.232', '192.168.2.235'...192.168.2.232: Cluster Enabled192.168.2.235: Cluster EnabledWarning: Setting property stonith-enabled to false leaves the cluster with no enabled means to fence nodes刚建完可能短暂 OFFLINE,等 10–20 秒。
quorum
Section titled “quorum”$ sudo pcs statusCluster name: hacluster * Stack: corosync (Pacemaker is running) * Current DC: 192.168.2.232 ... - partition with quorum * 2 nodes configuredNode List: * Online: [ 192.168.2.232 192.168.2.235 ]
$ sudo pcs quorum statusQuorum provider: corosync_votequorumNodes: 2Quorate: Yes两节点集群的 quorum 规则特殊:一台挂掉就失去 quorum,需要 two_node: 1 或 QDevice;生产别把两节点当高可用。
sudo pcs resource create dummy ocf:heartbeat:Dummy op monitor interval=10ssudo pcs status resources * dummy (ocf:heartbeat:Dummy): Started 192.168.2.232Dummy 只用于验证调度,不提供真实服务。
sudo pcs resource move dummy 192.168.2.235sudo pcs status resourcesresource 'dummy' is running on node '192.168.2.235' * dummy (ocf:heartbeat:Dummy): Started 192.168.2.235move 会创建临时 location 约束;迁移完成后 pcs constraint 里能看到,必要时 pcs resource clear dummy 清掉。
fencing 边界
Section titled “fencing 边界”stonith-enabled=false 让集群能在没有 fence 设备时启动,但:
- 节点失联时无法确认对方是否还持有资源;
- 可能出现双写/脑裂;
- 生产必须配
fence_ipmilan/fence_redfish/云 fence,并设stonith-enabled=true。
sudo pcs cluster destroy --allsudo systemctl disable --now pcsddestroy 会停 pacemaker/corosync 并删除配置;包可以保留。
- highavailability 仓库已启用;
- 两台 pcsd active、hacluster 密码一致;
-
pcs host auth都 Authorized; -
pcs status两节点 Online、Quorate Yes; - 资源能在节点间迁移;
- 生产有 fence/QDevice,不靠
stonith-enabled=false。
未实测与边界
Section titled “未实测与边界”- 未测试真实 fence 设备;
- 未测试 QDevice;
- 未测试三节点/quorum 丢失;
- 未测试资源 agent(VIP/文件系统/数据库)。
- RHEL 10 NFS 与 SMB — 共享存储
- RHEL 10 LVM 高级 — 集群存储基础
- 官方:Configuring and managing high availability clusters