Lessons

Pacemaker HA Clustering

Level: Expert Module: Monitoring & High Availability 12 min read Lesson 66 of 66

Overview

  • What you’ll learn: High-availability clustering concepts, Corosync cluster communication and ring configuration, Pacemaker’s Cluster Resource Manager (CRM), how to define resources using crm and pcs commands, resource types (primitive, clone, group), constraint types (location, colocation, order), and fencing with STONITH devices.
  • Prerequisites: DRBD Block Replication (Lesson 65), networking fundamentals, systemd service management
  • Estimated reading time: 22 minutes

Introduction

High availability (HA) is the practice of designing systems that continue operating when individual components fail. While backups protect against data loss and DRBD provides real-time data replication, neither can automatically restart services on a surviving node when a server fails. That is the role of a cluster resource manager — and Pacemaker is the leading open-source solution for this task in the Linux ecosystem.

A Pacemaker cluster consists of two or more nodes that communicate through Corosync, a group communication system that provides reliable messaging, membership tracking, and quorum decisions. When Pacemaker detects that a node or service has failed, it automatically migrates resources to a healthy node according to rules defined by the administrator. The entire failover process — detecting failure, fencing the failed node, promoting a replica, starting services, and updating network addresses — happens without human intervention.

In this lesson, we will build a two-node HA cluster on Ubuntu Server, configure Corosync for cluster communication, define Pacemaker resources for a DRBD-backed service, implement fencing with STONITH, and learn the constraint system that governs resource placement and startup ordering.

HA Clustering Concepts

Before diving into configuration, it is important to understand the fundamental concepts that govern cluster behavior:

  • Quorum: The minimum number of nodes that must be online for the cluster to make decisions. In a two-node cluster, special quorum policies are required because losing one node means losing 50% of the cluster — normally not a quorum.
  • Fencing (STONITH): STONITH stands for “Shoot The Other Node In The Head.” When a node becomes unresponsive, the cluster cannot know whether it has truly failed or is merely unreachable (e.g., network partition). Fencing forcibly powers off or resets the suspect node to guarantee it is not still accessing shared resources. Without fencing, data corruption is possible.
  • Resources: The services and components managed by the cluster — filesystems, IP addresses, database servers, web servers, DRBD volumes, etc.
  • Constraints: Rules that control where resources run (location), which resources must be on the same node (colocation), and the order in which resources start and stop (order).
  • Resource agents: Scripts that Pacemaker uses to start, stop, and monitor resources. They follow the OCF (Open Cluster Framework) standard and are located in /usr/lib/ocf/resource.d/.

Installing Corosync and Pacemaker

We will install the cluster stack on both nodes and establish cluster communication.

# On BOTH nodes — install the cluster stack
$ sudo apt update
$ sudo apt install -y pacemaker corosync pcs resource-agents fence-agents

# Enable and start the PCS daemon (cluster management service)
$ sudo systemctl enable --now pcsd

# Set a password for the cluster admin user (hacluster)
$ sudo passwd hacluster
# Enter a strong password (must be the same on both nodes)

# --- From ONE node only — authenticate and create the cluster ---
$ sudo pcs host auth node1 node2 -u hacluster -p 'YourSecurePassword'
node1: Authorized
node2: Authorized

# Create and start the cluster
$ sudo pcs cluster setup ha-cluster node1 node2
$ sudo pcs cluster start --all
$ sudo pcs cluster enable --all

# Verify cluster status
$ sudo pcs status
Cluster name: ha-cluster
Stack: corosync

Full List of Resources:
  No resources

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

# For a two-node cluster, configure quorum policy
$ sudo pcs property set no-quorum-policy=ignore

# View Corosync ring status
$ sudo corosync-cfgtool -s
Local node ID 1, transport knet
LINK ID 0 addr = 192.168.1.100
  status:
    nodeid: 1 reachable
    nodeid: 2 reachable

