]> git.proxmox.com Git - pve-docs.git/blobdiff - pvecm.adoc
vzdump: drop overly scary & outdated warning about fleecing
[pve-docs.git] / pvecm.adoc
index 547a0138666b10595ead5e3173bd3c3959c338a5..5117eaa90ca2139737c729c7e90ffb7217f0c770 100644 (file)
@@ -24,7 +24,7 @@ Cluster Manager
 :pve-toplevel:
 endif::manvolnum[]
 
-The {PVE} cluster manager `pvecm` is a tool to create a group of
+The {pve} cluster manager `pvecm` is a tool to create a group of
 physical servers. Such a group is called a *cluster*. We use the
 http://www.corosync.org[Corosync Cluster Engine] for reliable group
 communication. There's no explicit limit for the number of nodes in a cluster.
@@ -58,7 +58,7 @@ Grouping nodes into a cluster has the following advantages:
 Requirements
 ------------
 
-* All nodes must be able to connect to each other via UDP ports 5404 and 5405
+* All nodes must be able to connect to each other via UDP ports 5405-5412
  for corosync to work.
 
 * Date and time must be synchronized.
@@ -74,6 +74,9 @@ Requirements
 
 * The root password of a cluster node is required for adding nodes.
 
+* Online migration of virtual machines is only supported when nodes have CPUs
+  from the same vendor. It might work otherwise, but this is never guaranteed.
+
 NOTE: It is not possible to mix {pve} 3.x and earlier with {pve} 4.X cluster
 nodes.
 
@@ -90,7 +93,7 @@ upgrade procedure to {pve} 6.0.
 Preparing Nodes
 ---------------
 
-First, install {PVE} on all nodes. Make sure that each node is
+First, install {pve} on all nodes. Make sure that each node is
 installed with the final hostname and IP configuration. Changing the
 hostname and IP is not possible after cluster creation.
 
@@ -123,9 +126,11 @@ name and select a network connection from the drop-down list to serve as the
 main cluster network (Link 0). It defaults to the IP resolved via the node's
 hostname.
 
-To add a second link as fallback, you can select the 'Advanced' checkbox and
-choose an additional network interface (Link 1, see also
-xref:pvecm_redundancy[Corosync Redundancy]).
+As of {pve} 6.2, up to 8 fallback links can be added to a cluster. To add a
+redundant link, click the 'Add' button and select a link number and IP address
+from the respective fields. Prior to {pve} 6.2, to add a second link as
+fallback, you can select the 'Advanced' checkbox and choose an additional
+network interface (Link 1, see also xref:pvecm_redundancy[Corosync Redundancy]).
 
 NOTE: Ensure that the network selected for cluster communication is not used for
 any high traffic purposes, like network storage or live-migration.
@@ -167,11 +172,14 @@ infrastructure for bigger clusters.
 Adding Nodes to the Cluster
 ---------------------------
 
-CAUTION: A node that is about to be added to the cluster cannot hold any guests.
-All existing configuration in `/etc/pve` is overwritten when joining a cluster,
-since guest IDs could otherwise conflict. As a workaround, you can create a
-backup of the guest (`vzdump`) and restore it under a different ID, after the
-node has been added to the cluster.
+CAUTION: All existing configuration in `/etc/pve` is overwritten when joining a
+cluster. In particular, a joining node cannot hold any guests, since guest IDs
+could otherwise conflict, and the node will inherit the cluster's storage
+configuration. To join a node with existing guest, as a workaround, you can
+create a backup of each guest (using `vzdump`) and restore it under a different
+ID after joining. If the node's storage layout differs, you will need to re-add
+the node's storages, and adapt each storage's node restriction to reflect on
+which nodes the storage is actually available.
 
 Join Node to Cluster via GUI
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -210,7 +218,7 @@ Join Node to Cluster via Command Line
 Log in to the node you want to join into an existing cluster via `ssh`.
 
 ----
hp2# pvecm add IP-ADDRESS-CLUSTER
+ # pvecm add IP-ADDRESS-CLUSTER
 ----
 
 For `IP-ADDRESS-CLUSTER`, use the IP or hostname of an existing cluster node.
@@ -225,14 +233,21 @@ To check the state of the cluster use:
 
 .Cluster status after adding 4 nodes
 ----
-hp2# pvecm status
+ # pvecm status
+Cluster information
+~~~~~~~~~~~~~~~~~~~
+Name:             prod-central
+Config Version:   3
+Transport:        knet
+Secure auth:      on
+
 Quorum information
 ~~~~~~~~~~~~~~~~~~
