Pacemaker : インストール2025/10/09 |
|
Linux の High Availability システム Pacemaker のインストールと設定です。 当例では以下のような環境でクラスターの基本設定を実施します。
|
+----------------------+ | +----------------------+
| [ Cluster Node#1 ] |10.0.0.51 | 10.0.0.52| [ Cluster Node#2 ] |
| node01.srv.world +----------+----------+ node02.srv.world |
| | | |
+----------------------+ +----------------------+
|
| [1] | 全ノードで、以下のように Pacemaker のインストールと必要な設定を実施しておきます。 |
|
root@node01:~#
apt -y install pacemaker pcs
root@node01:~#
systemctl enable pcsd
# クラスター管理ユーザーのパスワード設定 root@node01:~# passwd hacluster Changing password for user hacluster. New password: Retype new password: passwd: all authentication tokens updated successfully. # クラスター初期化 root@node01:~# pcs cluster destroy |
| [2] | いずれか一方のノードで以下のようにクラスターの基本設定を実施します。 |
|
# 各ノード間で認証を確立 root@node01:~# pcs host auth node01.srv.world node02.srv.world Username: hacluster Password: node01.srv.world: Authorized node02.srv.world: Authorized # クラスターを構成 root@node01:~# pcs cluster setup ha_cluster node01.srv.world node02.srv.world No addresses specified for host 'node01.srv.world', using 'node01.srv.world' No addresses specified for host 'node02.srv.world', using 'node02.srv.world' Destroying cluster on hosts: 'node01.srv.world', 'node02.srv.world'... node02.srv.world: Successfully destroyed cluster node01.srv.world: Successfully destroyed cluster Requesting remove 'pcsd settings' from 'node01.srv.world', 'node02.srv.world' node01.srv.world: successful removal of the file 'pcsd settings' node02.srv.world: successful removal of the file 'pcsd settings' Sending 'corosync authkey', 'pacemaker authkey' to 'node01.srv.world', 'node02.srv.world' node01.srv.world: successful distribution of the file 'corosync authkey' node01.srv.world: successful distribution of the file 'pacemaker authkey' node02.srv.world: successful distribution of the file 'corosync authkey' node02.srv.world: successful distribution of the file 'pacemaker authkey' Sending 'corosync.conf' to 'node01.srv.world', 'node02.srv.world' node01.srv.world: successful distribution of the file 'corosync.conf' node02.srv.world: successful distribution of the file 'corosync.conf' Cluster has been successfully set up. # 各ノードでクラスターに必要なサービスを起動 root@node01:~# pcs cluster start --all node01.srv.world: Starting Cluster... node02.srv.world: Starting Cluster... # 自動起動を設定 root@node01:~# pcs cluster enable --all node01.srv.world: Cluster Enabled node02.srv.world: Cluster Enabled # ステータス確認 root@node01:~# pcs cluster status Cluster Status: Cluster Summary: * Stack: corosync (Pacemaker is running) * Current DC: node01.srv.world (version 3.0.0-3.0.0) - partition with quorum * Last updated: Thu Oct 9 08:43:58 2025 on node01.srv.world * Last change: Thu Oct 9 08:43:54 2025 by hacluster via hacluster on node01.srv.world * 2 nodes configured * 0 resource instances configured Node List: * Online: [ node01.srv.world node02.srv.world ] PCSD Status: node02.srv.world: Online node01.srv.world: Onlineroot@node01:~# pcs status corosync
Membership information
----------------------
Nodeid Votes Name
1 1 node01.srv.world (local)
2 1 node02.srv.world
|
| [3] | 構成したクラスターの設定を全て消去して、完全に初期化する場合は以下のように実行します。 |
|
root@node01:~# pcs cluster stop --all node01.srv.world: Stopping Cluster (pacemaker)... node02.srv.world: Stopping Cluster (pacemaker)... node01.srv.world: Stopping Cluster (corosync)... node02.srv.world: Stopping Cluster (corosync)...root@node01:~# pcs cluster destroy --all Warning: Unable to load CIB to get guest and remote nodes from it, those nodes will not be deconfigured. node02.srv.world: Stopping Cluster (pacemaker)... node01.srv.world: Stopping Cluster (pacemaker)... node02.srv.world: Successfully destroyed cluster node01.srv.world: Successfully destroyed cluster |
| Sponsored Link |
|
|