Configuring STONITH Fencing

Fencing is not optional in a production cluster — it is a safety requirement. Without fencing, Pacemaker cannot guarantee data integrity after a node failure. The type of fence device depends on your infrastructure.

# List available fence agents
$ sudo pcs stonith list
fence_apc          - APC over telnet/ssh
fence_apc_snmp     - APC over SNMP
fence_idrac        - Dell iDRAC
fence_ipmilan      - IPMI LAN
fence_sbd          - SBD (STONITH Block Device)
fence_virsh        - libvirt (for VMs)
fence_xvm          - XVM (Xen Virtual Machines)

# Example: Configure IPMI-based fencing (common in physical servers)
$ sudo pcs stonith create ipmi-node1 fence_ipmilan 
    pcmk_host_list="node1" 
    ipaddr="192.168.1.200" 
    login="admin" 
    passwd="ipmi-password" 
    lanplus=1 
    op monitor interval=60s

$ sudo pcs stonith create ipmi-node2 fence_ipmilan 
    pcmk_host_list="node2" 
    ipaddr="192.168.1.201" 
    login="admin" 
    passwd="ipmi-password" 
    lanplus=1 
    op monitor interval=60s

# Ensure each node is fenced by the OTHER node's fence device
$ sudo pcs constraint location ipmi-node1 avoids node1=INFINITY
$ sudo pcs constraint location ipmi-node2 avoids node2=INFINITY

# Example: SBD fencing (for environments without IPMI/iLO)
# SBD uses a shared disk as a "poison pill" mechanism
$ sudo pcs stonith create sbd-fence fence_sbd 
    devices="/dev/disk/by-id/scsi-SATA_VBOX_HARDDISK_VBxxxxxxxx" 
    op monitor interval=30s

# Test fencing (WARNING: this will reboot the target node!)
$ sudo pcs stonith fence node2

# Verify fencing is configured
$ sudo pcs stonith status
  ipmi-node1  (stonith:fence_ipmilan): Started node2
  ipmi-node2  (stonith:fence_ipmilan): Started node1

Defining Cluster Resources

Resources are the workloads managed by Pacemaker. We will define a complete HA service stack: a DRBD volume, a filesystem, a virtual IP address, and a web server — all managed as a group with proper ordering.

# Define the DRBD resource (uses the linbit DRBD resource agent)
$ sudo pcs resource create drbd-data ocf:linbit:drbd 
    drbd_resource=r0 
    op monitor interval=15s role=Master 
    op monitor interval=30s role=Slave

# Promote DRBD to a master/slave (promotable) clone
$ sudo pcs resource promotable drbd-data 
    promoted-max=1 promoted-node-max=1 
    clone-max=2 clone-node-max=1 
    notify=true

# Define the filesystem resource (mounts the DRBD device)
$ sudo pcs resource create fs-data ocf:heartbeat:Filesystem 
    device="/dev/drbd0" 
    directory="/data" 
    fstype="ext4" 
    op monitor interval=20s

# Define a virtual IP address for client connections
$ sudo pcs resource create vip-web ocf:heartbeat:IPaddr2 
    ip=192.168.1.50 
    cidr_netmask=24 
    op monitor interval=10s

# Define the application service
$ sudo pcs resource create svc-nginx systemd:nginx 
    op monitor interval=10s 
    op start timeout=30s 
    op stop timeout=30s

# Group the dependent resources (filesystem, VIP, and nginx)
$ sudo pcs resource group add grp-web fs-data vip-web svc-nginx

# --- Define constraints ---

# Colocation: the group must run on the DRBD primary
$ sudo pcs constraint colocation add grp-web with Promoted drbd-data-clone INFINITY

# Order: DRBD must be promoted before the group starts
$ sudo pcs constraint order promote drbd-data-clone then start grp-web