-Date:             Mon Apr 20 12:30:13 2015
+Date:             Tue Sep 14 11:06:47 2021
 Quorum provider:  corosync_votequorum
 Nodes:            4
 Node ID:          0x00000001
-Ring ID:          1/8
+Ring ID:          1.1a8
 Quorate:          Yes
 
 Votequorum information
@@ -260,7 +275,7 @@ If you only want a list of all nodes, use:
 
 .List nodes in a cluster
 ----
-hp2# pvecm nodes
+ # pvecm nodes
 
 Membership information
 ~~~~~~~~~~~~~~~~~~~~~~
@@ -280,7 +295,7 @@ use the 'link0' parameter to set the nodes address on that network:
 
 [source,bash]
 ----
-pvecm add IP-ADDRESS-CLUSTER -link0 LOCAL-IP-ADDRESS-LINK0
+# pvecm add IP-ADDRESS-CLUSTER --link0 LOCAL-IP-ADDRESS-LINK0
 ----
 
 If you want to use the built-in xref:pvecm_redundancy[redundancy] of the
@@ -295,15 +310,23 @@ Remove a Cluster Node
 CAUTION: Read the procedure carefully before proceeding, as it may
 not be what you want or need.
 
-Move all virtual machines from the node. Make sure you have made copies of any
-local data or backups that you want to keep. In the following example, we will
-remove the node hp4 from the cluster.
+Move all virtual machines from the node. Ensure that you have made copies of any
+local data or backups that you want to keep. In addition, make sure to remove
+any scheduled replication jobs to the node to be removed.
+
+CAUTION: Failure to remove replication jobs to a node before removing said node
+will result in the replication job becoming irremovable. Especially note that
+replication automatically switches direction if a replicated VM is migrated, so
+by migrating a replicated VM from a node to be deleted, replication jobs will be
+set up to that node automatically.
+
+In the following example, we will remove the node hp4 from the cluster.
 
 Log in to a *different* cluster node (not hp4), and issue a `pvecm nodes`
 command to identify the node ID to remove:
 
 ----
-hp1# pvecm nodes
+ hp1# pvecm nodes
 
 Membership information
 ~~~~~~~~~~~~~~~~~~~~~~
@@ -331,20 +354,18 @@ After powering off the node hp4, we can safely remove it from the cluster.
  Killing node 4
 ----
 
+NOTE: At this point, it is possible that you will receive an error message
+stating `Could not kill node (error = CS_ERR_NOT_EXIST)`. This does not
+signify an actual failure in the deletion of the node, but rather a failure in
+corosync trying to kill an offline node. Thus, it can be safely ignored.
+
 Use `pvecm nodes` or `pvecm status` to check the node list again. It should
 look something like:
 
 ----
 hp1# pvecm status
 
-Quorum information
-~~~~~~~~~~~~~~~~~~
-Date:             Mon Apr 20 12:44:28 2015
-Quorum provider:  corosync_votequorum
-Nodes:            3
-Node ID:          0x00000001
-Ring ID:          1/8
-Quorate:          Yes
+...
 
 Votequorum information
 ~~~~~~~~~~~~~~~~~~~~~~
@@ -369,6 +390,10 @@ you have to:
 
 * then join it, as explained in the previous section.
 
+The configuration files for the removed node will still reside in
+'/etc/pve/nodes/hp4'. Recover any configuration you still need and remove the
+directory afterwards.
+
 NOTE: After removal of the node, its SSH fingerprint will still reside in the
 'known_hosts' of the other nodes. If you receive an SSH error after rejoining
 a node with the same IP or hostname, run `pvecm updatecerts` once on the
@@ -493,11 +518,18 @@ file system (`pmxcfs`).
 [[pvecm_cluster_network_requirements]]
 Network Requirements
 ~~~~~~~~~~~~~~~~~~~~
-This needs a reliable network with latencies under 2 milliseconds (LAN
-performance) to work properly. The network should not be used heavily by other
-members; ideally corosync runs on its own network. Do not use a shared network
-for corosync and storage (except as a potential low-priority fallback in a
-xref:pvecm_redundancy[redundant] configuration).
+
+The {pve} cluster stack requires a reliable network with latencies under 5
+milliseconds (LAN performance) between all nodes to operate stably. While on
+setups with a small node count a network with higher latencies _may_ work, this
+is not guaranteed and gets rather unlikely with more than three nodes and
+latencies above around 10 ms.
+
+The network should not be used heavily by other members, as while corosync does
+not uses much bandwidth it is sensitive to latency jitters; ideally corosync
+runs on its own physically separated network.  Especially do not use a shared
+network for corosync and storage (except as a potential low-priority fallback
+in a xref:pvecm_redundancy[redundant] configuration).
 
 Before setting up a cluster, it is good practice to check if the network is fit
 for that purpose. To ensure that the nodes can connect to each other on the
