OS
Rocky Linux release 8.10 (Green Obsidian)
前提
SELinuxは停止
firewalldも停止
systemctl disable firewalld
grubby --update-kernel ALL --args selinux=0
shutdown -r now
クラスタ構築 以下1号機・2号機両方
dnf config-manager --set-enabled ha
dnf clean all
dnf install -y pcs pacemaker resource-agents fence-agents-all
systemctl enable --now pcsd
passwd hacluster
※1号機と2号機同じパスワードにしてください
クラスタ構築 以下1号機だけで
node名
ha001
ha002
pcs host auth ha001 ha002 -u hacluster
pcs host auth ha133 ha134 -u hacluster
pcs cluster setup my_cluster ha133 ha134
pcs cluster start --all
pcs cluster enable --all
以下エラーが出たので対応
# クォーラム(多数決)が成立しなくてもリソースを動かす設定(2ノード構成で必須)
sudo pcs property set no-quorum-policy=ignore
# 検証用のSTONITH(フェンシング)無効化
sudo pcs property set stonith-enabled=false
# Node List で Online: [ ha001 ha002 ] となり、2台のノードが正常に認識されていること
pcs status
クラスタ構築 VIP作成 以下1号機だけで
pcs resource create virtual_ip ocf:heartbeat:IPaddr2 ip=192.168.2.135 cidr_netmask=24 op monitor interval=10s
pcs status
クラスタ障害テスト 1号機を停止
自分の端末からpingを実行しておく
ping -t 192.168.2.135
pcs cluster stop ha001
# サービスが継続できていること
pcs status