# Verify the full configuration
$ sudo pcs resource status
  * Clone Set: drbd-data-clone [drbd-data] (promotable):
    * Promoted: [ node1 ]
    * Unpromoted: [ node2 ]
  * Resource Group: grp-web:
    * fs-data    (ocf:heartbeat:Filesystem): Started node1
    * vip-web    (ocf:heartbeat:IPaddr2):    Started node1
    * svc-nginx  (systemd:nginx):            Started node1

Resource Types and Constraints Deep Dive

Pacemaker supports several resource types and constraint categories that provide fine-grained control over cluster behavior:

Resource Types

  • Primitive: A single instance of a resource. Most resources start as primitives (e.g., a virtual IP, a filesystem mount).
  • Clone: A resource that runs on multiple nodes simultaneously. Used for services that should be active everywhere, such as monitoring agents or DRBD in secondary mode.
  • Promotable clone (Master/Slave): A clone where one instance can be “promoted” to a special role. DRBD is the classic example — it runs on both nodes, but only one is primary.
  • Group: An ordered set of primitives that start sequentially on the same node. If any member fails, the entire group is restarted or migrated.

Constraint Types

  • Location constraints: Control which nodes a resource can or cannot run on, with optional scoring to express preference rather than hard requirements.
  • Colocation constraints: Require that certain resources run on the same node (positive score) or different nodes (negative score).
  • Order constraints: Define the sequence in which resources start and stop. For example, the filesystem must be mounted before the web server starts.
# Location: prefer node1 with a soft score
$ sudo pcs constraint location svc-nginx prefers node1=500

# Location: ban a resource from a specific node
$ sudo pcs constraint location svc-nginx avoids node2=INFINITY

# Colocation: VIP must be on the same node as nginx
$ sudo pcs constraint colocation add vip-web with svc-nginx INFINITY

# Order: filesystem before nginx (mandatory)
$ sudo pcs constraint order fs-data then svc-nginx

# View all constraints
$ sudo pcs constraint show --full

# View cluster configuration as XML
$ sudo pcs cluster cib

Monitoring and Troubleshooting

Effective cluster administration requires monitoring resource status, understanding failover events, and diagnosing problems.

# Real-time cluster status
$ sudo pcs status

# Detailed resource status with failure history
$ sudo pcs resource failcount show

# View the cluster event log
$ sudo pcs status --full

# Check Corosync membership
$ sudo corosync-cmapctl | grep members

# View Pacemaker logs
$ journalctl -u pacemaker -f

# Simulate a failover (move resources to the other node)
$ sudo pcs resource move grp-web node2

# Clear resource constraints created by move
$ sudo pcs resource clear grp-web

# Put a node into standby (gracefully drain resources)
$ sudo pcs node standby node1

# Bring a node back from standby
$ sudo pcs node unstandby node1

# Clean up failed resource state
$ sudo pcs resource cleanup svc-nginx

Key Takeaways

  • Pacemaker provides automated resource management and failover for HA clusters, working with Corosync for cluster communication, membership, and quorum.
  • STONITH fencing is mandatory in production clusters — it guarantees that a failed node cannot corrupt shared resources by forcibly powering it off before migrating services.
  • Resources are defined as primitives, clones, promotable clones, or groups; constraints (location, colocation, order) control where and in what sequence they run.
  • The pcs command is the primary administration tool for modern Pacemaker clusters, handling cluster setup, resource definition, constraint management, and troubleshooting.
  • A complete HA stack typically layers Corosync (messaging) + Pacemaker (decisions) + DRBD (data) + STONITH (safety) to deliver zero-downtime failover.

What’s Next

Congratulations! You have completed the Monitoring & High Availability module — and the entire Linux Engineering track! You now possess a comprehensive skill set spanning system fundamentals, networking, security, storage, automation, and high availability. Continue honing these skills through hands-on practice in lab environments, contribute to open-source projects, and pursue professional certifications to validate your expertise.

繁體中文