@@ -629,7 +661,7 @@ hostnames, ensure that they are resolvable from all nodes (see also
 xref:pvecm_corosync_addresses[Link Address Types]).
 
 In this example, we want to switch cluster communication to the
-10.10.10.1/25 network, so we change the 'ring0_addr' of each node respectively.
+10.10.10.0/25 network, so we change the 'ring0_addr' of each node respectively.
 
 NOTE: The exact same procedure can be used to change other 'ringX_addr' values
 as well. However, we recommend only changing one link address at a time, so
@@ -871,10 +903,10 @@ pvecm status
 If you see a healthy cluster state, it means that your new link is being used.
 
 
-Role of SSH in {PVE} Clusters
+Role of SSH in {pve} Clusters
 -----------------------------
 
-{PVE} utilizes SSH tunnels for various features.
+{pve} utilizes SSH tunnels for various features.
 
 * Proxying console/shell sessions (node and guests)
 +
@@ -890,9 +922,27 @@ transfer memory and disk contents.
 
 * Storage replication
 
-.Pitfalls due to automatic execution of `.bashrc` and siblings
-[IMPORTANT]
-====
+SSH setup
+~~~~~~~~~
+
+On {pve} systems, the following changes are made to the SSH configuration/setup:
+
+* the `root` user's SSH client config gets setup to prefer `AES` over `ChaCha20`
+
+* the `root` user's `authorized_keys` file gets linked to
+  `/etc/pve/priv/authorized_keys`, merging all authorized keys within a cluster
+
+* `sshd` is configured to allow logging in as root with a password
+
+NOTE: Older systems might also have `/etc/ssh/ssh_known_hosts` set up as symlink
+pointing to `/etc/pve/priv/known_hosts`, containing a merged version of all
+node host keys. This system was replaced with explicit host key pinning in
+`pve-cluster <<INSERT VERSION>>`, the symlink can be deconfigured if still in
+place by running `pvecm updatecerts --unmerge-known-hosts`.
+
+Pitfalls due to automatic execution of `.bashrc` and siblings
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
 In case you have a custom `.bashrc`, or similar files that get executed on
 login by the configured shell, `ssh` will automatically run it once the session
 is established successfully. This can cause some unexpected behavior, as those
@@ -912,8 +962,6 @@ case $- in
       *) return;;
 esac
 ----
-====
-
 
 Corosync External Vote Support
 ------------------------------
@@ -956,9 +1004,9 @@ the cluster and to have a corosync-qnetd package available. We provide a package
 for Debian based hosts, and other Linux distributions should also have a package
 available through their respective package manager.
 
-NOTE: In contrast to corosync itself, a QDevice connects to the cluster over
-TCP/IP. The daemon may even run outside of the cluster's LAN and can have longer
-latencies than 2 ms.
+NOTE: Unlike corosync itself, a QDevice connects to the cluster over TCP/IP.
+The daemon can also run outside the LAN of the cluster and isn't limited to the
+low latencies requirements of corosync.
 
 Supported Setups
 ~~~~~~~~~~~~~~~~
@@ -1024,11 +1072,13 @@ pve# pvecm qdevice setup <QDEVICE-IP>
 
 The SSH key from the cluster will be automatically copied to the QDevice.
 
-NOTE: Make sure that the SSH configuration on your external server allows root
-login via password, if you are asked for a password during this step.
+NOTE: Make sure to setup key-based access for the root user on your external
+server, or temporarily allow root login with password during the setup phase.
+If you receive an error such as 'Host key verification failed.' at this
+stage, running `pvecm updatecerts` could fix the issue.
 
-After you enter the password and all the steps have successfully completed, you
-will see "Done". You can verify that the QDevice has been set up with:
+After all the steps have successfully completed, you will see "Done". You can
+verify that the QDevice has been set up with:
 
 ----
 pve# pvecm status
@@ -1046,12 +1096,34 @@ Flags:            Quorate Qdevice
 Membership information
 ~~~~~~~~~~~~~~~~~~~~~~
     Nodeid      Votes    Qdevice Name
-    0x00000001          1    A,V,NMW 192.168.22.180 (local)
-    0x00000002          1    A,V,NMW 192.168.22.181
-    0x00000000          1            Qdevice
+    0x00000001      1    A,V,NMW 192.168.22.180 (local)
+    0x00000002      1    A,V,NMW 192.168.22.181
+    0x00000000      1            Qdevice
 
 ----
 
