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