概述

  • 您將學到:高可用性叢集概念、Corosync 叢集通訊和環形設定、Pacemaker 的叢集資源管理器(CRM)、如何使用 crm 和 pcs 命令定義資源、資源類型(primitive/clone/group)、約束類型(location/colocation/order),以及使用 STONITH 裝置進行隔離。
  • 先決條件:DRBD 區塊複製(第 65 課)、網路基礎、systemd 服務管理
  • 預計閱讀時間:22 分鐘

介紹

高可用性(HA)是設計在個別元件故障時仍能繼續運作的系統的實踐。雖然備份可以防止資料遺失,DRBD 提供即時資料複製,但兩者都無法在伺服器故障時自動在存活節點上重新啟動服務。這就是叢集資源管理器的角色——而 Pacemaker 是 Linux 生態系統中此任務的領先開源解決方案。

Pacemaker 叢集由兩個或更多節點組成,透過 Corosync 進行通訊。Corosync 是一個群組通訊系統,提供可靠的訊息傳遞、成員追蹤和仲裁決策。當 Pacemaker 偵測到節點或服務故障時,它會根據管理員定義的規則自動將資源遷移到健康的節點。

在本課程中,我們將在 Ubuntu Server 上建立一個雙節點 HA 叢集,設定 Corosync 進行叢集通訊,定義基於 DRBD 的 Pacemaker 資源,實施 STONITH 隔離,並學習控制資源放置和啟動順序的約束系統。

HA 叢集概念

  • 仲裁(Quorum):叢集做出決策所需的最少線上節點數。在雙節點叢集中,需要特殊的仲裁策略。
  • 隔離(STONITH):「Shoot The Other Node In The Head」的縮寫。當節點無回應時,叢集無法確知它是真的故障還是只是無法連線。隔離會強制關閉可疑節點,以保證它不再存取共享資源。
  • 資源:由叢集管理的服務和元件——檔案系統、IP 位址、資料庫伺服器、網頁伺服器、DRBD 卷等。
  • 約束:控制資源在哪裡運行(location)、哪些資源必須在同一節點上(colocation)、以及資源啟動和停止的順序(order)的規則。

安裝 Corosync 和 Pacemaker

# 在兩個節點上安裝叢集堆疊
$ sudo apt install -y pacemaker corosync pcs resource-agents fence-agents

# 啟用 PCS 守護程序
$ sudo systemctl enable --now pcsd

# 設定叢集管理使用者密碼
$ sudo passwd hacluster

# 認證並建立叢集(僅從一個節點執行)
$ sudo pcs host auth node1 node2 -u hacluster -p 'YourSecurePassword'
$ sudo pcs cluster setup ha-cluster node1 node2
$ sudo pcs cluster start --all
$ sudo pcs cluster enable --all

# 雙節點叢集仲裁策略
$ sudo pcs property set no-quorum-policy=ignore

# 驗證叢集狀態
$ sudo pcs status

設定 STONITH 隔離

隔離在生產叢集中不是可選的——它是安全要求。沒有隔離,Pacemaker 無法保證節點故障後的資料完整性。

# 列出可用的隔離代理
$ sudo pcs stonith list

# 設定 IPMI 隔離(實體伺服器常用)
$ sudo pcs stonith create ipmi-node1 fence_ipmilan 
    pcmk_host_list="node1" 
    ipaddr="192.168.1.200" 
    login="admin" passwd="ipmi-password" lanplus=1

$ sudo pcs stonith create ipmi-node2 fence_ipmilan 
    pcmk_host_list="node2" 
    ipaddr="192.168.1.201" 
    login="admin" passwd="ipmi-password" lanplus=1

# 確保每個節點由另一個節點的隔離裝置隔離
$ sudo pcs constraint location ipmi-node1 avoids node1=INFINITY
$ sudo pcs constraint location ipmi-node2 avoids node2=INFINITY

定義叢集資源

