]> git.proxmox.com Git - pve-docs.git/blame - pvecm.adoc
vzdump: add section about backup fleecing
[pve-docs.git] / pvecm.adoc
CommitLineData
bde0e57d 1[[chapter_pvecm]]
d8742b0c 2ifdef::manvolnum[]
b2f242ab
DM
3pvecm(1)
4========
5f09af76
DM
5:pve-toplevel:
6
d8742b0c
DM
7NAME
8----
9
74026b8f 10pvecm - Proxmox VE Cluster Manager
d8742b0c 11
49a5e11c 12SYNOPSIS
d8742b0c
DM
13--------
14
15include::pvecm.1-synopsis.adoc[]
16
17DESCRIPTION
18-----------
19endif::manvolnum[]
20
21ifndef::manvolnum[]
22Cluster Manager
23===============
5f09af76 24:pve-toplevel:
194d2f29 25endif::manvolnum[]
5f09af76 26
65a0aa49 27The {pve} cluster manager `pvecm` is a tool to create a group of
8c1189b6 28physical servers. Such a group is called a *cluster*. We use the
8a865621 29http://www.corosync.org[Corosync Cluster Engine] for reliable group
fdf1dd36
TL
30communication. There's no explicit limit for the number of nodes in a cluster.
31In practice, the actual possible node count may be limited by the host and
79bb0794 32network performance. Currently (2021), there are reports of clusters (using
fdf1dd36 33high-end enterprise hardware) with over 50 nodes in production.
8a865621 34
8c1189b6 35`pvecm` can be used to create a new cluster, join nodes to a cluster,
a37d539f 36leave the cluster, get status information, and do various other cluster-related
60ed554f 37tasks. The **P**rox**m**o**x** **C**luster **F**ile **S**ystem (``pmxcfs'')
e300cf7d 38is used to transparently distribute the cluster configuration to all cluster
8a865621
DM
39nodes.
40
41Grouping nodes into a cluster has the following advantages:
42
a37d539f 43* Centralized, web-based management
8a865621 44
6d3c0b34 45* Multi-master clusters: each node can do all management tasks
8a865621 46
a37d539f
DW
47* Use of `pmxcfs`, a database-driven file system, for storing configuration
48 files, replicated in real-time on all nodes using `corosync`
8a865621 49
5eba0743 50* Easy migration of virtual machines and containers between physical
8a865621
DM
51 hosts
52
53* Fast deployment
54
55* Cluster-wide services like firewall and HA
56
57
58Requirements
59------------
60
337a2d42 61* All nodes must be able to connect to each other via UDP ports 5405-5412
a9e7c3aa 62 for corosync to work.
8a865621 63
a37d539f 64* Date and time must be synchronized.
8a865621 65
a37d539f 66* An SSH tunnel on TCP port 22 between nodes is required.
8a865621 67
ceabe189
DM
68* If you are interested in High Availability, you need to have at
69 least three nodes for reliable quorum. All nodes should have the
70 same version.
8a865621
DM
71
72* We recommend a dedicated NIC for the cluster traffic, especially if
73 you use shared storage.
74
a37d539f 75* The root password of a cluster node is required for adding nodes.
d4a9910f 76
8e0e0bcf
FE
77* Online migration of virtual machines is only supported when nodes have CPUs
78 from the same vendor. It might work otherwise, but this is never guaranteed.
79
e4b62d04
TL
80NOTE: It is not possible to mix {pve} 3.x and earlier with {pve} 4.X cluster
81nodes.
82
a37d539f
DW
83NOTE: While it's possible to mix {pve} 4.4 and {pve} 5.0 nodes, doing so is
84not supported as a production configuration and should only be done temporarily,
85during an upgrade of the whole cluster from one major version to another.
8a865621 86
a9e7c3aa
SR
87NOTE: Running a cluster of {pve} 6.x with earlier versions is not possible. The
88cluster protocol (corosync) between {pve} 6.x and earlier versions changed
89fundamentally. The corosync 3 packages for {pve} 5.4 are only intended for the
90upgrade procedure to {pve} 6.0.
91
8a865621 92
ceabe189
DM
93Preparing Nodes
94---------------
8a865621 95
65a0aa49 96First, install {pve} on all nodes. Make sure that each node is
8a865621
DM
97installed with the final hostname and IP configuration. Changing the
98hostname and IP is not possible after cluster creation.
99
a37d539f 100While it's common to reference all node names and their IPs in `/etc/hosts` (or
a9e7c3aa
SR
101make their names resolvable through other means), this is not necessary for a
102cluster to work. It may be useful however, as you can then connect from one node
a37d539f 103to another via SSH, using the easier to remember node name (see also
a9e7c3aa 104xref:pvecm_corosync_addresses[Link Address Types]). Note that we always
a37d539f 105recommend referencing nodes by their IP addresses in the cluster configuration.
a9e7c3aa 106
9a7396aa 107
11202f1d 108[[pvecm_create_cluster]]
6cab1704
TL
109Create a Cluster
110----------------
111
112You can either create a cluster on the console (login via `ssh`), or through
a37d539f 113the API using the {pve} web interface (__Datacenter -> Cluster__).
8a865621 114
6cab1704
TL
115NOTE: Use a unique name for your cluster. This name cannot be changed later.
116The cluster name follows the same rules as node names.
3e380ce0 117
6cab1704 118[[pvecm_cluster_create_via_gui]]
3e380ce0
SR
119Create via Web GUI
120~~~~~~~~~~~~~~~~~~
121
24398259
SR
122[thumbnail="screenshot/gui-cluster-create.png"]
123
3e380ce0 124Under __Datacenter -> Cluster__, click on *Create Cluster*. Enter the cluster
a37d539f
DW
125name and select a network connection from the drop-down list to serve as the
126main cluster network (Link 0). It defaults to the IP resolved via the node's
3e380ce0
SR
127hostname.
128
663ae2bf
DW
129As of {pve} 6.2, up to 8 fallback links can be added to a cluster. To add a
130redundant link, click the 'Add' button and select a link number and IP address
131from the respective fields. Prior to {pve} 6.2, to add a second link as
132fallback, you can select the 'Advanced' checkbox and choose an additional
133network interface (Link 1, see also xref:pvecm_redundancy[Corosync Redundancy]).
3e380ce0 134
a37d539f
DW
135NOTE: Ensure that the network selected for cluster communication is not used for
136any high traffic purposes, like network storage or live-migration.
6cab1704
TL
137While the cluster network itself produces small amounts of data, it is very
138sensitive to latency. Check out full
139xref:pvecm_cluster_network_requirements[cluster network requirements].
140
141[[pvecm_cluster_create_via_cli]]
a37d539f
DW
142Create via the Command Line
143~~~~~~~~~~~~~~~~~~~~~~~~~~~
3e380ce0
SR
144
145Login via `ssh` to the first {pve} node and run the following command:
8a865621 146
c15cdfba
TL
147----
148 hp1# pvecm create CLUSTERNAME
149----
8a865621 150
3e380ce0 151To check the state of the new cluster use:
8a865621 152
c15cdfba 153----
8a865621 154 hp1# pvecm status
c15cdfba 155----
8a865621 156
a37d539f
DW
157Multiple Clusters in the Same Network
158~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dd1aa0e0
TL
159
160It is possible to create multiple clusters in the same physical or logical
a37d539f
DW
161network. In this case, each cluster must have a unique name to avoid possible
162clashes in the cluster communication stack. Furthermore, this helps avoid human
163confusion by making clusters clearly distinguishable.
dd1aa0e0
TL
164
165While the bandwidth requirement of a corosync cluster is relatively low, the
166latency of packages and the package per second (PPS) rate is the limiting
167factor. Different clusters in the same network can compete with each other for
168these resources, so it may still make sense to use separate physical network
169infrastructure for bigger clusters.
8a865621 170
11202f1d 171[[pvecm_join_node_to_cluster]]
8a865621 172Adding Nodes to the Cluster
ceabe189 173---------------------------
8a865621 174
aaf632d5
FE
175CAUTION: All existing configuration in `/etc/pve` is overwritten when joining a
176cluster. In particular, a joining node cannot hold any guests, since guest IDs
177could otherwise conflict, and the node will inherit the cluster's storage
178configuration. To join a node with existing guest, as a workaround, you can
179create a backup of each guest (using `vzdump`) and restore it under a different
180ID after joining. If the node's storage layout differs, you will need to re-add
181the node's storages, and adapt each storage's node restriction to reflect on
182which nodes the storage is actually available.
3e380ce0 183
6cab1704
TL
184Join Node to Cluster via GUI
185~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3e380ce0 186
24398259
SR
187[thumbnail="screenshot/gui-cluster-join-information.png"]
188
a37d539f
DW
189Log in to the web interface on an existing cluster node. Under __Datacenter ->
190Cluster__, click the *Join Information* button at the top. Then, click on the
3e380ce0
SR
191button *Copy Information*. Alternatively, copy the string from the 'Information'
192field manually.
193
24398259
SR
194[thumbnail="screenshot/gui-cluster-join.png"]
195
a37d539f 196Next, log in to the web interface on the node you want to add.
3e380ce0 197Under __Datacenter -> Cluster__, click on *Join Cluster*. Fill in the
6cab1704
TL
198'Information' field with the 'Join Information' text you copied earlier.
199Most settings required for joining the cluster will be filled out
200automatically. For security reasons, the cluster password has to be entered
201manually.
3e380ce0
SR
202
203NOTE: To enter all required data manually, you can disable the 'Assisted Join'
204checkbox.
205
6cab1704 206After clicking the *Join* button, the cluster join process will start
a37d539f
DW
207immediately. After the node has joined the cluster, its current node certificate
208will be replaced by one signed from the cluster certificate authority (CA).
209This means that the current session will stop working after a few seconds. You
210then might need to force-reload the web interface and log in again with the
211cluster credentials.
3e380ce0 212
6cab1704 213Now your node should be visible under __Datacenter -> Cluster__.
3e380ce0 214
6cab1704
TL
215Join Node to Cluster via Command Line
216~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3e380ce0 217
a37d539f 218Log in to the node you want to join into an existing cluster via `ssh`.
8a865621 219
c15cdfba 220----
8673c878 221 # pvecm add IP-ADDRESS-CLUSTER
c15cdfba 222----
8a865621 223
a37d539f 224For `IP-ADDRESS-CLUSTER`, use the IP or hostname of an existing cluster node.
a9e7c3aa 225An IP address is recommended (see xref:pvecm_corosync_addresses[Link Address Types]).
8a865621 226
8a865621 227
a9e7c3aa 228To check the state of the cluster use:
8a865621 229
c15cdfba 230----
8a865621 231 # pvecm status
c15cdfba 232----
8a865621 233
ceabe189 234.Cluster status after adding 4 nodes
8a865621 235----
8673c878
DW
236 # pvecm status
237Cluster information
238~~~~~~~~~~~~~~~~~~~
239Name: prod-central
240Config Version: 3
241Transport: knet
242Secure auth: on
243
8a865621
DM
244Quorum information
245~~~~~~~~~~~~~~~~~~
8673c878 246Date: Tue Sep 14 11:06:47 2021
8a865621
DM
247Quorum provider: corosync_votequorum
248Nodes: 4
249Node ID: 0x00000001
8673c878 250Ring ID: 1.1a8
8a865621
DM
251Quorate: Yes
252
253Votequorum information
254~~~~~~~~~~~~~~~~~~~~~~
255Expected votes: 4
256Highest expected: 4
257Total votes: 4
91f3edd0 258Quorum: 3
8a865621
DM
259Flags: Quorate
260
261Membership information
262~~~~~~~~~~~~~~~~~~~~~~
263 Nodeid Votes Name
2640x00000001 1 192.168.15.91
2650x00000002 1 192.168.15.92 (local)
2660x00000003 1 192.168.15.93
2670x00000004 1 192.168.15.94
268----
269
a37d539f 270If you only want a list of all nodes, use:
8a865621 271
c15cdfba 272----
8a865621 273 # pvecm nodes
c15cdfba 274----
8a865621 275
5eba0743 276.List nodes in a cluster
8a865621 277----
8673c878 278 # pvecm nodes
8a865621
DM
279
280Membership information
281~~~~~~~~~~~~~~~~~~~~~~
282 Nodeid Votes Name
283 1 1 hp1
284 2 1 hp2 (local)
285 3 1 hp3
286 4 1 hp4
287----
288
3254bfdd 289[[pvecm_adding_nodes_with_separated_cluster_network]]
a37d539f 290Adding Nodes with Separated Cluster Network
e4ec4154
TL
291~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
292
a37d539f 293When adding a node to a cluster with a separated cluster network, you need to
a9e7c3aa 294use the 'link0' parameter to set the nodes address on that network:
e4ec4154
TL
295
296[source,bash]
4d19cb00 297----
cd44cb4c 298# pvecm add IP-ADDRESS-CLUSTER --link0 LOCAL-IP-ADDRESS-LINK0
4d19cb00 299----
e4ec4154 300
a9e7c3aa 301If you want to use the built-in xref:pvecm_redundancy[redundancy] of the
a37d539f 302Kronosnet transport layer, also use the 'link1' parameter.
e4ec4154 303
a37d539f
DW
304Using the GUI, you can select the correct interface from the corresponding
305'Link X' fields in the *Cluster Join* dialog.
8a865621
DM
306
307Remove a Cluster Node
ceabe189 308---------------------
8a865621 309
a37d539f 310CAUTION: Read the procedure carefully before proceeding, as it may
8a865621
DM
311not be what you want or need.
312
7ec7bcee
DW
313Move all virtual machines from the node. Ensure that you have made copies of any
314local data or backups that you want to keep. In addition, make sure to remove
315any scheduled replication jobs to the node to be removed.
316
317CAUTION: Failure to remove replication jobs to a node before removing said node
318will result in the replication job becoming irremovable. Especially note that
319replication automatically switches direction if a replicated VM is migrated, so
320by migrating a replicated VM from a node to be deleted, replication jobs will be
321set up to that node automatically.
322
323In the following example, we will remove the node hp4 from the cluster.
8a865621 324
e8503c6c
EK
325Log in to a *different* cluster node (not hp4), and issue a `pvecm nodes`
326command to identify the node ID to remove:
8a865621
DM
327
328----
8673c878 329 hp1# pvecm nodes
8a865621
DM
330
331Membership information
332~~~~~~~~~~~~~~~~~~~~~~
333 Nodeid Votes Name
334 1 1 hp1 (local)
335 2 1 hp2
336 3 1 hp3
337 4 1 hp4
338----
339
e8503c6c 340
a37d539f
DW
341At this point, you must power off hp4 and ensure that it will not power on
342again (in the network) with its current configuration.
e8503c6c 343
a37d539f
DW
344IMPORTANT: As mentioned above, it is critical to power off the node
345*before* removal, and make sure that it will *not* power on again
346(in the existing cluster network) with its current configuration.
347If you power on the node as it is, the cluster could end up broken,
348and it could be difficult to restore it to a functioning state.
e8503c6c
EK
349
350After powering off the node hp4, we can safely remove it from the cluster.
8a865621 351
c15cdfba 352----
8a865621 353 hp1# pvecm delnode hp4
10da5ce1 354 Killing node 4
c15cdfba 355----
8a865621 356
249fd833
DW
357NOTE: At this point, it is possible that you will receive an error message
358stating `Could not kill node (error = CS_ERR_NOT_EXIST)`. This does not
359signify an actual failure in the deletion of the node, but rather a failure in
360corosync trying to kill an offline node. Thus, it can be safely ignored.
361
10da5ce1
DJ
362Use `pvecm nodes` or `pvecm status` to check the node list again. It should
363look something like:
8a865621
DM
364
365----
366hp1# pvecm status
367
8673c878 368...
8a865621
DM
369
370Votequorum information
371~~~~~~~~~~~~~~~~~~~~~~
372Expected votes: 3
373Highest expected: 3
374Total votes: 3
91f3edd0 375Quorum: 2
8a865621
DM
376Flags: Quorate
377
378Membership information
379~~~~~~~~~~~~~~~~~~~~~~
380 Nodeid Votes Name
3810x00000001 1 192.168.15.90 (local)
3820x00000002 1 192.168.15.91
3830x00000003 1 192.168.15.92
384----
385
a9e7c3aa 386If, for whatever reason, you want this server to join the same cluster again,
a37d539f 387you have to:
8a865621 388
a37d539f 389* do a fresh install of {pve} on it,
8a865621
DM
390
391* then join it, as explained in the previous section.
d8742b0c 392
9cfbea53
FE
393The configuration files for the removed node will still reside in
394'/etc/pve/nodes/hp4'. Recover any configuration you still need and remove the
395directory afterwards.
396
41925ede
SR
397NOTE: After removal of the node, its SSH fingerprint will still reside in the
398'known_hosts' of the other nodes. If you receive an SSH error after rejoining
9121b45b
TL
399a node with the same IP or hostname, run `pvecm updatecerts` once on the
400re-added node to update its fingerprint cluster wide.
41925ede 401
38ae8db3 402[[pvecm_separate_node_without_reinstall]]
a37d539f 403Separate a Node Without Reinstalling
555e966b
TL
404~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
405
406CAUTION: This is *not* the recommended method, proceed with caution. Use the
a37d539f 407previous method if you're unsure.
555e966b
TL
408
409You can also separate a node from a cluster without reinstalling it from
a37d539f
DW
410scratch. But after removing the node from the cluster, it will still have
411access to any shared storage. This must be resolved before you start removing
555e966b 412the node from the cluster. A {pve} cluster cannot share the exact same
60ed554f 413storage with another cluster, as storage locking doesn't work over the cluster
a37d539f 414boundary. Furthermore, it may also lead to VMID conflicts.
555e966b 415
a37d539f 416It's suggested that you create a new storage, where only the node which you want
a9e7c3aa 417to separate has access. This can be a new export on your NFS or a new Ceph
a37d539f
DW
418pool, to name a few examples. It's just important that the exact same storage
419does not get accessed by multiple clusters. After setting up this storage, move
420all data and VMs from the node to it. Then you are ready to separate the
3be22308 421node from the cluster.
555e966b 422
a37d539f
DW
423WARNING: Ensure that all shared resources are cleanly separated! Otherwise you
424will run into conflicts and problems.
555e966b 425
a37d539f 426First, stop the corosync and pve-cluster services on the node:
555e966b 427[source,bash]
4d19cb00 428----
555e966b
TL
429systemctl stop pve-cluster
430systemctl stop corosync
4d19cb00 431----
555e966b 432
a37d539f 433Start the cluster file system again in local mode:
555e966b 434[source,bash]
4d19cb00 435----
555e966b 436pmxcfs -l
4d19cb00 437----
555e966b
TL
438
439Delete the corosync configuration files:
440[source,bash]
4d19cb00 441----
555e966b 442rm /etc/pve/corosync.conf
838081cd 443rm -r /etc/corosync/*
4d19cb00 444----
555e966b 445
a37d539f 446You can now start the file system again as a normal service:
555e966b 447[source,bash]
4d19cb00 448----
555e966b
TL
449killall pmxcfs
450systemctl start pve-cluster
4d19cb00 451----
555e966b 452
a37d539f
DW
453The node is now separated from the cluster. You can deleted it from any
454remaining node of the cluster with:
555e966b 455[source,bash]
4d19cb00 456----
555e966b 457pvecm delnode oldnode
4d19cb00 458----
555e966b 459
a37d539f
DW
460If the command fails due to a loss of quorum in the remaining node, you can set
461the expected votes to 1 as a workaround:
555e966b 462[source,bash]
4d19cb00 463----
555e966b 464pvecm expected 1
4d19cb00 465----
555e966b 466
96d698db 467And then repeat the 'pvecm delnode' command.
555e966b 468
a37d539f
DW
469Now switch back to the separated node and delete all the remaining cluster
470files on it. This ensures that the node can be added to another cluster again
471without problems.
555e966b
TL
472
473[source,bash]
4d19cb00 474----
555e966b 475rm /var/lib/corosync/*
4d19cb00 476----
555e966b
TL
477
478As the configuration files from the other nodes are still in the cluster
a37d539f
DW
479file system, you may want to clean those up too. After making absolutely sure
480that you have the correct node name, you can simply remove the entire
481directory recursively from '/etc/pve/nodes/NODENAME'.
555e966b 482
a37d539f
DW
483CAUTION: The node's SSH keys will remain in the 'authorized_key' file. This
484means that the nodes can still connect to each other with public key
485authentication. You should fix this by removing the respective keys from the
555e966b 486'/etc/pve/priv/authorized_keys' file.
d8742b0c 487
a9e7c3aa 488
806ef12d
DM
489Quorum
490------
491
492{pve} use a quorum-based technique to provide a consistent state among
493all cluster nodes.
494
495[quote, from Wikipedia, Quorum (distributed computing)]
496____
497A quorum is the minimum number of votes that a distributed transaction
498has to obtain in order to be allowed to perform an operation in a
499distributed system.
500____
501
502In case of network partitioning, state changes requires that a
503majority of nodes are online. The cluster switches to read-only mode
5eba0743 504if it loses quorum.
806ef12d
DM
505
506NOTE: {pve} assigns a single vote to each node by default.
507
a9e7c3aa 508
e4ec4154
TL
509Cluster Network
510---------------
511
512The cluster network is the core of a cluster. All messages sent over it have to
a9e7c3aa 513be delivered reliably to all nodes in their respective order. In {pve} this
a37d539f
DW
514part is done by corosync, an implementation of a high performance, low overhead,
515high availability development toolkit. It serves our decentralized configuration
516file system (`pmxcfs`).
e4ec4154 517
3254bfdd 518[[pvecm_cluster_network_requirements]]
e4ec4154
TL
519Network Requirements
520~~~~~~~~~~~~~~~~~~~~
c43c999f
TL
521
522The {pve} cluster stack requires a reliable network with latencies under 5
523milliseconds (LAN performance) between all nodes to operate stably. While on
524setups with a small node count a network with higher latencies _may_ work, this
525is not guaranteed and gets rather unlikely with more than three nodes and
526latencies above around 10 ms.
527
528The network should not be used heavily by other members, as while corosync does
529not uses much bandwidth it is sensitive to latency jitters; ideally corosync
530runs on its own physically separated network. Especially do not use a shared
531network for corosync and storage (except as a potential low-priority fallback
532in a xref:pvecm_redundancy[redundant] configuration).
e4ec4154 533
a9e7c3aa 534Before setting up a cluster, it is good practice to check if the network is fit
a37d539f 535for that purpose. To ensure that the nodes can connect to each other on the
a9e7c3aa
SR
536cluster network, you can test the connectivity between them with the `ping`
537tool.
e4ec4154 538
a9e7c3aa
SR
539If the {pve} firewall is enabled, ACCEPT rules for corosync will automatically
540be generated - no manual action is required.
e4ec4154 541
a9e7c3aa
SR
542NOTE: Corosync used Multicast before version 3.0 (introduced in {pve} 6.0).
543Modern versions rely on https://kronosnet.org/[Kronosnet] for cluster
544communication, which, for now, only supports regular UDP unicast.
e4ec4154 545
a9e7c3aa
SR
546CAUTION: You can still enable Multicast or legacy unicast by setting your
547transport to `udp` or `udpu` in your xref:pvecm_edit_corosync_conf[corosync.conf],
548but keep in mind that this will disable all cryptography and redundancy support.
549This is therefore not recommended.
e4ec4154
TL
550
551Separate Cluster Network
552~~~~~~~~~~~~~~~~~~~~~~~~
553
a37d539f
DW
554When creating a cluster without any parameters, the corosync cluster network is
555generally shared with the web interface and the VMs' network. Depending on
556your setup, even storage traffic may get sent over the same network. It's
557recommended to change that, as corosync is a time-critical, real-time
a9e7c3aa 558application.
e4ec4154 559
a37d539f 560Setting Up a New Network
e4ec4154
TL
561^^^^^^^^^^^^^^^^^^^^^^^^
562
9ffebff5 563First, you have to set up a new network interface. It should be on a physically
e4ec4154 564separate network. Ensure that your network fulfills the
3254bfdd 565xref:pvecm_cluster_network_requirements[cluster network requirements].
e4ec4154
TL
566
567Separate On Cluster Creation
568^^^^^^^^^^^^^^^^^^^^^^^^^^^^
569
a9e7c3aa 570This is possible via the 'linkX' parameters of the 'pvecm create'
a37d539f 571command, used for creating a new cluster.
e4ec4154 572
a9e7c3aa
SR
573If you have set up an additional NIC with a static address on 10.10.10.1/25,
574and want to send and receive all cluster communication over this interface,
e4ec4154
TL
575you would execute:
576
577[source,bash]
4d19cb00 578----
a9e7c3aa 579pvecm create test --link0 10.10.10.1
4d19cb00 580----
e4ec4154 581
a37d539f 582To check if everything is working properly, execute:
e4ec4154 583[source,bash]
4d19cb00 584----
e4ec4154 585systemctl status corosync
4d19cb00 586----
e4ec4154 587
a9e7c3aa 588Afterwards, proceed as described above to
3254bfdd 589xref:pvecm_adding_nodes_with_separated_cluster_network[add nodes with a separated cluster network].
82d52451 590
3254bfdd 591[[pvecm_separate_cluster_net_after_creation]]
e4ec4154
TL
592Separate After Cluster Creation
593^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
594
a9e7c3aa 595You can do this if you have already created a cluster and want to switch
e4ec4154 596its communication to another network, without rebuilding the whole cluster.
a37d539f 597This change may lead to short periods of quorum loss in the cluster, as nodes
e4ec4154
TL
598have to restart corosync and come up one after the other on the new network.
599
3254bfdd 600Check how to xref:pvecm_edit_corosync_conf[edit the corosync.conf file] first.
a9e7c3aa 601Then, open it and you should see a file similar to:
e4ec4154
TL
602
603----
604logging {
605 debug: off
606 to_syslog: yes
607}
608
609nodelist {
610
611 node {
612 name: due
613 nodeid: 2
614 quorum_votes: 1
615 ring0_addr: due
616 }
617
618 node {
619 name: tre
620 nodeid: 3
621 quorum_votes: 1
622 ring0_addr: tre
623 }
624
625 node {
626 name: uno
627 nodeid: 1
628 quorum_votes: 1
629 ring0_addr: uno
630 }
631
632}
633
634quorum {
635 provider: corosync_votequorum
636}
637
638totem {
a9e7c3aa 639 cluster_name: testcluster
e4ec4154 640 config_version: 3
a9e7c3aa 641 ip_version: ipv4-6
e4ec4154
TL
642 secauth: on
643 version: 2
644 interface {
a9e7c3aa 645 linknumber: 0
e4ec4154
TL
646 }
647
648}
649----
650
a37d539f 651NOTE: `ringX_addr` actually specifies a corosync *link address*. The name "ring"
a9e7c3aa
SR
652is a remnant of older corosync versions that is kept for backwards
653compatibility.
654
a37d539f 655The first thing you want to do is add the 'name' properties in the node entries,
a9e7c3aa 656if you do not see them already. Those *must* match the node name.
e4ec4154 657
a9e7c3aa
SR
658Then replace all addresses from the 'ring0_addr' properties of all nodes with
659the new addresses. You may use plain IP addresses or hostnames here. If you use
a37d539f
DW
660hostnames, ensure that they are resolvable from all nodes (see also
661xref:pvecm_corosync_addresses[Link Address Types]).
e4ec4154 662
a37d539f 663In this example, we want to switch cluster communication to the
0554c751 66410.10.10.0/25 network, so we change the 'ring0_addr' of each node respectively.
e4ec4154 665
a9e7c3aa 666NOTE: The exact same procedure can be used to change other 'ringX_addr' values
a37d539f
DW
667as well. However, we recommend only changing one link address at a time, so
668that it's easier to recover if something goes wrong.
a9e7c3aa
SR
669
670After we increase the 'config_version' property, the new configuration file
e4ec4154
TL
671should look like:
672
673----
e4ec4154
TL
674logging {
675 debug: off
676 to_syslog: yes
677}
678
679nodelist {
680
681 node {
682 name: due
683 nodeid: 2
684 quorum_votes: 1
685 ring0_addr: 10.10.10.2
686 }
687
688 node {
689 name: tre
690 nodeid: 3
691 quorum_votes: 1
692 ring0_addr: 10.10.10.3
693 }
694
695 node {
696 name: uno
697 nodeid: 1
698 quorum_votes: 1
699 ring0_addr: 10.10.10.1
700 }
701
702}
703
704quorum {
705 provider: corosync_votequorum
706}
707
708totem {
a9e7c3aa 709 cluster_name: testcluster
e4ec4154 710 config_version: 4
a9e7c3aa 711 ip_version: ipv4-6
e4ec4154
TL
712 secauth: on
713 version: 2
714 interface {
a9e7c3aa 715 linknumber: 0
e4ec4154
TL
716 }
717
718}
719----
720
a37d539f
DW
721Then, after a final check to see that all changed information is correct, we
722save it and once again follow the
723xref:pvecm_edit_corosync_conf[edit corosync.conf file] section to bring it into
724effect.
e4ec4154 725
a9e7c3aa
SR
726The changes will be applied live, so restarting corosync is not strictly
727necessary. If you changed other settings as well, or notice corosync
728complaining, you can optionally trigger a restart.
e4ec4154
TL
729
730On a single node execute:
a9e7c3aa 731
e4ec4154 732[source,bash]
4d19cb00 733----
e4ec4154 734systemctl restart corosync
4d19cb00 735----
e4ec4154 736
a37d539f 737Now check if everything is okay:
e4ec4154
TL
738
739[source,bash]
4d19cb00 740----
e4ec4154 741systemctl status corosync
4d19cb00 742----
e4ec4154 743
a37d539f 744If corosync begins to work again, restart it on all other nodes too.
e4ec4154
TL
745They will then join the cluster membership one by one on the new network.
746
3254bfdd 747[[pvecm_corosync_addresses]]
a37d539f 748Corosync Addresses
270757a1
SR
749~~~~~~~~~~~~~~~~~~
750
a9e7c3aa
SR
751A corosync link address (for backwards compatibility denoted by 'ringX_addr' in
752`corosync.conf`) can be specified in two ways:
270757a1 753
a37d539f 754* **IPv4/v6 addresses** can be used directly. They are recommended, since they
270757a1
SR
755are static and usually not changed carelessly.
756
a37d539f 757* **Hostnames** will be resolved using `getaddrinfo`, which means that by
270757a1
SR
758default, IPv6 addresses will be used first, if available (see also
759`man gai.conf`). Keep this in mind, especially when upgrading an existing
760cluster to IPv6.
761
a37d539f 762CAUTION: Hostnames should be used with care, since the addresses they
270757a1
SR
763resolve to can be changed without touching corosync or the node it runs on -
764which may lead to a situation where an address is changed without thinking
765about implications for corosync.
766
5f318cc0 767A separate, static hostname specifically for corosync is recommended, if
270757a1
SR
768hostnames are preferred. Also, make sure that every node in the cluster can
769resolve all hostnames correctly.
770
771Since {pve} 5.1, while supported, hostnames will be resolved at the time of
a37d539f 772entry. Only the resolved IP is saved to the configuration.
270757a1
SR
773
774Nodes that joined the cluster on earlier versions likely still use their
775unresolved hostname in `corosync.conf`. It might be a good idea to replace
5f318cc0 776them with IPs or a separate hostname, as mentioned above.
270757a1 777
e4ec4154 778
a9e7c3aa
SR
779[[pvecm_redundancy]]
780Corosync Redundancy
781-------------------
e4ec4154 782
a37d539f 783Corosync supports redundant networking via its integrated Kronosnet layer by
a9e7c3aa
SR
784default (it is not supported on the legacy udp/udpu transports). It can be
785enabled by specifying more than one link address, either via the '--linkX'
3e380ce0
SR
786parameters of `pvecm`, in the GUI as **Link 1** (while creating a cluster or
787adding a new node) or by specifying more than one 'ringX_addr' in
788`corosync.conf`.
e4ec4154 789
a9e7c3aa
SR
790NOTE: To provide useful failover, every link should be on its own
791physical network connection.
e4ec4154 792
a9e7c3aa
SR
793Links are used according to a priority setting. You can configure this priority
794by setting 'knet_link_priority' in the corresponding interface section in
5f318cc0 795`corosync.conf`, or, preferably, using the 'priority' parameter when creating
a9e7c3aa 796your cluster with `pvecm`:
e4ec4154 797
4d19cb00 798----
fcf0226e 799 # pvecm create CLUSTERNAME --link0 10.10.10.1,priority=15 --link1 10.20.20.1,priority=20
4d19cb00 800----
e4ec4154 801
fcf0226e 802This would cause 'link1' to be used first, since it has the higher priority.
a9e7c3aa
SR
803
804If no priorities are configured manually (or two links have the same priority),
805links will be used in order of their number, with the lower number having higher
806priority.
807
808Even if all links are working, only the one with the highest priority will see
a37d539f
DW
809corosync traffic. Link priorities cannot be mixed, meaning that links with
810different priorities will not be able to communicate with each other.
e4ec4154 811
a9e7c3aa 812Since lower priority links will not see traffic unless all higher priorities
a37d539f
DW
813have failed, it becomes a useful strategy to specify networks used for
814other tasks (VMs, storage, etc.) as low-priority links. If worst comes to
815worst, a higher latency or more congested connection might be better than no
a9e7c3aa 816connection at all.
e4ec4154 817
a9e7c3aa
SR
818Adding Redundant Links To An Existing Cluster
819~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
e4ec4154 820
a9e7c3aa
SR
821To add a new link to a running configuration, first check how to
822xref:pvecm_edit_corosync_conf[edit the corosync.conf file].
e4ec4154 823
a9e7c3aa
SR
824Then, add a new 'ringX_addr' to every node in the `nodelist` section. Make
825sure that your 'X' is the same for every node you add it to, and that it is
826unique for each node.
827
828Lastly, add a new 'interface', as shown below, to your `totem`
a37d539f 829section, replacing 'X' with the link number chosen above.
a9e7c3aa
SR
830
831Assuming you added a link with number 1, the new configuration file could look
832like this:
e4ec4154
TL
833
834----
a9e7c3aa
SR
835logging {
836 debug: off
837 to_syslog: yes
e4ec4154
TL
838}
839
840nodelist {
a9e7c3aa 841
e4ec4154 842 node {
a9e7c3aa
SR
843 name: due
844 nodeid: 2
e4ec4154 845 quorum_votes: 1
a9e7c3aa
SR
846 ring0_addr: 10.10.10.2
847 ring1_addr: 10.20.20.2
e4ec4154
TL
848 }
849
a9e7c3aa
SR
850 node {
851 name: tre
852 nodeid: 3
e4ec4154 853 quorum_votes: 1
a9e7c3aa
SR
854 ring0_addr: 10.10.10.3
855 ring1_addr: 10.20.20.3
e4ec4154
TL
856 }
857
a9e7c3aa
SR
858 node {
859 name: uno
860 nodeid: 1
861 quorum_votes: 1
862 ring0_addr: 10.10.10.1
863 ring1_addr: 10.20.20.1
864 }
865
866}
867
868quorum {
869 provider: corosync_votequorum
870}
871
872totem {
873 cluster_name: testcluster
874 config_version: 4
875 ip_version: ipv4-6
876 secauth: on
877 version: 2
878 interface {
879 linknumber: 0
880 }
881 interface {
882 linknumber: 1
883 }
e4ec4154 884}
a9e7c3aa 885----
e4ec4154 886
a9e7c3aa
SR
887The new link will be enabled as soon as you follow the last steps to
888xref:pvecm_edit_corosync_conf[edit the corosync.conf file]. A restart should not
889be necessary. You can check that corosync loaded the new link using:
e4ec4154 890
a9e7c3aa
SR
891----
892journalctl -b -u corosync
e4ec4154
TL
893----
894
a9e7c3aa
SR
895It might be a good idea to test the new link by temporarily disconnecting the
896old link on one node and making sure that its status remains online while
897disconnected:
e4ec4154 898
a9e7c3aa
SR
899----
900pvecm status
901----
902
903If you see a healthy cluster state, it means that your new link is being used.
e4ec4154 904
e4ec4154 905
65a0aa49 906Role of SSH in {pve} Clusters
9d999d1b 907-----------------------------
39aa8892 908
65a0aa49 909{pve} utilizes SSH tunnels for various features.
39aa8892 910
4e8fe2a9 911* Proxying console/shell sessions (node and guests)
9d999d1b 912+
4e8fe2a9
FG
913When using the shell for node B while being connected to node A, connects to a
914terminal proxy on node A, which is in turn connected to the login shell on node
915B via a non-interactive SSH tunnel.
39aa8892 916
4e8fe2a9
FG
917* VM and CT memory and local-storage migration in 'secure' mode.
918+
a37d539f 919During the migration, one or more SSH tunnel(s) are established between the
4e8fe2a9
FG
920source and target nodes, in order to exchange migration information and
921transfer memory and disk contents.
9d999d1b
TL
922
923* Storage replication
39aa8892 924
c58d2f17
FG
925SSH setup
926~~~~~~~~~
927
928On {pve} systems, the following changes are made to the SSH configuration/setup:
929
930* the `root` user's SSH client config gets setup to prefer `AES` over `ChaCha20`
931
932* the `root` user's `authorized_keys` file gets linked to
933 `/etc/pve/priv/authorized_keys`, merging all authorized keys within a cluster
934
935* `sshd` is configured to allow logging in as root with a password
936
937NOTE: Older systems might also have `/etc/ssh/ssh_known_hosts` set up as symlink
938pointing to `/etc/pve/priv/known_hosts`, containing a merged version of all
939node host keys. This system was replaced with explicit host key pinning in
940`pve-cluster <<INSERT VERSION>>`, the symlink can be deconfigured if still in
941place by running `pvecm updatecerts --unmerge-known-hosts`.
942
95d15550
FG
943Pitfalls due to automatic execution of `.bashrc` and siblings
944~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
945
9d999d1b
TL
946In case you have a custom `.bashrc`, or similar files that get executed on
947login by the configured shell, `ssh` will automatically run it once the session
948is established successfully. This can cause some unexpected behavior, as those
a37d539f
DW
949commands may be executed with root permissions on any of the operations
950described above. This can cause possible problematic side-effects!
39aa8892
OB
951
952In order to avoid such complications, it's recommended to add a check in
953`/root/.bashrc` to make sure the session is interactive, and only then run
954`.bashrc` commands.
955
956You can add this snippet at the beginning of your `.bashrc` file:
957
958----
9d999d1b 959# Early exit if not running interactively to avoid side-effects!
39aa8892
OB
960case $- in
961 *i*) ;;
962 *) return;;
963esac
964----
39aa8892 965
c21d2cbe
OB
966Corosync External Vote Support
967------------------------------
968
969This section describes a way to deploy an external voter in a {pve} cluster.
970When configured, the cluster can sustain more node failures without
971violating safety properties of the cluster communication.
972
a37d539f 973For this to work, there are two services involved:
c21d2cbe 974
a37d539f 975* A QDevice daemon which runs on each {pve} node
c21d2cbe 976
a37d539f 977* An external vote daemon which runs on an independent server
c21d2cbe 978
a37d539f 979As a result, you can achieve higher availability, even in smaller setups (for
c21d2cbe
OB
980example 2+1 nodes).
981
982QDevice Technical Overview
983~~~~~~~~~~~~~~~~~~~~~~~~~~
984
5f318cc0 985The Corosync Quorum Device (QDevice) is a daemon which runs on each cluster
a37d539f
DW
986node. It provides a configured number of votes to the cluster's quorum
987subsystem, based on an externally running third-party arbitrator's decision.
c21d2cbe
OB
988Its primary use is to allow a cluster to sustain more node failures than
989standard quorum rules allow. This can be done safely as the external device
990can see all nodes and thus choose only one set of nodes to give its vote.
a37d539f 991This will only be done if said set of nodes can have quorum (again) after
c21d2cbe
OB
992receiving the third-party vote.
993
a37d539f
DW
994Currently, only 'QDevice Net' is supported as a third-party arbitrator. This is
995a daemon which provides a vote to a cluster partition, if it can reach the
996partition members over the network. It will only give votes to one partition
c21d2cbe
OB
997of a cluster at any time.
998It's designed to support multiple clusters and is almost configuration and
999state free. New clusters are handled dynamically and no configuration file
1000is needed on the host running a QDevice.
1001
a37d539f
DW
1002The only requirements for the external host are that it needs network access to
1003the cluster and to have a corosync-qnetd package available. We provide a package
1004for Debian based hosts, and other Linux distributions should also have a package
c21d2cbe
OB
1005available through their respective package manager.
1006
c43c999f
TL
1007NOTE: Unlike corosync itself, a QDevice connects to the cluster over TCP/IP.
1008The daemon can also run outside the LAN of the cluster and isn't limited to the
1009low latencies requirements of corosync.
c21d2cbe
OB
1010
1011Supported Setups
1012~~~~~~~~~~~~~~~~
1013
1014We support QDevices for clusters with an even number of nodes and recommend
1015it for 2 node clusters, if they should provide higher availability.
a37d539f
DW
1016For clusters with an odd node count, we currently discourage the use of
1017QDevices. The reason for this is the difference in the votes which the QDevice
1018provides for each cluster type. Even numbered clusters get a single additional
1019vote, which only increases availability, because if the QDevice
1020itself fails, you are in the same position as with no QDevice at all.
1021
1022On the other hand, with an odd numbered cluster size, the QDevice provides
1023'(N-1)' votes -- where 'N' corresponds to the cluster node count. This
1024alternative behavior makes sense; if it had only one additional vote, the
1025cluster could get into a split-brain situation. This algorithm allows for all
1026nodes but one (and naturally the QDevice itself) to fail. However, there are two
1027drawbacks to this:
c21d2cbe
OB
1028
1029* If the QNet daemon itself fails, no other node may fail or the cluster
a37d539f 1030 immediately loses quorum. For example, in a cluster with 15 nodes, 7
c21d2cbe 1031 could fail before the cluster becomes inquorate. But, if a QDevice is
a37d539f
DW
1032 configured here and it itself fails, **no single node** of the 15 may fail.
1033 The QDevice acts almost as a single point of failure in this case.
c21d2cbe 1034
a37d539f
DW
1035* The fact that all but one node plus QDevice may fail sounds promising at
1036 first, but this may result in a mass recovery of HA services, which could
1037 overload the single remaining node. Furthermore, a Ceph server will stop
1038 providing services if only '((N-1)/2)' nodes or less remain online.
c21d2cbe 1039
a37d539f
DW
1040If you understand the drawbacks and implications, you can decide yourself if
1041you want to use this technology in an odd numbered cluster setup.
c21d2cbe 1042
c21d2cbe
OB
1043QDevice-Net Setup
1044~~~~~~~~~~~~~~~~~
1045
a37d539f 1046We recommend running any daemon which provides votes to corosync-qdevice as an
7c039095 1047unprivileged user. {pve} and Debian provide a package which is already
e34c3e91 1048configured to do so.
c21d2cbe 1049The traffic between the daemon and the cluster must be encrypted to ensure a
a37d539f 1050safe and secure integration of the QDevice in {pve}.
c21d2cbe 1051
41a37193
DJ
1052First, install the 'corosync-qnetd' package on your external server
1053
1054----
1055external# apt install corosync-qnetd
1056----
1057
1058and the 'corosync-qdevice' package on all cluster nodes
1059
1060----
1061pve# apt install corosync-qdevice
1062----
c21d2cbe 1063
a37d539f 1064After doing this, ensure that all the nodes in the cluster are online.
c21d2cbe 1065
a37d539f 1066You can now set up your QDevice by running the following command on one
c21d2cbe
OB
1067of the {pve} nodes:
1068
1069----
1070pve# pvecm qdevice setup <QDEVICE-IP>
1071----
1072
1b80fbaa
DJ
1073The SSH key from the cluster will be automatically copied to the QDevice.
1074
f358b686
FG
1075NOTE: Make sure to setup key-based access for the root user on your external
1076server, or temporarily allow root login with password during the setup phase.
16162db8
OB
1077If you receive an error such as 'Host key verification failed.' at this
1078stage, running `pvecm updatecerts` could fix the issue.
c21d2cbe 1079
f358b686
FG
1080After all the steps have successfully completed, you will see "Done". You can
1081verify that the QDevice has been set up with:
c21d2cbe
OB
1082
1083----
1084pve# pvecm status
1085
1086...
1087
1088Votequorum information
1089~~~~~~~~~~~~~~~~~~~~~
1090Expected votes: 3
1091Highest expected: 3
1092Total votes: 3
1093Quorum: 2
1094Flags: Quorate Qdevice
1095
1096Membership information
1097~~~~~~~~~~~~~~~~~~~~~~
1098 Nodeid Votes Qdevice Name
50063cd7
AL
1099 0x00000001 1 A,V,NMW 192.168.22.180 (local)
1100 0x00000002 1 A,V,NMW 192.168.22.181
1101 0x00000000 1 Qdevice
c21d2cbe
OB
1102
1103----
1104
e0c04208
AL
1105[[pvecm_qdevice_status_flags]]
1106QDevice Status Flags
1107^^^^^^^^^^^^^^^^^^^^
1108
1109The status output of the QDevice, as seen above, will usually contain three
1110columns:
1111
1112* `A` / `NA`: Alive or Not Alive. Indicates if the communication to the external
9608e5b1 1113 `corosync-qnetd` daemon works.
e0c04208
AL
1114* `V` / `NV`: If the QDevice will cast a vote for the node. In a split-brain
1115 situation, where the corosync connection between the nodes is down, but they
1116 both can still communicate with the external `corosync-qnetd` daemon,
1117 only one node will get the vote.
1118* `MW` / `NMW`: Master wins (`MV`) or not (`NMW`). Default is `NMW`, see
1119 footnote:[`votequorum_qdevice_master_wins` manual page
1120 https://manpages.debian.org/bookworm/libvotequorum-dev/votequorum_qdevice_master_wins.3.en.html].
1121* `NR`: QDevice is not registered.
1122
508a36f5
FG
1123NOTE: If your QDevice is listed as `Not Alive` (`NA` in the output above),
1124ensure that port `5403` (the default port of the qnetd server) of your external
1125server is reachable via TCP/IP!
1126
c21d2cbe 1127
c21d2cbe
OB
1128Frequently Asked Questions
1129~~~~~~~~~~~~~~~~~~~~~~~~~~
1130
1131Tie Breaking
1132^^^^^^^^^^^^
1133
00821894 1134In case of a tie, where two same-sized cluster partitions cannot see each other
a37d539f
DW
1135but can see the QDevice, the QDevice chooses one of those partitions randomly
1136and provides a vote to it.
c21d2cbe 1137
d31de328
TL
1138Possible Negative Implications
1139^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1140
a37d539f
DW
1141For clusters with an even node count, there are no negative implications when
1142using a QDevice. If it fails to work, it is the same as not having a QDevice
1143at all.
d31de328 1144
870c2817
OB
1145Adding/Deleting Nodes After QDevice Setup
1146^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
d31de328
TL
1147
1148If you want to add a new node or remove an existing one from a cluster with a
00821894
TL
1149QDevice setup, you need to remove the QDevice first. After that, you can add or
1150remove nodes normally. Once you have a cluster with an even node count again,
a37d539f 1151you can set up the QDevice again as described previously.
870c2817
OB
1152
1153Removing the QDevice
1154^^^^^^^^^^^^^^^^^^^^
1155
00821894 1156If you used the official `pvecm` tool to add the QDevice, you can remove it
a37d539f 1157by running:
870c2817
OB
1158
1159----
1160pve# pvecm qdevice remove
1161----
d31de328 1162
51730d56
TL
1163//Still TODO
1164//^^^^^^^^^^
a9e7c3aa 1165//There is still stuff to add here
c21d2cbe
OB
1166
1167
e4ec4154
TL
1168Corosync Configuration
1169----------------------
1170
a9e7c3aa
SR
1171The `/etc/pve/corosync.conf` file plays a central role in a {pve} cluster. It
1172controls the cluster membership and its network.
1173For further information about it, check the corosync.conf man page:
e4ec4154 1174[source,bash]
4d19cb00 1175----
e4ec4154 1176man corosync.conf
4d19cb00 1177----
e4ec4154 1178
a37d539f 1179For node membership, you should always use the `pvecm` tool provided by {pve}.
e4ec4154
TL
1180You may have to edit the configuration file manually for other changes.
1181Here are a few best practice tips for doing this.
1182
3254bfdd 1183[[pvecm_edit_corosync_conf]]
e4ec4154
TL
1184Edit corosync.conf
1185~~~~~~~~~~~~~~~~~~
1186
a9e7c3aa
SR
1187Editing the corosync.conf file is not always very straightforward. There are
1188two on each cluster node, one in `/etc/pve/corosync.conf` and the other in
e4ec4154
TL
1189`/etc/corosync/corosync.conf`. Editing the one in our cluster file system will
1190propagate the changes to the local one, but not vice versa.
1191
a37d539f
DW
1192The configuration will get updated automatically, as soon as the file changes.
1193This means that changes which can be integrated in a running corosync will take
1194effect immediately. Thus, you should always make a copy and edit that instead,
1195to avoid triggering unintended changes when saving the file while editing.
e4ec4154
TL
1196
1197[source,bash]
4d19cb00 1198----
e4ec4154 1199cp /etc/pve/corosync.conf /etc/pve/corosync.conf.new
4d19cb00 1200----
e4ec4154 1201
a37d539f
DW
1202Then, open the config file with your favorite editor, such as `nano` or
1203`vim.tiny`, which come pre-installed on every {pve} node.
e4ec4154 1204
a37d539f 1205NOTE: Always increment the 'config_version' number after configuration changes;
e4ec4154
TL
1206omitting this can lead to problems.
1207
a37d539f 1208After making the necessary changes, create another copy of the current working
e4ec4154 1209configuration file. This serves as a backup if the new configuration fails to
a37d539f 1210apply or causes other issues.
e4ec4154
TL
1211
1212[source,bash]
4d19cb00 1213----
e4ec4154 1214cp /etc/pve/corosync.conf /etc/pve/corosync.conf.bak
4d19cb00 1215----
e4ec4154 1216
a37d539f 1217Then replace the old configuration file with the new one:
e4ec4154 1218[source,bash]
4d19cb00 1219----
e4ec4154 1220mv /etc/pve/corosync.conf.new /etc/pve/corosync.conf
4d19cb00 1221----
e4ec4154 1222
a37d539f
DW
1223You can check if the changes could be applied automatically, using the following
1224commands:
e4ec4154 1225[source,bash]
4d19cb00 1226----
e4ec4154
TL
1227systemctl status corosync
1228journalctl -b -u corosync
4d19cb00 1229----
e4ec4154 1230
a37d539f 1231If the changes could not be applied automatically, you may have to restart the
e4ec4154
TL
1232corosync service via:
1233[source,bash]
4d19cb00 1234----
e4ec4154 1235systemctl restart corosync
4d19cb00 1236----
e4ec4154 1237
a37d539f 1238On errors, check the troubleshooting section below.
e4ec4154
TL
1239
1240Troubleshooting
1241~~~~~~~~~~~~~~~
1242
1243Issue: 'quorum.expected_votes must be configured'
1244^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1245
1246When corosync starts to fail and you get the following message in the system log:
1247
1248----
1249[...]
1250corosync[1647]: [QUORUM] Quorum provider: corosync_votequorum failed to initialize.
1251corosync[1647]: [SERV ] Service engine 'corosync_quorum' failed to load for reason
1252 'configuration error: nodelist or quorum.expected_votes must be configured!'
1253[...]
1254----
1255
a37d539f 1256It means that the hostname you set for a corosync 'ringX_addr' in the
e4ec4154
TL
1257configuration could not be resolved.
1258
e4ec4154
TL
1259Write Configuration When Not Quorate
1260^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1261
a37d539f
DW
1262If you need to change '/etc/pve/corosync.conf' on a node with no quorum, and you
1263understand what you are doing, use:
e4ec4154 1264[source,bash]
4d19cb00 1265----
e4ec4154 1266pvecm expected 1
4d19cb00 1267----
e4ec4154
TL
1268
1269This sets the expected vote count to 1 and makes the cluster quorate. You can
a37d539f 1270then fix your configuration, or revert it back to the last working backup.
e4ec4154 1271
a37d539f
DW
1272This is not enough if corosync cannot start anymore. In that case, it is best to
1273edit the local copy of the corosync configuration in
1274'/etc/corosync/corosync.conf', so that corosync can start again. Ensure that on
1275all nodes, this configuration has the same content to avoid split-brain
1276situations.
e4ec4154
TL
1277
1278
3254bfdd 1279[[pvecm_corosync_conf_glossary]]
e4ec4154
TL
1280Corosync Configuration Glossary
1281~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1282
1283ringX_addr::
a37d539f 1284This names the different link addresses for the Kronosnet connections between
a9e7c3aa 1285nodes.
e4ec4154 1286
806ef12d
DM
1287
1288Cluster Cold Start
1289------------------
1290
1291It is obvious that a cluster is not quorate when all nodes are
1292offline. This is a common case after a power failure.
1293
1294NOTE: It is always a good idea to use an uninterruptible power supply
8c1189b6 1295(``UPS'', also called ``battery backup'') to avoid this state, especially if
806ef12d
DM
1296you want HA.
1297
204231df 1298On node startup, the `pve-guests` service is started and waits for
8c1189b6 1299quorum. Once quorate, it starts all guests which have the `onboot`
612417fd
DM
1300flag set.
1301
1302When you turn on nodes, or when power comes back after power failure,
a37d539f 1303it is likely that some nodes will boot faster than others. Please keep in
612417fd 1304mind that guest startup is delayed until you reach quorum.
806ef12d 1305
054a7e7d 1306
eee1c5de
TL
1307[[pvecm_next_id_range]]
1308Guest VMID Auto-Selection
1309------------------------
1310
1311When creating new guests the web interface will ask the backend for a free VMID
1312automatically. The default range for searching is `100` to `1000000` (lower
1313than the maximal allowed VMID enforced by the schema).
1314
1315Sometimes admins either want to allocate new VMIDs in a separate range, for
1316example to easily separate temporary VMs with ones that choose a VMID manually.
1317Other times its just desired to provided a stable length VMID, for which
1318setting the lower boundary to, for example, `100000` gives much more room for.
1319
1320To accommodate this use case one can set either lower, upper or both boundaries
1321via the `datacenter.cfg` configuration file, which can be edited in the web
1322interface under 'Datacenter' -> 'Options'.
1323
1324NOTE: The range is only used for the next-id API call, so it isn't a hard
1325limit.
1326
082ea7d9
TL
1327Guest Migration
1328---------------
1329
054a7e7d
DM
1330Migrating virtual guests to other nodes is a useful feature in a
1331cluster. There are settings to control the behavior of such
1332migrations. This can be done via the configuration file
ff4ae052 1333`datacenter.cfg` or for a specific migration via API or command-line
054a7e7d
DM
1334parameters.
1335
a37d539f 1336It makes a difference if a guest is online or offline, or if it has
da6c7dee
DC
1337local resources (like a local disk).
1338
a37d539f 1339For details about virtual machine migration, see the
a9e7c3aa 1340xref:qm_migration[QEMU/KVM Migration Chapter].
da6c7dee 1341
a37d539f 1342For details about container migration, see the
a9e7c3aa 1343xref:pct_migration[Container Migration Chapter].
082ea7d9
TL
1344
1345Migration Type
1346~~~~~~~~~~~~~~
1347
44f38275 1348The migration type defines if the migration data should be sent over an
d63be10b 1349encrypted (`secure`) channel or an unencrypted (`insecure`) one.
da0c6793 1350Setting the migration type to `insecure` means that the RAM content of a
a37d539f 1351virtual guest is also transferred unencrypted, which can lead to
b1743473 1352information disclosure of critical data from inside the guest (for
a37d539f 1353example, passwords or encryption keys).
054a7e7d
DM
1354
1355Therefore, we strongly recommend using the secure channel if you do
1356not have full control over the network and can not guarantee that no
6d3c0b34 1357one is eavesdropping on it.
082ea7d9 1358
054a7e7d
DM
1359NOTE: Storage migration does not follow this setting. Currently, it
1360always sends the storage content over a secure channel.
1361
1362Encryption requires a lot of computing power, so this setting is often
da0c6793 1363changed to `insecure` to achieve better performance. The impact on
054a7e7d 1364modern systems is lower because they implement AES encryption in
b1743473 1365hardware. The performance impact is particularly evident in fast
a37d539f 1366networks, where you can transfer 10 Gbps or more.
082ea7d9 1367
082ea7d9
TL
1368Migration Network
1369~~~~~~~~~~~~~~~~~
1370
a9baa444 1371By default, {pve} uses the network in which cluster communication
a37d539f 1372takes place to send the migration traffic. This is not optimal both because
a9baa444
TL
1373sensitive cluster traffic can be disrupted and this network may not
1374have the best bandwidth available on the node.
1375
1376Setting the migration network parameter allows the use of a dedicated
a37d539f 1377network for all migration traffic. In addition to the memory,
a9baa444
TL
1378this also affects the storage traffic for offline migrations.
1379
a37d539f
DW
1380The migration network is set as a network using CIDR notation. This
1381has the advantage that you don't have to set individual IP addresses
1382for each node. {pve} can determine the real address on the
1383destination node from the network specified in the CIDR form. To
1384enable this, the network must be specified so that each node has exactly one
1385IP in the respective network.
a9baa444 1386
082ea7d9
TL
1387Example
1388^^^^^^^
1389
a37d539f 1390We assume that we have a three-node setup, with three separate
a9baa444 1391networks. One for public communication with the Internet, one for
a37d539f 1392cluster communication, and a very fast one, which we want to use as a
a9baa444
TL
1393dedicated network for migration.
1394
1395A network configuration for such a setup might look as follows:
082ea7d9
TL
1396
1397----
7a0d4784 1398iface eno1 inet manual
082ea7d9
TL
1399
1400# public network
1401auto vmbr0
1402iface vmbr0 inet static
8673c878 1403 address 192.X.Y.57/24
082ea7d9 1404 gateway 192.X.Y.1
7a39aabd
AL
1405 bridge-ports eno1
1406 bridge-stp off
1407 bridge-fd 0
082ea7d9
TL
1408
1409# cluster network
7a0d4784
WL
1410auto eno2
1411iface eno2 inet static
8673c878 1412 address 10.1.1.1/24
082ea7d9
TL
1413
1414# fast network
7a0d4784
WL
1415auto eno3
1416iface eno3 inet static
8673c878 1417 address 10.1.2.1/24
082ea7d9
TL
1418----
1419
a9baa444
TL
1420Here, we will use the network 10.1.2.0/24 as a migration network. For
1421a single migration, you can do this using the `migration_network`
ff4ae052 1422parameter of the command-line tool:
a9baa444 1423
082ea7d9 1424----
b1743473 1425# qm migrate 106 tre --online --migration_network 10.1.2.0/24
082ea7d9
TL
1426----
1427
a9baa444
TL
1428To configure this as the default network for all migrations in the
1429cluster, set the `migration` property of the `/etc/pve/datacenter.cfg`
1430file:
1431
082ea7d9 1432----
a9baa444 1433# use dedicated migration network
b1743473 1434migration: secure,network=10.1.2.0/24
082ea7d9
TL
1435----
1436
a9baa444 1437NOTE: The migration type must always be set when the migration network
a37d539f 1438is set in `/etc/pve/datacenter.cfg`.
a9baa444 1439
806ef12d 1440
d8742b0c
DM
1441ifdef::manvolnum[]
1442include::pve-copyright.adoc[]
1443endif::manvolnum[]