+[[pvecm_qdevice_status_flags]]
+QDevice Status Flags
+^^^^^^^^^^^^^^^^^^^^
+
+The status output of the QDevice, as seen above, will usually contain three
+columns:
+
+* `A` / `NA`: Alive or Not Alive. Indicates if the communication to the external
+    `corosync-qnetd` daemon works.
+* `V` / `NV`: If the QDevice will cast a vote for the node. In a split-brain
+    situation, where the corosync connection between the nodes is down, but they
+    both can still communicate with the external `corosync-qnetd` daemon,
+    only one node will get the vote.
+* `MW` / `NMW`: Master wins (`MV`) or not (`NMW`). Default is `NMW`, see
+   footnote:[`votequorum_qdevice_master_wins` manual page
+   https://manpages.debian.org/bookworm/libvotequorum-dev/votequorum_qdevice_master_wins.3.en.html].
+* `NR`: QDevice is not registered.
+
+NOTE: If your QDevice is listed as `Not Alive` (`NA` in the output above),
+ensure that port `5403` (the default port of the qnetd server) of your external
+server is reachable via TCP/IP!
+
 
 Frequently Asked Questions
 ~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -1232,13 +1304,33 @@ it is likely that some nodes will boot faster than others. Please keep in
 mind that guest startup is delayed until you reach quorum.
 
 
+[[pvecm_next_id_range]]
+Guest VMID Auto-Selection
+------------------------
+
+When creating new guests the web interface will ask the backend for a free VMID
+automatically. The default range for searching is `100` to `1000000` (lower
+than the maximal allowed VMID enforced by the schema).
+
+Sometimes admins either want to allocate new VMIDs in a separate range, for
+example to easily separate temporary VMs with ones that choose a VMID manually.
+Other times its just desired to provided a stable length VMID, for which
+setting the lower boundary to, for example, `100000` gives much more room for.
+
+To accommodate this use case one can set either lower, upper or both boundaries
+via the `datacenter.cfg` configuration file, which can be edited in the web
+interface under 'Datacenter' -> 'Options'.
+
+NOTE: The range is only used for the next-id API call, so it isn't a hard
+limit.
+
 Guest Migration
 ---------------
 
 Migrating virtual guests to other nodes is a useful feature in a
 cluster. There are settings to control the behavior of such
 migrations. This can be done via the configuration file
-`datacenter.cfg` or for a specific migration via API or command line
+`datacenter.cfg` or for a specific migration via API or command-line
 parameters.
 
 It makes a difference if a guest is online or offline, or if it has
@@ -1255,7 +1347,7 @@ Migration Type
 
 The migration type defines if the migration data should be sent over an
 encrypted (`secure`) channel or an unencrypted (`insecure`) one.
-Setting the migration type to insecure means that the RAM content of a
+Setting the migration type to `insecure` means that the RAM content of a
 virtual guest is also transferred unencrypted, which can lead to
 information disclosure of critical data from inside the guest (for
 example, passwords or encryption keys).
@@ -1268,7 +1360,7 @@ NOTE: Storage migration does not follow this setting. Currently, it
 always sends the storage content over a secure channel.
 
 Encryption requires a lot of computing power, so this setting is often
-changed to "unsafe" to achieve better performance. The impact on
+changed to `insecure` to achieve better performance. The impact on
 modern systems is lower because they implement AES encryption in
 hardware. The performance impact is particularly evident in fast
 networks, where you can transfer 10 Gbps or more.
@@ -1308,8 +1400,7 @@ iface eno1 inet manual
 # public network
 auto vmbr0
 iface vmbr0 inet static
-    address 192.X.Y.57
-    netmask 255.255.250.0
+    address 192.X.Y.57/24
     gateway 192.X.Y.1
     bridge-ports eno1
     bridge-stp off
@@ -1318,19 +1409,17 @@ iface vmbr0 inet static
 # cluster network
 auto eno2
 iface eno2 inet static
-    address  10.1.1.1
-    netmask  255.255.255.0
+    address  10.1.1.1/24
 
 # fast network
 auto eno3
 iface eno3 inet static
-    address  10.1.2.1
-    netmask  255.255.255.0
+    address  10.1.2.1/24
 ----
 
 Here, we will use the network 10.1.2.0/24 as a migration network. For
 a single migration, you can do this using the `migration_network`
-parameter of the command line tool:
+parameter of the command-line tool:
 
 ----
 # qm migrate 106 tre --online --migration_network 10.1.2.0/24