# 定義 DRBD 資源
$ sudo pcs resource create drbd-data ocf:linbit:drbd 
    drbd_resource=r0 
    op monitor interval=15s role=Master 
    op monitor interval=30s role=Slave

# 提升 DRBD 為可提升的克隆
$ sudo pcs resource promotable drbd-data 
    promoted-max=1 promoted-node-max=1 
    clone-max=2 clone-node-max=1 notify=true

# 定義檔案系統資源
$ sudo pcs resource create fs-data ocf:heartbeat:Filesystem 
    device="/dev/drbd0" directory="/data" fstype="ext4"

# 定義虛擬 IP 位址
$ sudo pcs resource create vip-web ocf:heartbeat:IPaddr2 
    ip=192.168.1.50 cidr_netmask=24

# 定義應用程式服務
$ sudo pcs resource create svc-nginx systemd:nginx

# 群組化相依資源
$ sudo pcs resource group add grp-web fs-data vip-web svc-nginx

# 共置約束:群組必須在 DRBD 主節點上運行
$ sudo pcs constraint colocation add grp-web with Promoted drbd-data-clone INFINITY

# 順序約束:DRBD 必須先提升,然後群組才啟動
$ sudo pcs constraint order promote drbd-data-clone then start grp-web

資源類型和約束深入探討

資源類型

  • Primitive:資源的單一實例。大多數資源始於 primitive。
  • Clone:同時在多個節點上運行的資源。用於應該在所有地方活躍的服務。
  • 可提升的 Clone(Master/Slave):其中一個實例可以被「提升」到特殊角色的 clone。DRBD 是經典範例。
  • Group:在同一節點上按順序啟動的有序 primitive 集合。

約束類型

  • 位置約束:控制資源可以或不可以在哪些節點上運行。
  • 共置約束:要求某些資源在同一節點(正分數)或不同節點(負分數)上運行。
  • 順序約束:定義資源啟動和停止的順序。

監控和故障排除

# 即時叢集狀態
$ sudo pcs status

# 模擬容錯移轉
$ sudo pcs resource move grp-web node2

# 清除移動產生的約束
$ sudo pcs resource clear grp-web

# 將節點置於待機模式
$ sudo pcs node standby node1
$ sudo pcs node unstandby node1

# 清理失敗的資源狀態
$ sudo pcs resource cleanup svc-nginx

重點總結

  • Pacemaker 為 HA 叢集提供自動化資源管理和容錯移轉,與 Corosync 配合進行叢集通訊、成員管理和仲裁。
  • STONITH 隔離在生產叢集中是強制性的——它透過強制關閉故障節點來保證共享資源不會被損壞。
  • 資源定義為 primitive、clone、可提升 clone 或 group;約束(location、colocation、order)控制它們在哪裡以及以什麼順序運行。
  • pcs 命令是現代 Pacemaker 叢集的主要管理工具,處理叢集設定、資源定義、約束管理和故障排除。
  • 完整的 HA 堆疊通常分層為 Corosync(訊息傳遞)+ Pacemaker(決策)+ DRBD(資料)+ STONITH(安全),以實現零停機容錯移轉。

下一步

恭喜!您已完成監控與高可用性模組——以及整個 Linux 工程追蹤課程!您現在擁有涵蓋系統基礎、網路、安全、儲存、自動化和高可用性的全面技能。繼續透過實驗環境的實作練習來磨練這些技能,為開源專案做出貢獻,並取得專業認證來驗證您的專業知識。

日本語

概要

  • 学習内容:高可用性クラスタリングの概念、Corosync クラスター通信とリング設定、Pacemaker のクラスターリソースマネージャー(CRM)、crm および pcs コマンドによるリソース定義、リソースタイプ(primitive/clone/group)、制約タイプ(location/colocation/order)、STONITH デバイスによるフェンシング。
  • 前提条件:DRBD ブロックレプリケーション(レッスン65)、ネットワークの基礎、systemd サービス管理
  • 推定読了時間:22分

