32.3. Membership and Quorum with Corosync
Corosync answers two questions continuously: which nodes can currently talk to each other, and which group of them is allowed to control the cluster's resources. Everything Pacemaker decides is downstream of those answers.
32.3.1. Choosing Node Addresses and Cluster Communication Networks
Membership traffic must survive events that also threaten the service.
The walkthrough therefore keeps two data networks: the service network
(192.168.232.0/24, eth1) carries client traffic, virtual addresses, and
the QDevice connection to the witness, while the cluster network
(192.168.233.0/24, eth2) carries Corosync's membership messages and DRBD
replication. A saturated client link, a bad firewall rule, or a deliberate
isolation exercise on one network does not blind the cluster on the other,
and the management network is never used by either.
Corosync's knet transport can carry membership over several links at once
and declares a node lost only when all of them fail, which is worth the
extra cabling on physical hosts. The practice cluster uses one link to keep
the example small; crm cluster init accepts multiple -i options to
configure more.
| Network | Interface | Addresses | Carries |
|---|---|---|---|
| Service | eth1 |
192.168.232.11–15, VIPs .100, .150, .160–.162 | NFS and HTTP clients, health checks, QDevice TCP 5403 to the witness |
| Cluster | eth2 |
192.168.233.11–12 | Corosync/knet UDP 5405, DRBD TCP 7789 |
| Management | eth0 |
per-host | SSH only; no exercise depends on it |
Each node needs a stable identity before the cluster forms: the configured
hostname must match what the cluster will call the node, and every node must
resolve every other node's name. A /etc/hosts block like the following on
all five hosts is sufficient for the practice lab:
192.168.232.11 ha1
192.168.232.12 ha2
192.168.232.13 haclient
192.168.232.14 lbclient
192.168.232.15 lbcli
192.168.233.11 ha1-cluster
192.168.233.12 ha2-cluster
Use DNS instead of /etc/hosts when the cluster serves real clients
(Chapter 22); what matters is that the names resolve
consistently on all nodes.
32.3.2. Cluster Identities, Authentication, and Communication Links
crm cluster init writes a Corosync configuration with the knet
transport, the cluster name, the node list with fixed numeric node IDs, and
the quorum provider. It also generates /etc/corosync/authkey, a shared
secret that knet uses to authenticate and encrypt inter-node traffic; the
file is readable only by root and must be identical on all nodes. The
practice cluster's name is hacluster, and the nodes carry the IDs 1 and 2 -
both facts are visible in the captured status and quorum output below. Node
IDs are permanent: a node keeps its ID across reboots and address changes,
and the cluster's history and fencing decisions are keyed to them.
Knet exchanges membership on UDP port 5405 by default. The knet-default
profile that crmsh loads (visible in the init output in the next section)
sets the transport parameters; corosync-cfgtool reports the resulting link
state. On ha1, as john:
$ sudo corosync-cfgtool -s
Local node ID 1, transport knet
LINK ID 0 udp
addr = 192.168.233.11
status:
nodeid: 1: localhost
nodeid: 2: connected
The output shows the local node ID, the knet transport, and link 0 bound to
the cluster-network address with the peer connected. If a link were down,
the same command would report it, which makes corosync-cfgtool -s the
first check when nodes disagree about membership.
32.3.3. Configuring Membership and Inspecting Quorum
Install the cluster stack on both nodes. On ha1, as john:
$ sudo apt install pacemaker corosync corosync-qdevice crmsh resource-agents drbd-utils nfs-kernel-server nfs-common
Let apt confirm and complete; the packages pull in the resource agents and
the NFS server pieces used by the walkthrough. On ha2, run the same
command. On the witness lbclient, only the QNetd server side is needed:
$ sudo apt install corosync-qnetd
The versions in the practice guests, from ha1, as john:
$ dpkg-query -W pacemaker corosync crmsh corosync-qdevice drbd-utils nfs-kernel-server
corosync 3.1.9-2+deb13u1
corosync-qdevice 3.0.3-2
crmsh 5.0.0~rc1-1
drbd-utils 9.22.0-1.1
nfs-kernel-server 1:2.8.3-1
pacemaker 3.0.0-2
crmsh drives the other nodes over SSH as root, so before initializing, root
on ha1 must be able to reach ha2 and lbclient without a password
prompt, and each host's key should already be known - the mechanics are the
same SSH trust setup covered in Chapter 20. The bootstrap
command writes the keys it needs itself, but it cannot create the first
trust out of nothing.
The initialization command used on the practice cluster is
sudo crm -D plain cluster init -y -x -N ha2 -i 192.168.233.11 --qnetd-hostname lbclient,
run once on ha1. Its relevant options:
| Option | Description |
|---|---|
-y, --yes |
Answer yes to the destructive confirmation prompts |
-N, --node [USER@]HOST |
Add the named node to the new cluster in the same run |
-i, --interface IF |
Cluster communication address; repeatable for multiple knet links |
--qnetd-hostname [USER@]HOST |
Host that runs the QNetd witness; crmsh configures QDevice against it |
--qdevice-algo ALGO |
Witness vote algorithm, ffsplit (default) or lms |
--qdevice-tie-breaker RULE |
Tie resolution: lowest (default), highest, or a node ID |
-x, --skip-csync2-sync |
Skip the csync2 stage that replicates /etc across nodes |
-s, --sbd-device DEV |
Configure SBD fencing on shared block device(s) |
-S, --enable-sbd |
Enable diskless SBD, which fences through the watchdog |
-t, --transport TRANSPORT |
knet (default), udpu, or udp |
The output is long, and every stage in it does something worth recognizing later:
$ sudo crm -D plain cluster init -y -x -N ha2 -i 192.168.233.11 --qnetd-hostname lbclient
INFO: Loading "default" profile from /etc/crm/profiles.yml
INFO: Loading "knet-default" profile from /etc/crm/profiles.yml
INFO: A public key is added to authorized_keys for user root: 256 SHA256:ELYElt0IFjx+8OBS72InlTWWbdXcquTbQ52R2lhBCVQ root@ha1 (ED25519)
INFO: A public key is added to authorized_keys for user hacluster: 3072 SHA256:WsqaJxdr9vyUnD8gGKdQKFcFNEfIjRKLEFWi+B+Dzeo Cluster internal on ha1 (RSA)
INFO: Adding public keys to authorized_keys on root@ha2
INFO: Configuring corosync(knet)
INFO: Starting pacemaker.service on ha1
INFO: BEGIN Waiting for cluster
INFO: END Waiting for cluster
INFO: Loading initial cluster configuration
INFO: Configure Qdevice/Qnetd:
INFO: BEGIN Qdevice certification process
INFO: END Qdevice certification process
INFO: BEGIN Update configuration
INFO: ha1
INFO: END Update configuration
INFO: Enable corosync-qdevice.service in cluster
INFO: Restarting cluster service
INFO: BEGIN Waiting for cluster
INFO: END Waiting for cluster
INFO: Enable corosync-qnetd.service on lbclient
INFO: Starting corosync-qnetd.service on lbclient
INFO: Done (log saved to /var/log/crmsh/crmsh.log on ha1)
INFO: Adding node ha2 to cluster
INFO: Running command on ha2: crm cluster join -y -i eth2 -c root@ha1
INFO: A public key is added to authorized_keys for user hacluster: 3072 SHA256:ZLzpbuF1hsE7/eSx1gDgk3NY2eENIDVyMZDbtR2tw6Y Cluster internal on ha2 (RSA)
INFO: BEGIN Retrieve all config files
INFO: END Retrieve all config files
INFO: Merging known_hosts
INFO: BEGIN Probing for new partitions
INFO: END Probing for new partitions
INFO: ha1
INFO: Starting pacemaker.service on ha2
INFO: BEGIN Waiting for cluster
INFO: END Waiting for cluster
INFO: BEGIN Reloading cluster configuration
INFO: END Reloading cluster configuration
INFO: BEGIN Starting corosync-qdevice.service
INFO: END Starting corosync-qdevice.service
INFO: ha1
INFO: Done (log saved to /var/log/crmsh/crmsh.log on ha2)
WARNING: Not configuring SBD - STONITH will be disabled.
WARNING: Hawk not installed - not configuring web management interface.
Read the transcript as a sequence of stages: SSH keys are exchanged for
root and the hacluster user; Corosync is configured on the knet transport;
Pacemaker starts and the initial (empty) configuration is loaded; the
QDevice certificate exchange with the witness runs; corosync-qdevice is
enabled in the cluster and corosync-qnetd is enabled and started on
lbclient; then ha2 joins by running crm cluster join on itself. The
-D plain option selects crmsh's plain display mode for its tables and
listings. crmsh 5.0.0~rc1 still colors its one-line INFO: and
WARNING: status messages even in plain mode - the raw captures of the
init transcript and of the standby, move, and cluster-stop
confirmations all carry escape sequences - so every such line in this
chapter is shown with the escape sequences removed; the message text
itself is unchanged.
Two warnings deserve attention. The SBD warning appears because the command
was run without -s or -S; the cluster will run with fencing disabled,
which section 32.4 treats as a first-class design decision rather than a
silent default. The Hawk warning only notes that the optional web interface
is not installed.
The -x option skips csync2, crmsh's mechanism for replicating
configuration files across the nodes. On Debian 13 the csync2 packaging
requires certificate provisioning that crmsh's stage does not perform
(csync2 needs its SSL certificates created per its README.Debian), so
this chapter uses -x and instead installs identical configuration files
on both nodes explicitly, exactly where the text says "on every node". The
alternative on a fully working csync2 deployment is to let crmsh replicate
/etc automatically.
Adding further nodes later does not require re-running init. On the new
node, with root SSH trust to an existing member in place,
sudo crm cluster join -y -i eth2 -c ha1 performs the same join operation
the transcript above shows crmsh running on ha2, typed this time by the
administrator. Its options:
| Option | Description |
|---|---|
-c, --cluster-node [USER@]HOST |
An existing cluster node to join through |
-i, --interface IF |
Cluster communication address on the joining node |
-y, --yes |
Answer yes to the confirmation prompts |
The join command retrieves the Corosync configuration, authkey, and known
nodes, then starts the stack and prints a transcript in the same INFO-line
style as the init output above. With the cluster formed, check it from either
node. On ha1, as john:
$ sudo crm -D plain status
Cluster Summary:
* Stack: corosync (Pacemaker is running)
* Current DC: ha1 (version 3.0.0-3.0.0) - partition with quorum
* Last updated: Wed Nov 25 09:01:15 2026 on ha1
* Last change: Wed Nov 25 09:00:57 2026 by root via root on ha2
* 2 nodes configured
* 0 resource instances configured
Node List:
* Online: [ ha1 ha2 ]
Full List of Resources:
* No resources
The status answers the three basic questions: both nodes are online, the
partition holding them has quorum, and one node - the DC, the designated
controller - coordinates configuration changes. The 0 resource instances
line is correct at this point; the first resources appear in section 32.6.
Quorum has its own tool. On ha1, as john:
$ sudo corosync-quorumtool -s
Quorum information
------------------
Date: Wed Nov 25 09:01:19 2026
Quorum provider: corosync_votequorum
Nodes: 2
Node ID: 1
Ring ID: 1.e
Quorate: Yes
Votequorum information
----------------------
Expected votes: 3
Highest expected: 3
Total votes: 3
Quorum: 2
Flags: Quorate Qdevice
Membership information
----------------------
Nodeid Votes Qdevice Name
1 1 A,V,NMW ha1 (local)
2 1 A,V,NMW ha2
0 1 Qdevice
| Option | Description |
|---|---|
-s |
Print quorum and membership status once |
-p |
Poll until the cluster is quorate, then exit |
-t TIMEOUT |
Give up after TIMEOUT seconds when used with -p |
The arithmetic is the important part: two node votes plus one QDevice vote
give three expected votes, and the quorum threshold is two. A side that
cannot reach the witness therefore needs both nodes to keep quorum, while a
side that can reach it needs only one - which is precisely the property the
partition experiment in section 32.3.5 demonstrates. The tool also exits
with status 0 when quorate and status 2 when invoked with -s on a cluster
without quorum, which makes it usable from scripts; the minority capture
in section 32.3.5 shows the failing case and its exit status.
32.3.4. Two-Node Clusters, Witnesses, and QDevice
A two-node cluster has a structural problem: two nodes casting one vote
each cannot form a majority when they disagree. Corosync's two_node mode
special-cases it - either node alone counts as a quorate cluster - but that
converts every partition into two clusters, each convinced it may own the
resources. For any service with writable state, the standard answer is to
change the arithmetic instead of special-casing it: add a third vote that
belongs to neither node.
The QDevice client on each cluster node and the QNetd server on a
witness host provide that vote. With the default ffsplit (fifty-fifty)
algorithm, the witness gives its vote to a partition only when it can talk
to a node in it, and it never lets a lone node and a lone node both claim
it. The tie-breaker rule decides the exact case of both nodes reachable
from the witness but not from each other; the practice cluster uses the
default, the lowest node ID. A production witness should sit on
infrastructure independent of both nodes' power and network - a small VM on
a third host is the usual choice. The witness sees only quorum traffic and
no data, so it can be a modest machine.
The practice cluster's witness is already running; verify both ends. On
ha1, as john:
$ sudo corosync-qdevice-tool -s
Qdevice information
-------------------
Model: Net
Node ID: 1
Configured node list:
0 Node ID = 1
1 Node ID = 2
Membership node list: 1, 2
Qdevice-net information
----------------------
Cluster name: hacluster
QNetd host: lbclient:5403
Algorithm: Fifty-Fifty split
Tie-breaker: Node with lowest node ID
State: Connected
On lbclient, as john:
$ sudo systemctl is-active corosync-qnetd
active
State: Connected and an active corosync-qnetd are the two facts a
healthy witness provides. The QNetd connection is TLS; the certificates
were exchanged by the certification process visible in the init transcript,
and they live under /etc/corosync/qdevice on the nodes and
/etc/corosync/qnetd on the witness. If the witness dies, the cluster does
not lose quorum while both nodes are up - the third vote simply
disappears, returning the cluster to two votes with both required. Replace
or repair the witness before the next node failure.
32.3.5. Network Partitions and Minority-Partition Behavior
A partition divides the cluster into groups that cannot hear each other. Each group recomputes membership and quorum independently, and the whole design goal is that only one group - the one that still holds a majority of votes - continues to run resources.
Figure 32.3. Vote arithmetic for the two-node cluster with a witness. In the partition state, the minority node's vote total drops below the quorum threshold and its activity is blocked, while the majority side keeps the witness's vote and stays quorate.
The following experiment isolates ha1 from both ha2 and the witness by
dropping Corosync and QDevice traffic with nftables - the table, chain,
and rule syntax is the one Chapter 18 introduced. It
is performed on the completed cluster with its NFS stack from section
32.6; the cluster-side results are pure Corosync behavior, and the
client-side consequences are covered in section 32.6.5. All commands on
ha1, as john; the cluster service is running throughout:
$ sudo nft add table inet ch32
$ sudo nft add chain inet ch32 output "{ type filter hook output priority 0; }"
$ sudo nft add rule inet ch32 output ip daddr 192.168.233.12 udp dport 5405 drop
$ sudo nft add rule inet ch32 output ip daddr 192.168.232.14 tcp dport 5403 drop
Each command normally prints nothing. The first creates a table, the second
an output chain, the third drops membership packets to ha2, and the
fourth drops the QDevice connection to the witness. Confirm the rules are
active:
$ sudo nft list table inet ch32
table inet ch32 {
chain output {
type filter hook output priority filter; policy accept;
ip daddr 192.168.233.12 udp dport 5405 drop
ip daddr 192.168.232.14 tcp dport 5403 drop
}
}
Within a few seconds the cluster re-evaluates. On the isolated node ha1,
as john:
$ sudo corosync-quorumtool -s
Quorum information
------------------
Date: Wed Nov 25 09:10:07 2026
Quorum provider: corosync_votequorum
Nodes: 1
Node ID: 1
Ring ID: 1.12
Quorate: No
Votequorum information
----------------------
Expected votes: 3
Highest expected: 3
Total votes: 1
Quorum: 2 Activity blocked
Flags: Qdevice
Membership information
----------------------
Nodeid Votes Qdevice Name
1 1 A,NV,NMW ha1 (local)
0 0 Qdevice (votes 1)
The command exits with status 2, the not-quorate code from
corosync-quorumtool -s. ha1 now sees a one-node cluster whose
own vote is its only vote: Total votes: 1 against a quorum of 2, and
Corosync explicitly reports Activity blocked. This is the minority
partition behaving correctly. The same node's Pacemaker view:
$ sudo crm -D plain status
Cluster Summary:
* Stack: corosync (Pacemaker is running)
* Current DC: ha1 (version 3.0.0-3.0.0) - partition WITHOUT quorum
* Last updated: Wed Nov 25 09:10:11 2026 on ha1
* Last change: Wed Nov 25 09:07:39 2026 by root via root on ha1
* 2 nodes configured
* 6 resource instances configured
Node List:
* Online: [ ha1 ]
* OFFLINE: [ ha2 ]
Full List of Resources:
* Clone Set: ms_drbd [p_drbd] (promotable):
* Stopped: [ ha1 ha2 ]
* Resource Group: g_nfs:
* p_fs (ocf:heartbeat:Filesystem): Stopped
* p_vip (ocf:heartbeat:IPaddr2): Stopped
* p_nfs (ocf:heartbeat:nfsserver): Stopped
* p_export (ocf:heartbeat:exportfs): Stopped
Every resource on the minority side is stopped. That is
no-quorum-policy=stop doing its job, a property set in section 32.6.3:
the minority would rather stop the service than risk a second writer. On
the majority node ha2, as john, the same two commands:
$ sudo corosync-quorumtool -s
Quorum information
------------------
Date: Wed Nov 25 08:47:01 2026
Quorum provider: corosync_votequorum
Nodes: 1
Node ID: 2
Ring ID: 2.12
Quorate: Yes
Votequorum information
----------------------
Expected votes: 3
Highest expected: 3
Total votes: 2
Quorum: 2
Flags: Quorate Qdevice
Membership information
----------------------
Nodeid Votes Qdevice Name
2 1 A,V,NMW ha2 (local)
0 1 Qdevice
$ sudo crm -D plain status
Cluster Summary:
* Stack: corosync (Pacemaker is running)
* Current DC: ha2 (version 3.0.0-3.0.0) - partition with quorum
* Last updated: Wed Nov 25 08:47:05 2026 on ha2
* Last change: Wed Nov 25 08:44:24 2026 by root via root on ha1
* 2 nodes configured
* 6 resource instances configured
Node List:
* Online: [ ha2 ]
* OFFLINE: [ ha1 ]
Full List of Resources:
* Clone Set: ms_drbd [p_drbd] (promotable):
* Promoted: [ ha2 ]
* Stopped: [ ha1 ]
* Resource Group: g_nfs:
* p_fs (ocf:heartbeat:Filesystem): Started ha2
* p_vip (ocf:heartbeat:IPaddr2): Started ha2
* p_nfs (ocf:heartbeat:nfsserver): Started ha2
* p_export (ocf:heartbeat:exportfs): Started ha2
The two sides disagree about who is online, and they agree about the only
thing that matters: ha2, holding the witness's vote, is quorate and
serves; ha1, one vote short, has stopped everything. No fencing action
occurred anywhere - this cluster runs with fencing disabled, so
Pacemaker's journal records nothing for a fenc or quorum filter:
$ sudo journalctl -u pacemaker --no-pager -n 20 | grep -i -E "fenc|quorum" | tail -8
The command printed nothing, which is expected with stonith-enabled=false.
On a fenced cluster the same journal records each fencing action and its
outcome; section 32.4.5 describes what those entries look for.
Removing the partition heals the cluster. On ha1, as john:
$ sudo nft delete table inet ch32
The command prints nothing. Membership returns within a few seconds, the
nodes re-form one partition, and ha1 rejoins as a secondary that holds no
resources - visible on ha1, as john:
$ sudo crm -D plain status
Cluster Summary:
* Stack: corosync (Pacemaker is running)
* Current DC: ha1 (version 3.0.0-3.0.0) - partition with quorum
* Last updated: Wed Nov 25 09:10:35 2026 on ha1
* Last change: Wed Nov 25 08:44:24 2026 by root via root on ha1
* 2 nodes configured
* 6 resource instances configured
Node List:
* Online: [ ha1 ha2 ]
Full List of Resources:
* Clone Set: ms_drbd [p_drbd] (promotable):
* Promoted: [ ha2 ]
* Unpromoted: [ ha1 ]
* Resource Group: g_nfs:
* p_fs (ocf:heartbeat:Filesystem): Started ha2
* p_vip (ocf:heartbeat:IPaddr2): Started ha2
* p_nfs (ocf:heartbeat:nfsserver): Started ha2
* p_export (ocf:heartbeat:exportfs): Started ha2
Note what did not happen: the service did not fail back. The group stays
on ha2 because of the resource stickiness configured in section 32.6.3,
and moving it back is an explicit, planned act. A partition is not a
reason to move data twice.