再びLinuC level3 304の復習です。今回はPacemakerを導入してクラスタリングを行ってい見たいと思います。
◇構成
・ノード1
hostname:pcmk-1
IP1:10.0.1.101
IP2:192.168.128.101
・ノード2
hostname:pcmk-2
IP1:10.0.1.102
IP2:192.168.128.102
◇事前の準備
[root@pcmk-1 ~]# vi /etc/hosts
10.0.1.101 pcmk-1
10.0.1.102 pcmk-2
[root@pcmk-1 ~]# ssh-keygen -f ~/.ssh/id_rsa -N ""
Generating public/private rsa key pair.
Your identification has been saved in /root/.ssh/id_rsa
Your public key has been saved in /root/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:93z2jhKEVISj6NKv5qyyDgfHiAf2O6sInKZrHHUXX+0 root@pcmk-1
The key's randomart image is:
+---[RSA 3072]----+
| ++ |
| . +. . |
|.. .oo.o. |
|o+.. ...... .E |
|+ =..o. S .. |
|.=. o o . o. |
|++oo . . o.o |
|==. o.. . .o o |
|=+++.++. ...o|
+----[SHA256]-----+
[root@pcmk-1 ~]# cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
[root@pcmk-1 ~]# ssh-copy-id pcmk-2
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host 'pcmk-2 (10.0.1.102)' can't be established.
ED25519 key fingerprint is SHA256:bNE5BxZzfF/Dd/lQNIwiNBnNnP1TaiCvhPhdO/aNLjI.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@pcmk-2's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'pcmk-2'"
and check to make sure that only the key(s) you wanted were added.
[root@pcmk-1 ~]# dnf config-manager --set-enabled highavailability
[root@pcmk-1 ~]# dnf install -y pacemaker pcs psmisc policycoreutils-python3
(略)
[root@pcmk-1 ~]# firewall-cmd --permanent --add-service=high-availability
success
[root@pcmk-1 ~]# firewall-cmd --reload
success
[root@pcmk-1 ~]# systemctl enable pcsd.service --now
Created symlink /etc/systemd/system/multi-user.target.wants/pcsd.service → /usr/lib/systemd/system/pcsd.service.
[root@pcmk-1 ~]# systemctl is-active pcsd.service
active
もう片方のノード(pcmk-2)にも同様のsshの設定及びpacemakerのインストールを実施
内容は重複するので省略
ノード1と2でクラスタのパスワードを設定
[root@pcmk-1 ~]# passwd hacluster
ユーザー hacluster のパスワードを変更。
新しい パスワード:
正しくないパスワード: このパスワードには、一部に何らかの形でユーザー名が含まれています
新しい パスワードを再入力してください:
passwd: すべての認証トークンが正しく更新できました。
[root@pcmk-2 ~]# passwd hacluster
(上記参照)
どちらのノードでも、ユーザーとして認証するために以下のコマンドを実施
[root@pcmk-1 ~]# pcs host auth pcmk-1 pcmk-2
Username: hacluster
Password:
pcmk-1: Authorized
pcmk-2: Authorized
root@pcmk-2 ~]# pcs host auth pcmk-1 pcmk-2
Username: hacluster
Password:
pcmk-1: Authorized
pcmk-2: Authorized
同じ構成上でCorosyncを同期させます。
[root@pcmk-1 ~]# pcs cluster setup mycluster pcmk-1 pcmk-2
No addresses specified for host 'pcmk-1', using 'pcmk-1'
No addresses specified for host 'pcmk-2', using 'pcmk-2'
Destroying cluster on hosts: 'pcmk-1', 'pcmk-2'...
pcmk-2: Successfully destroyed cluster
pcmk-1: Successfully destroyed cluster
Requesting remove 'pcsd settings' from 'pcmk-1', 'pcmk-2'
pcmk-1: successful removal of the file 'pcsd settings'
pcmk-2: successful removal of the file 'pcsd settings'
Sending 'corosync authkey', 'pacemaker authkey' to 'pcmk-1', 'pcmk-2'
pcmk-2: successful distribution of the file 'corosync authkey'
pcmk-2: successful distribution of the file 'pacemaker authkey'
pcmk-1: successful distribution of the file 'corosync authkey'
pcmk-1: successful distribution of the file 'pacemaker authkey'
Sending 'corosync.conf' to 'pcmk-1', 'pcmk-2'
pcmk-1: successful distribution of the file 'corosync.conf'
pcmk-2: successful distribution of the file 'corosync.conf'
Cluster has been successfully set up.
バージョンや対応しているクラスタスタックの確認には以下のコマンドを実行します。
[root@pcmk-1 ~]# pacemakerd --features
Pacemaker 2.1.10-1.1.el9_7 (Build: 5693eaeee)
Supporting v3.19.6: agent-manpages cibsecrets corosync-ge-2 default-concurrent-fencing default-resource-stickiness default-sbd-sync generated-manpages lsb monotonic nagios ncurses pam remote service systemd
クラスターの起動
[root@pcmk-1 ~]# pcs cluster start --all
pcmk-2: Starting Cluster...
pcmk-1: Starting Cluster...
◇Corosyncインストールの検証
クラスタ通信が良好かどうかを確認します
[root@pcmk-1 ~]# corosync-cfgtool -s
Local node ID 1, transport knet
LINK ID 0 udp
addr = 10.0.1.101
status:
nodeid: 1: localhost
nodeid: 2: connected
固定IPアドレス(ループバックアドレスではない)がそれぞれnodeid 1とnodeid 2の状態として、すべて正常に表示されていることがわかります。
もし違う場合はノードのネットワーク、ファイアウォール、SELinux構成を確認するそうです。
次に、メンバーシップおよびクオーラムAPIを確認します。
[root@pcmk-1 ~]# corosync-cmapctl | grep members
runtime.members.1.config_version (u64) = 0
runtime.members.1.ip (str) = r(0) ip(10.0.1.101)
runtime.members.1.join_count (u32) = 1
runtime.members.1.status (str) = joined
runtime.members.2.config_version (u64) = 0
runtime.members.2.ip (str) = r(0) ip(10.0.1.102)
runtime.members.2.join_count (u32) = 1
runtime.members.2.status (str) = joined
[root@pcmk-1 ~]# pcs status corosync
Membership information
----------------------
Nodeid Votes Name
1 1 pcmk-1 (local)
2 1 pcmk-2
両方のノードがクラスターに参加している事が確認出来ます。
◇Pacemaker設置確認
pacemakerのプロセスが実行中であることを確認します。必要なプロセスは以下となります。
[root@pcmk-1 ~]# ps axf | grep -E 'pacemaker|corosync'
4602 pts/0 S+ 0:00 \_ grep --color=auto -E pacemaker|corosync
4565 ? SLsl 0:02 /usr/sbin/corosync -f
4577 ? Ss 0:00 /usr/sbin/pacemakerd
4578 ? Ss 0:00 \_ /usr/libexec/pacemaker/pacemaker-based
4579 ? Ss 0:00 \_ /usr/libexec/pacemaker/pacemaker-fenced
4580 ? Ss 0:00 \_ /usr/libexec/pacemaker/pacemaker-execd
4581 ? Ss 0:00 \_ /usr/libexec/pacemaker/pacemaker-attrd
4582 ? Ss 0:00 \_ /usr/libexec/pacemaker/pacemaker-schedulerd
4583 ? Ss 0:00 \_ /usr/libexec/pacemaker/pacemaker-controld
[root@pcmk-1 ~]# journalctl -b | grep -i error
問題がなければ出力を確認します。
[root@pcmk-1 ~]# pcs status
Cluster name: mycluster
WARNINGS:
No stonith devices and stonith-enabled is not false
error: Resource start-up disabled since no STONITH resources have been defined
error: Either configure some or disable STONITH with the stonith-enabled option
error: NOTE: Clusters with shared data need STONITH to ensure data integrity
error: CIB did not pass schema validation
Errors found during check: config not valid
Cluster Summary:
* Stack: corosync (Pacemaker is running)
* Current DC: pcmk-1 (version 2.1.10-1.1.el9_7-5693eaeee) - partition with quorum
* Last updated: Mon Mar 30 16:53:15 2026 on pcmk-1
* Last change: Mon Mar 30 16:45:35 2026 by hacluster via hacluster on pcmk-1
* 2 nodes configured
* 0 resource instances configured
Node List:
* Online: [ pcmk-1 pcmk-2 ]
Full List of Resources:
* No resources
Daemon Status:
corosync: active/disabled
pacemaker: active/disabled
pcsd: active/enabled
上記からSTONITHの設定されていないことに関するメッセージ以外に、起動エラーがないか確認します。STONITH未設定の為、エラーが表示されますが、これは問題ありません。
つづいては既存の構成を確認します
[root@pcmk-1 ~]# pcs cluster cib
<cib crm_feature_set="3.19.6" validate-with="pacemaker-3.10" epoch="5" num_updates="10" admin_epoch="0" cib-last-written="Mon Mar 30 16:45:35 2026" update-origin="pcmk-1" update-client="hacluster" update-user="hacluster" have-quorum="1" dc-uuid="1">
<configuration>
<crm_config>
<cluster_property_set id="cib-bootstrap-options">
(以下略)
変更を加える前に以下のコマンドで構成の妥当性を確認します。
[root@pcmk-1 ~]# pcs cluster verify --full
Error: invalid cib:
error: Resource start-up disabled since no STONITH resources have been defined
error: Either configure some or disable STONITH with the stonith-enabled option
error: NOTE: Clusters with shared data need STONITH to ensure data integrity
error: CIB did not pass schema validation
Errors found during check: config not valid
Error: Errors have occurred, therefore pcs is unable to continue
STONITHを設定していない為、上記のようなエラーが発生しています。
回避方法としてはクラスタにフェンシングを使わないように指示することですが、推奨されていません。一応を以下に記載します。
[root@pcmk-1 ~]# pcs property set stonith-enabled=false
[root@pcmk-1 ~]# pcs cluster verify --full
[root@pcmk-1 ~]# pcs status
Cluster name: mycluster
Cluster Summary:
* Stack: corosync (Pacemaker is running)
* Current DC: pcmk-1 (version 2.1.10-1.1.el9_7-5693eaeee) - partition with quorum
* Last updated: Mon Mar 30 17:08:53 2026 on pcmk-1
* Last change: Mon Mar 30 17:07:49 2026 by root via root on pcmk-1
* 2 nodes configured
* 0 resource instances configured
Node List:
* Online: [ pcmk-1 pcmk-2 ]
Full List of Resources:
* No resources
Daemon Status:
corosync: active/disabled
pacemaker: active/disabled
pcsd: active/enabled
上記の様に一応エラーは消えますが、実際の運用向きではありません。
環境に合わせてfenceのエージェントを使用してフェンシングを行います。
VirtualBOX環境ではかつてfence-agents-vboxというフェンスのパッケージでfence_vboxなるものが使えたようですが、現在同パッケージは以下の様に存在しないのか、インストールは出来ないようです。
[root@pcmk-1 ~]# dnf search fence- | grep -i fence-agents-vbox
メタデータの期限切れの最終確認: 3:31:27 前の 2026年03月30日 16時24分02秒 に実施 しました。