はじめに

高可用性(HA)とは、個々のコンポーネントが障害を起こしても稼働し続けるシステムを設計する実践です。バックアップはデータ損失を防ぎ、DRBD はリアルタイムのデータレプリケーションを提供しますが、どちらもサーバー障害時に存続するノード上でサービスを自動的に再起動することはできません。それがクラスターリソースマネージャーの役割であり、Pacemaker は Linux エコシステムにおけるこのタスクの主要なオープンソースソリューションです。

Pacemaker クラスターは、Corosync を介して通信する2つ以上のノードで構成されます。Corosync は信頼性の高いメッセージング、メンバーシップ追跡、クォーラム決定を提供するグループ通信システムです。Pacemaker がノードまたはサービスの障害を検出すると、管理者が定義したルールに従ってリソースを健全なノードに自動的に移行します。

このレッスンでは、Ubuntu Server 上に2ノード HA クラスターを構築し、Corosync をクラスター通信用に設定し、DRBD ベースのサービスに対する Pacemaker リソースを定義し、STONITH によるフェンシングを実装し、リソースの配置と起動順序を制御する制約システムを学びます。

HA クラスタリングの概念

  • クォーラム:クラスターが決定を下すためにオンラインでなければならないノードの最小数。2ノードクラスターでは特別なクォーラムポリシーが必要。
  • フェンシング(STONITH):「Shoot The Other Node In The Head」の略。ノードが応答しなくなったとき、クラスターはそれが本当に障害なのか、単に到達不能なだけなのかを知ることができない。フェンシングは疑わしいノードを強制的にパワーオフまたはリセットし、共有リソースにアクセスしていないことを保証する。
  • リソース:クラスターが管理するサービスとコンポーネント — ファイルシステム、IP アドレス、データベースサーバー、Web サーバー、DRBD ボリュームなど。
  • 制約:リソースがどこで実行されるか(location)、どのリソースが同じノード上になければならないか(colocation)、リソースが起動・停止する順序(order)を制御するルール。

Corosync と Pacemaker のインストール

# 両ノードにクラスタースタックをインストール
$ sudo apt install -y pacemaker corosync pcs resource-agents fence-agents

# PCS デーモンを有効化して起動
$ sudo systemctl enable --now pcsd

# クラスター管理ユーザーのパスワードを設定
$ sudo passwd hacluster

# 認証してクラスターを作成(1つのノードからのみ)
$ sudo pcs host auth node1 node2 -u hacluster -p 'YourSecurePassword'
$ sudo pcs cluster setup ha-cluster node1 node2
$ sudo pcs cluster start --all
$ sudo pcs cluster enable --all

# 2ノードクラスターのクォーラムポリシー
$ sudo pcs property set no-quorum-policy=ignore

# クラスターステータスを確認
$ sudo pcs status

STONITH フェンシングの設定

フェンシングは本番クラスターではオプションではなく、安全要件です。フェンシングなしでは、Pacemaker はノード障害後のデータ整合性を保証できません。

# 利用可能なフェンスエージェントを一覧表示
$ sudo pcs stonith list

# IPMI ベースのフェンシングを設定(物理サーバーで一般的)
$ sudo pcs stonith create ipmi-node1 fence_ipmilan 
    pcmk_host_list="node1" 
    ipaddr="192.168.1.200" 
    login="admin" passwd="ipmi-password" lanplus=1

$ sudo pcs stonith create ipmi-node2 fence_ipmilan 
    pcmk_host_list="node2" 
    ipaddr="192.168.1.201" 
    login="admin" passwd="ipmi-password" lanplus=1

# 各ノードが他方のノードのフェンスデバイスでフェンシングされることを確保
$ sudo pcs constraint location ipmi-node1 avoids node1=INFINITY
$ sudo pcs constraint location ipmi-node2 avoids node2=INFINITY

クラスターリソースの定義

# DRBD リソースを定義
$ sudo pcs resource create drbd-data ocf:linbit:drbd 
    drbd_resource=r0 
    op monitor interval=15s role=Master 
    op monitor interval=30s role=Slave

# DRBD をプロモータブルクローンに昇格
$ sudo pcs resource promotable drbd-data 
    promoted-max=1 promoted-node-max=1 
    clone-max=2 clone-node-max=1 notify=true

# ファイルシステムリソースを定義
$ sudo pcs resource create fs-data ocf:heartbeat:Filesystem 
    device="/dev/drbd0" directory="/data" fstype="ext4"

# 仮想 IP アドレスを定義
$ sudo pcs resource create vip-web ocf:heartbeat:IPaddr2 
    ip=192.168.1.50 cidr_netmask=24

# アプリケーションサービスを定義
$ sudo pcs resource create svc-nginx systemd:nginx

# 依存リソースをグループ化
$ sudo pcs resource group add grp-web fs-data vip-web svc-nginx

# コロケーション制約:グループは DRBD プライマリで実行
$ sudo pcs constraint colocation add grp-web with Promoted drbd-data-clone INFINITY

# 順序制約:DRBD が昇格してからグループが開始
$ sudo pcs constraint order promote drbd-data-clone then start grp-web

リソースタイプと制約の詳細

リソースタイプ

  • Primitive:リソースの単一インスタンス。ほとんどのリソースは primitive から始まる。
  • Clone:複数のノードで同時に実行されるリソース。すべての場所でアクティブであるべきサービスに使用。
  • プロモータブル Clone(Master/Slave):1つのインスタンスを特別な役割に「昇格」できる clone。DRBD が典型的な例。
  • Group:同じノードで順番に起動される primitive の順序付きセット。

制約タイプ

  • ロケーション制約:リソースがどのノードで実行できるか/できないかを制御する。
  • コロケーション制約:特定のリソースが同じノード(正のスコア)または異なるノード(負のスコア)で実行されることを要求する。
  • 順序制約:リソースが起動・停止するシーケンスを定義する。

監視とトラブルシューティング

# リアルタイムクラスターステータス
$ sudo pcs status

# フェイルオーバーをシミュレート
$ sudo pcs resource move grp-web node2

# move で作成された制約をクリア
$ sudo pcs resource clear grp-web

# ノードをスタンバイモードにする
$ sudo pcs node standby node1
$ sudo pcs node unstandby node1

# 失敗したリソース状態をクリーンアップ
$ sudo pcs resource cleanup svc-nginx

重要ポイント

  • Pacemaker は HA クラスターに自動化されたリソース管理とフェイルオーバーを提供し、Corosync と連携してクラスター通信、メンバーシップ、クォーラムを処理する。
  • STONITH フェンシングは本番クラスターでは必須 — 障害ノードを強制的にパワーオフしてからサービスを移行することで、共有リソースの破損を防ぐ。
  • リソースは primitive、clone、プロモータブル clone、または group として定義され、制約(location、colocation、order)がそれらの実行場所と順序を制御する。
  • pcs コマンドは現代の Pacemaker クラスターの主要な管理ツールで、クラスター設定、リソース定義、制約管理、トラブルシューティングを処理する。
  • 完全な HA スタックは通常、Corosync(メッセージング)+ Pacemaker(意思決定)+ DRBD(データ)+ STONITH(安全性)をレイヤーして、ダウンタイムゼロのフェイルオーバーを実現する。

次のステップ

おめでとうございます!監視と高可用性モジュール — そして Linux エンジニアリングトラック全体を完了しました!システム基礎、ネットワーク、セキュリティ、ストレージ、自動化、高可用性にまたがる包括的なスキルセットを身につけました。ラボ環境での実践練習を通じてこれらのスキルを磨き続け、オープンソースプロジェクトに貢献し、専門認定資格を取得して専門知識を証明してください。

You Missed