You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1300 lines

  1. [[chapter_pvecm]]
  2. ifdef::manvolnum[]
  3. pvecm(1)
  4. ========
  5. :pve-toplevel:
  6. NAME
  7. ----
  8. pvecm - Proxmox VE Cluster Manager
  10. --------
  11. include::pvecm.1-synopsis.adoc[]
  13. -----------
  14. endif::manvolnum[]
  15. ifndef::manvolnum[]
  16. Cluster Manager
  17. ===============
  18. :pve-toplevel:
  19. endif::manvolnum[]
  20. The {PVE} cluster manager `pvecm` is a tool to create a group of
  21. physical servers. Such a group is called a *cluster*. We use the
  22.[Corosync Cluster Engine] for reliable group
  23. communication, and such clusters can consist of up to 32 physical nodes
  24. (probably more, dependent on network latency).
  25. `pvecm` can be used to create a new cluster, join nodes to a cluster,
  26. leave the cluster, get status information and do various other cluster
  27. related tasks. The **P**rox**m**o**x** **C**luster **F**ile **S**ystem (``pmxcfs'')
  28. is used to transparently distribute the cluster configuration to all cluster
  29. nodes.
  30. Grouping nodes into a cluster has the following advantages:
  31. * Centralized, web based management
  32. * Multi-master clusters: each node can do all management tasks
  33. * `pmxcfs`: database-driven file system for storing configuration files,
  34. replicated in real-time on all nodes using `corosync`.
  35. * Easy migration of virtual machines and containers between physical
  36. hosts
  37. * Fast deployment
  38. * Cluster-wide services like firewall and HA
  39. Requirements
  40. ------------
  41. * All nodes must be able to connect to each other via UDP ports 5404 and 5405
  42. for corosync to work.
  43. * Date and time have to be synchronized.
  44. * SSH tunnel on TCP port 22 between nodes is used.
  45. * If you are interested in High Availability, you need to have at
  46. least three nodes for reliable quorum. All nodes should have the
  47. same version.
  48. * We recommend a dedicated NIC for the cluster traffic, especially if
  49. you use shared storage.
  50. * Root password of a cluster node is required for adding nodes.
  51. NOTE: It is not possible to mix {pve} 3.x and earlier with {pve} 4.X cluster
  52. nodes.
  53. NOTE: While it's possible to mix {pve} 4.4 and {pve} 5.0 nodes, doing so is
  54. not supported as production configuration and should only used temporarily
  55. during upgrading the whole cluster from one to another major version.
  56. NOTE: Running a cluster of {pve} 6.x with earlier versions is not possible. The
  57. cluster protocol (corosync) between {pve} 6.x and earlier versions changed
  58. fundamentally. The corosync 3 packages for {pve} 5.4 are only intended for the
  59. upgrade procedure to {pve} 6.0.
  60. Preparing Nodes
  61. ---------------
  62. First, install {PVE} on all nodes. Make sure that each node is
  63. installed with the final hostname and IP configuration. Changing the
  64. hostname and IP is not possible after cluster creation.
  65. While it's common to reference all nodenames and their IPs in `/etc/hosts` (or
  66. make their names resolvable through other means), this is not necessary for a
  67. cluster to work. It may be useful however, as you can then connect from one node
  68. to the other with SSH via the easier to remember node name (see also
  69. xref:pvecm_corosync_addresses[Link Address Types]). Note that we always
  70. recommend to reference nodes by their IP addresses in the cluster configuration.
  71. [[pvecm_create_cluster]]
  72. Create a Cluster
  73. ----------------
  74. You can either create a cluster on the console (login via `ssh`), or through
  75. the API using the {pve} Webinterface (__Datacenter -> Cluster__).
  76. NOTE: Use a unique name for your cluster. This name cannot be changed later.
  77. The cluster name follows the same rules as node names.
  78. [[pvecm_cluster_create_via_gui]]
  79. Create via Web GUI
  80. ~~~~~~~~~~~~~~~~~~
  81. [thumbnail="screenshot/gui-cluster-create.png"]
  82. Under __Datacenter -> Cluster__, click on *Create Cluster*. Enter the cluster
  83. name and select a network connection from the dropdown to serve as the main
  84. cluster network (Link 0). It defaults to the IP resolved via the node's
  85. hostname.
  86. To add a second link as fallback, you can select the 'Advanced' checkbox and
  87. choose an additional network interface (Link 1, see also
  88. xref:pvecm_redundancy[Corosync Redundancy]).
  89. NOTE: Ensure the network selected for the cluster communication is not used for
  90. any high traffic loads like those of (network) storages or live-migration.
  91. While the cluster network itself produces small amounts of data, it is very
  92. sensitive to latency. Check out full
  93. xref:pvecm_cluster_network_requirements[cluster network requirements].
  94. [[pvecm_cluster_create_via_cli]]
  95. Create via Command Line
  96. ~~~~~~~~~~~~~~~~~~~~~~~
  97. Login via `ssh` to the first {pve} node and run the following command:
  98. ----
  99. hp1# pvecm create CLUSTERNAME
  100. ----
  101. To check the state of the new cluster use:
  102. ----
  103. hp1# pvecm status
  104. ----
  105. Multiple Clusters In Same Network
  106. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  107. It is possible to create multiple clusters in the same physical or logical
  108. network. Each such cluster must have a unique name to avoid possible clashes in
  109. the cluster communication stack. This also helps avoid human confusion by making
  110. clusters clearly distinguishable.
  111. While the bandwidth requirement of a corosync cluster is relatively low, the
  112. latency of packages and the package per second (PPS) rate is the limiting
  113. factor. Different clusters in the same network can compete with each other for
  114. these resources, so it may still make sense to use separate physical network
  115. infrastructure for bigger clusters.
  116. [[pvecm_join_node_to_cluster]]
  117. Adding Nodes to the Cluster
  118. ---------------------------
  119. CAUTION: A node that is about to be added to the cluster cannot hold any guests.
  120. All existing configuration in `/etc/pve` is overwritten when joining a cluster,
  121. since guest IDs could be conflicting. As a workaround create a backup of the
  122. guest (`vzdump`) and restore it as a different ID after the node has been added
  123. to the cluster.
  124. Join Node to Cluster via GUI
  125. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  126. [thumbnail="screenshot/gui-cluster-join-information.png"]
  127. Login to the web interface on an existing cluster node. Under __Datacenter ->
  128. Cluster__, click the button *Join Information* at the top. Then, click on the
  129. button *Copy Information*. Alternatively, copy the string from the 'Information'
  130. field manually.
  131. [thumbnail="screenshot/gui-cluster-join.png"]
  132. Next, login to the web interface on the node you want to add.
  133. Under __Datacenter -> Cluster__, click on *Join Cluster*. Fill in the
  134. 'Information' field with the 'Join Information' text you copied earlier.
  135. Most settings required for joining the cluster will be filled out
  136. automatically. For security reasons, the cluster password has to be entered
  137. manually.
  138. NOTE: To enter all required data manually, you can disable the 'Assisted Join'
  139. checkbox.
  140. After clicking the *Join* button, the cluster join process will start
  141. immediately. After the node joined the cluster its current node certificate
  142. will be replaced by one signed from the cluster certificate authority (CA),
  143. that means the current session will stop to work after a few seconds. You might
  144. then need to force-reload the webinterface and re-login with the cluster
  145. credentials.
  146. Now your node should be visible under __Datacenter -> Cluster__.
  147. Join Node to Cluster via Command Line
  148. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  149. Login via `ssh` to the node you want to join into an existing cluster.
  150. ----
  151. hp2# pvecm add IP-ADDRESS-CLUSTER
  152. ----
  153. For `IP-ADDRESS-CLUSTER` use the IP or hostname of an existing cluster node.
  154. An IP address is recommended (see xref:pvecm_corosync_addresses[Link Address Types]).
  155. To check the state of the cluster use:
  156. ----
  157. # pvecm status
  158. ----
  159. .Cluster status after adding 4 nodes
  160. ----
  161. hp2# pvecm status
  162. Quorum information
  163. ~~~~~~~~~~~~~~~~~~
  164. Date: Mon Apr 20 12:30:13 2015
  165. Quorum provider: corosync_votequorum
  166. Nodes: 4
  167. Node ID: 0x00000001
  168. Ring ID: 1/8
  169. Quorate: Yes
  170. Votequorum information
  171. ~~~~~~~~~~~~~~~~~~~~~~
  172. Expected votes: 4
  173. Highest expected: 4
  174. Total votes: 4
  175. Quorum: 3
  176. Flags: Quorate
  177. Membership information
  178. ~~~~~~~~~~~~~~~~~~~~~~
  179. Nodeid Votes Name
  180. 0x00000001 1
  181. 0x00000002 1 (local)
  182. 0x00000003 1
  183. 0x00000004 1
  184. ----
  185. If you only want the list of all nodes use:
  186. ----
  187. # pvecm nodes
  188. ----
  189. .List nodes in a cluster
  190. ----
  191. hp2# pvecm nodes
  192. Membership information
  193. ~~~~~~~~~~~~~~~~~~~~~~
  194. Nodeid Votes Name
  195. 1 1 hp1
  196. 2 1 hp2 (local)
  197. 3 1 hp3
  198. 4 1 hp4
  199. ----
  200. [[pvecm_adding_nodes_with_separated_cluster_network]]
  201. Adding Nodes With Separated Cluster Network
  202. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  203. When adding a node to a cluster with a separated cluster network you need to
  204. use the 'link0' parameter to set the nodes address on that network:
  205. [source,bash]
  206. ----
  208. ----
  209. If you want to use the built-in xref:pvecm_redundancy[redundancy] of the
  210. kronosnet transport layer, also use the 'link1' parameter.
  211. Using the GUI, you can select the correct interface from the corresponding 'Link 0'
  212. and 'Link 1' fields in the *Cluster Join* dialog.
  213. Remove a Cluster Node
  214. ---------------------
  215. CAUTION: Read carefully the procedure before proceeding, as it could
  216. not be what you want or need.
  217. Move all virtual machines from the node. Make sure you have no local
  218. data or backups you want to keep, or save them accordingly.
  219. In the following example we will remove the node hp4 from the cluster.
  220. Log in to a *different* cluster node (not hp4), and issue a `pvecm nodes`
  221. command to identify the node ID to remove:
  222. ----
  223. hp1# pvecm nodes
  224. Membership information
  225. ~~~~~~~~~~~~~~~~~~~~~~
  226. Nodeid Votes Name
  227. 1 1 hp1 (local)
  228. 2 1 hp2
  229. 3 1 hp3
  230. 4 1 hp4
  231. ----
  232. At this point you must power off hp4 and
  233. make sure that it will not power on again (in the network) as it
  234. is.
  235. IMPORTANT: As said above, it is critical to power off the node
  236. *before* removal, and make sure that it will *never* power on again
  237. (in the existing cluster network) as it is.
  238. If you power on the node as it is, your cluster will be screwed up and
  239. it could be difficult to restore a clean cluster state.
  240. After powering off the node hp4, we can safely remove it from the cluster.
  241. ----
  242. hp1# pvecm delnode hp4
  243. ----
  244. If the operation succeeds no output is returned, just check the node
  245. list again with `pvecm nodes` or `pvecm status`. You should see
  246. something like:
  247. ----
  248. hp1# pvecm status
  249. Quorum information
  250. ~~~~~~~~~~~~~~~~~~
  251. Date: Mon Apr 20 12:44:28 2015
  252. Quorum provider: corosync_votequorum
  253. Nodes: 3
  254. Node ID: 0x00000001
  255. Ring ID: 1/8
  256. Quorate: Yes
  257. Votequorum information
  258. ~~~~~~~~~~~~~~~~~~~~~~
  259. Expected votes: 3
  260. Highest expected: 3
  261. Total votes: 3
  262. Quorum: 2
  263. Flags: Quorate
  264. Membership information
  265. ~~~~~~~~~~~~~~~~~~~~~~
  266. Nodeid Votes Name
  267. 0x00000001 1 (local)
  268. 0x00000002 1
  269. 0x00000003 1
  270. ----
  271. If, for whatever reason, you want this server to join the same cluster again,
  272. you have to
  273. * reinstall {pve} on it from scratch
  274. * then join it, as explained in the previous section.
  275. NOTE: After removal of the node, its SSH fingerprint will still reside in the
  276. 'known_hosts' of the other nodes. If you receive an SSH error after rejoining
  277. a node with the same IP or hostname, run `pvecm updatecerts` once on the
  278. re-added node to update its fingerprint cluster wide.
  279. [[pvecm_separate_node_without_reinstall]]
  280. Separate A Node Without Reinstalling
  281. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  282. CAUTION: This is *not* the recommended method, proceed with caution. Use the
  283. above mentioned method if you're unsure.
  284. You can also separate a node from a cluster without reinstalling it from
  285. scratch. But after removing the node from the cluster it will still have
  286. access to the shared storages! This must be resolved before you start removing
  287. the node from the cluster. A {pve} cluster cannot share the exact same
  288. storage with another cluster, as storage locking doesn't work over cluster
  289. boundary. Further, it may also lead to VMID conflicts.
  290. Its suggested that you create a new storage where only the node which you want
  291. to separate has access. This can be a new export on your NFS or a new Ceph
  292. pool, to name a few examples. Its just important that the exact same storage
  293. does not gets accessed by multiple clusters. After setting this storage up move
  294. all data from the node and its VMs to it. Then you are ready to separate the
  295. node from the cluster.
  296. WARNING: Ensure all shared resources are cleanly separated! Otherwise you will
  297. run into conflicts and problems.
  298. First stop the corosync and the pve-cluster services on the node:
  299. [source,bash]
  300. ----
  301. systemctl stop pve-cluster
  302. systemctl stop corosync
  303. ----
  304. Start the cluster filesystem again in local mode:
  305. [source,bash]
  306. ----
  307. pmxcfs -l
  308. ----
  309. Delete the corosync configuration files:
  310. [source,bash]
  311. ----
  312. rm /etc/pve/corosync.conf
  313. rm /etc/corosync/*
  314. ----
  315. You can now start the filesystem again as normal service:
  316. [source,bash]
  317. ----
  318. killall pmxcfs
  319. systemctl start pve-cluster
  320. ----
  321. The node is now separated from the cluster. You can deleted it from a remaining
  322. node of the cluster with:
  323. [source,bash]
  324. ----
  325. pvecm delnode oldnode
  326. ----
  327. If the command failed, because the remaining node in the cluster lost quorum
  328. when the now separate node exited, you may set the expected votes to 1 as a workaround:
  329. [source,bash]
  330. ----
  331. pvecm expected 1
  332. ----
  333. And then repeat the 'pvecm delnode' command.
  334. Now switch back to the separated node, here delete all remaining files left
  335. from the old cluster. This ensures that the node can be added to another
  336. cluster again without problems.
  337. [source,bash]
  338. ----
  339. rm /var/lib/corosync/*
  340. ----
  341. As the configuration files from the other nodes are still in the cluster
  342. filesystem you may want to clean those up too. Remove simply the whole
  343. directory recursive from '/etc/pve/nodes/NODENAME', but check three times that
  344. you used the correct one before deleting it.
  345. CAUTION: The nodes SSH keys are still in the 'authorized_key' file, this means
  346. the nodes can still connect to each other with public key authentication. This
  347. should be fixed by removing the respective keys from the
  348. '/etc/pve/priv/authorized_keys' file.
  349. Quorum
  350. ------
  351. {pve} use a quorum-based technique to provide a consistent state among
  352. all cluster nodes.
  353. [quote, from Wikipedia, Quorum (distributed computing)]
  354. ____
  355. A quorum is the minimum number of votes that a distributed transaction
  356. has to obtain in order to be allowed to perform an operation in a
  357. distributed system.
  358. ____
  359. In case of network partitioning, state changes requires that a
  360. majority of nodes are online. The cluster switches to read-only mode
  361. if it loses quorum.
  362. NOTE: {pve} assigns a single vote to each node by default.
  363. Cluster Network
  364. ---------------
  365. The cluster network is the core of a cluster. All messages sent over it have to
  366. be delivered reliably to all nodes in their respective order. In {pve} this
  367. part is done by corosync, an implementation of a high performance, low overhead
  368. high availability development toolkit. It serves our decentralized
  369. configuration file system (`pmxcfs`).
  370. [[pvecm_cluster_network_requirements]]
  371. Network Requirements
  372. ~~~~~~~~~~~~~~~~~~~~
  373. This needs a reliable network with latencies under 2 milliseconds (LAN
  374. performance) to work properly. The network should not be used heavily by other
  375. members, ideally corosync runs on its own network. Do not use a shared network
  376. for corosync and storage (except as a potential low-priority fallback in a
  377. xref:pvecm_redundancy[redundant] configuration).
  378. Before setting up a cluster, it is good practice to check if the network is fit
  379. for that purpose. To make sure the nodes can connect to each other on the
  380. cluster network, you can test the connectivity between them with the `ping`
  381. tool.
  382. If the {pve} firewall is enabled, ACCEPT rules for corosync will automatically
  383. be generated - no manual action is required.
  384. NOTE: Corosync used Multicast before version 3.0 (introduced in {pve} 6.0).
  385. Modern versions rely on[Kronosnet] for cluster
  386. communication, which, for now, only supports regular UDP unicast.
  387. CAUTION: You can still enable Multicast or legacy unicast by setting your
  388. transport to `udp` or `udpu` in your xref:pvecm_edit_corosync_conf[corosync.conf],
  389. but keep in mind that this will disable all cryptography and redundancy support.
  390. This is therefore not recommended.
  391. Separate Cluster Network
  392. ~~~~~~~~~~~~~~~~~~~~~~~~
  393. When creating a cluster without any parameters the corosync cluster network is
  394. generally shared with the Web UI and the VMs and their traffic. Depending on
  395. your setup, even storage traffic may get sent over the same network. Its
  396. recommended to change that, as corosync is a time critical real time
  397. application.
  398. Setting Up A New Network
  399. ^^^^^^^^^^^^^^^^^^^^^^^^
  400. First you have to set up a new network interface. It should be on a physically
  401. separate network. Ensure that your network fulfills the
  402. xref:pvecm_cluster_network_requirements[cluster network requirements].
  403. Separate On Cluster Creation
  404. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  405. This is possible via the 'linkX' parameters of the 'pvecm create'
  406. command used for creating a new cluster.
  407. If you have set up an additional NIC with a static address on,
  408. and want to send and receive all cluster communication over this interface,
  409. you would execute:
  410. [source,bash]
  411. ----
  412. pvecm create test --link0
  413. ----
  414. To check if everything is working properly execute:
  415. [source,bash]
  416. ----
  417. systemctl status corosync
  418. ----
  419. Afterwards, proceed as described above to
  420. xref:pvecm_adding_nodes_with_separated_cluster_network[add nodes with a separated cluster network].
  421. [[pvecm_separate_cluster_net_after_creation]]
  422. Separate After Cluster Creation
  423. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  424. You can do this if you have already created a cluster and want to switch
  425. its communication to another network, without rebuilding the whole cluster.
  426. This change may lead to short durations of quorum loss in the cluster, as nodes
  427. have to restart corosync and come up one after the other on the new network.
  428. Check how to xref:pvecm_edit_corosync_conf[edit the corosync.conf file] first.
  429. Then, open it and you should see a file similar to:
  430. ----
  431. logging {
  432. debug: off
  433. to_syslog: yes
  434. }
  435. nodelist {
  436. node {
  437. name: due
  438. nodeid: 2
  439. quorum_votes: 1
  440. ring0_addr: due
  441. }
  442. node {
  443. name: tre
  444. nodeid: 3
  445. quorum_votes: 1
  446. ring0_addr: tre
  447. }
  448. node {
  449. name: uno
  450. nodeid: 1
  451. quorum_votes: 1
  452. ring0_addr: uno
  453. }
  454. }
  455. quorum {
  456. provider: corosync_votequorum
  457. }
  458. totem {
  459. cluster_name: testcluster
  460. config_version: 3
  461. ip_version: ipv4-6
  462. secauth: on
  463. version: 2
  464. interface {
  465. linknumber: 0
  466. }
  467. }
  468. ----
  469. NOTE: `ringX_addr` actually specifies a corosync *link address*, the name "ring"
  470. is a remnant of older corosync versions that is kept for backwards
  471. compatibility.
  472. The first thing you want to do is add the 'name' properties in the node entries
  473. if you do not see them already. Those *must* match the node name.
  474. Then replace all addresses from the 'ring0_addr' properties of all nodes with
  475. the new addresses. You may use plain IP addresses or hostnames here. If you use
  476. hostnames ensure that they are resolvable from all nodes. (see also
  477. xref:pvecm_corosync_addresses[Link Address Types])
  478. In this example, we want to switch the cluster communication to the
  479. network. So we replace all 'ring0_addr' respectively.
  480. NOTE: The exact same procedure can be used to change other 'ringX_addr' values
  481. as well, although we recommend to not change multiple addresses at once, to make
  482. it easier to recover if something goes wrong.
  483. After we increase the 'config_version' property, the new configuration file
  484. should look like:
  485. ----
  486. logging {
  487. debug: off
  488. to_syslog: yes
  489. }
  490. nodelist {
  491. node {
  492. name: due
  493. nodeid: 2
  494. quorum_votes: 1
  495. ring0_addr:
  496. }
  497. node {
  498. name: tre
  499. nodeid: 3
  500. quorum_votes: 1
  501. ring0_addr:
  502. }
  503. node {
  504. name: uno
  505. nodeid: 1
  506. quorum_votes: 1
  507. ring0_addr:
  508. }
  509. }
  510. quorum {
  511. provider: corosync_votequorum
  512. }
  513. totem {
  514. cluster_name: testcluster
  515. config_version: 4
  516. ip_version: ipv4-6
  517. secauth: on
  518. version: 2
  519. interface {
  520. linknumber: 0
  521. }
  522. }
  523. ----
  524. Then, after a final check if all changed information is correct, we save it and
  525. once again follow the xref:pvecm_edit_corosync_conf[edit corosync.conf file]
  526. section to bring it into effect.
  527. The changes will be applied live, so restarting corosync is not strictly
  528. necessary. If you changed other settings as well, or notice corosync
  529. complaining, you can optionally trigger a restart.
  530. On a single node execute:
  531. [source,bash]
  532. ----
  533. systemctl restart corosync
  534. ----
  535. Now check if everything is fine:
  536. [source,bash]
  537. ----
  538. systemctl status corosync
  539. ----
  540. If corosync runs again correct restart corosync also on all other nodes.
  541. They will then join the cluster membership one by one on the new network.
  542. [[pvecm_corosync_addresses]]
  543. Corosync addresses
  544. ~~~~~~~~~~~~~~~~~~
  545. A corosync link address (for backwards compatibility denoted by 'ringX_addr' in
  546. `corosync.conf`) can be specified in two ways:
  547. * **IPv4/v6 addresses** will be used directly. They are recommended, since they
  548. are static and usually not changed carelessly.
  549. * **Hostnames** will be resolved using `getaddrinfo`, which means that per
  550. default, IPv6 addresses will be used first, if available (see also
  551. `man gai.conf`). Keep this in mind, especially when upgrading an existing
  552. cluster to IPv6.
  553. CAUTION: Hostnames should be used with care, since the address they
  554. resolve to can be changed without touching corosync or the node it runs on -
  555. which may lead to a situation where an address is changed without thinking
  556. about implications for corosync.
  557. A seperate, static hostname specifically for corosync is recommended, if
  558. hostnames are preferred. Also, make sure that every node in the cluster can
  559. resolve all hostnames correctly.
  560. Since {pve} 5.1, while supported, hostnames will be resolved at the time of
  561. entry. Only the resolved IP is then saved to the configuration.
  562. Nodes that joined the cluster on earlier versions likely still use their
  563. unresolved hostname in `corosync.conf`. It might be a good idea to replace
  564. them with IPs or a seperate hostname, as mentioned above.
  565. [[pvecm_redundancy]]
  566. Corosync Redundancy
  567. -------------------
  568. Corosync supports redundant networking via its integrated kronosnet layer by
  569. default (it is not supported on the legacy udp/udpu transports). It can be
  570. enabled by specifying more than one link address, either via the '--linkX'
  571. parameters of `pvecm`, in the GUI as **Link 1** (while creating a cluster or
  572. adding a new node) or by specifying more than one 'ringX_addr' in
  573. `corosync.conf`.
  574. NOTE: To provide useful failover, every link should be on its own
  575. physical network connection.
  576. Links are used according to a priority setting. You can configure this priority
  577. by setting 'knet_link_priority' in the corresponding interface section in
  578. `corosync.conf`, or, preferrably, using the 'priority' parameter when creating
  579. your cluster with `pvecm`:
  580. ----
  581. # pvecm create CLUSTERNAME --link0,priority=20 --link1,priority=15
  582. ----
  583. This would cause 'link1' to be used first, since it has the lower priority.
  584. If no priorities are configured manually (or two links have the same priority),
  585. links will be used in order of their number, with the lower number having higher
  586. priority.
  587. Even if all links are working, only the one with the highest priority will see
  588. corosync traffic. Link priorities cannot be mixed, i.e. links with different
  589. priorities will not be able to communicate with each other.
  590. Since lower priority links will not see traffic unless all higher priorities
  591. have failed, it becomes a useful strategy to specify even networks used for
  592. other tasks (VMs, storage, etc...) as low-priority links. If worst comes to
  593. worst, a higher-latency or more congested connection might be better than no
  594. connection at all.
  595. Adding Redundant Links To An Existing Cluster
  596. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  597. To add a new link to a running configuration, first check how to
  598. xref:pvecm_edit_corosync_conf[edit the corosync.conf file].
  599. Then, add a new 'ringX_addr' to every node in the `nodelist` section. Make
  600. sure that your 'X' is the same for every node you add it to, and that it is
  601. unique for each node.
  602. Lastly, add a new 'interface', as shown below, to your `totem`
  603. section, replacing 'X' with your link number chosen above.
  604. Assuming you added a link with number 1, the new configuration file could look
  605. like this:
  606. ----
  607. logging {
  608. debug: off
  609. to_syslog: yes
  610. }
  611. nodelist {
  612. node {
  613. name: due
  614. nodeid: 2
  615. quorum_votes: 1
  616. ring0_addr:
  617. ring1_addr:
  618. }
  619. node {
  620. name: tre
  621. nodeid: 3
  622. quorum_votes: 1
  623. ring0_addr:
  624. ring1_addr:
  625. }
  626. node {
  627. name: uno
  628. nodeid: 1
  629. quorum_votes: 1
  630. ring0_addr:
  631. ring1_addr:
  632. }
  633. }
  634. quorum {
  635. provider: corosync_votequorum
  636. }
  637. totem {
  638. cluster_name: testcluster
  639. config_version: 4
  640. ip_version: ipv4-6
  641. secauth: on
  642. version: 2
  643. interface {
  644. linknumber: 0
  645. }
  646. interface {
  647. linknumber: 1
  648. }
  649. }
  650. ----
  651. The new link will be enabled as soon as you follow the last steps to
  652. xref:pvecm_edit_corosync_conf[edit the corosync.conf file]. A restart should not
  653. be necessary. You can check that corosync loaded the new link using:
  654. ----
  655. journalctl -b -u corosync
  656. ----
  657. It might be a good idea to test the new link by temporarily disconnecting the
  658. old link on one node and making sure that its status remains online while
  659. disconnected:
  660. ----
  661. pvecm status
  662. ----
  663. If you see a healthy cluster state, it means that your new link is being used.
  664. Corosync External Vote Support
  665. ------------------------------
  666. This section describes a way to deploy an external voter in a {pve} cluster.
  667. When configured, the cluster can sustain more node failures without
  668. violating safety properties of the cluster communication.
  669. For this to work there are two services involved:
  670. * a so called qdevice daemon which runs on each {pve} node
  671. * an external vote daemon which runs on an independent server.
  672. As a result you can achieve higher availability even in smaller setups (for
  673. example 2+1 nodes).
  674. QDevice Technical Overview
  675. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  676. The Corosync Quroum Device (QDevice) is a daemon which runs on each cluster
  677. node. It provides a configured number of votes to the clusters quorum
  678. subsystem based on an external running third-party arbitrator's decision.
  679. Its primary use is to allow a cluster to sustain more node failures than
  680. standard quorum rules allow. This can be done safely as the external device
  681. can see all nodes and thus choose only one set of nodes to give its vote.
  682. This will only be done if said set of nodes can have quorum (again) when
  683. receiving the third-party vote.
  684. Currently only 'QDevice Net' is supported as a third-party arbitrator. It is
  685. a daemon which provides a vote to a cluster partition if it can reach the
  686. partition members over the network. It will give only votes to one partition
  687. of a cluster at any time.
  688. It's designed to support multiple clusters and is almost configuration and
  689. state free. New clusters are handled dynamically and no configuration file
  690. is needed on the host running a QDevice.
  691. The external host has the only requirement that it needs network access to the
  692. cluster and a corosync-qnetd package available. We provide such a package
  693. for Debian based hosts, other Linux distributions should also have a package
  694. available through their respective package manager.
  695. NOTE: In contrast to corosync itself, a QDevice connects to the cluster over
  696. TCP/IP. The daemon may even run outside of the clusters LAN and can have longer
  697. latencies than 2 ms.
  698. Supported Setups
  699. ~~~~~~~~~~~~~~~~
  700. We support QDevices for clusters with an even number of nodes and recommend
  701. it for 2 node clusters, if they should provide higher availability.
  702. For clusters with an odd node count we discourage the use of QDevices
  703. currently. The reason for this, is the difference of the votes the QDevice
  704. provides for each cluster type. Even numbered clusters get single additional
  705. vote, with this we can only increase availability, i.e. if the QDevice
  706. itself fails we are in the same situation as with no QDevice at all.
  707. Now, with an odd numbered cluster size the QDevice provides '(N-1)' votes --
  708. where 'N' corresponds to the cluster node count. This difference makes
  709. sense, if we had only one additional vote the cluster can get into a split
  710. brain situation.
  711. This algorithm would allow that all nodes but one (and naturally the
  712. QDevice itself) could fail.
  713. There are two drawbacks with this:
  714. * If the QNet daemon itself fails, no other node may fail or the cluster
  715. immediately loses quorum. For example, in a cluster with 15 nodes 7
  716. could fail before the cluster becomes inquorate. But, if a QDevice is
  717. configured here and said QDevice fails itself **no single node** of
  718. the 15 may fail. The QDevice acts almost as a single point of failure in
  719. this case.
  720. * The fact that all but one node plus QDevice may fail sound promising at
  721. first, but this may result in a mass recovery of HA services that would
  722. overload the single node left. Also ceph server will stop to provide
  723. services after only '((N-1)/2)' nodes are online.
  724. If you understand the drawbacks and implications you can decide yourself if
  725. you should use this technology in an odd numbered cluster setup.
  726. QDevice-Net Setup
  727. ~~~~~~~~~~~~~~~~~
  728. We recommend to run any daemon which provides votes to corosync-qdevice as an
  729. unprivileged user. {pve} and Debian provides a package which is already
  730. configured to do so.
  731. The traffic between the daemon and the cluster must be encrypted to ensure a
  732. safe and secure QDevice integration in {pve}.
  733. First install the 'corosync-qnetd' package on your external server and
  734. the 'corosync-qdevice' package on all cluster nodes.
  735. After that, ensure that all your nodes on the cluster are online.
  736. You can now easily set up your QDevice by running the following command on one
  737. of the {pve} nodes:
  738. ----
  739. pve# pvecm qdevice setup <QDEVICE-IP>
  740. ----
  741. The SSH key from the cluster will be automatically copied to the QDevice. You
  742. might need to enter an SSH password during this step.
  743. After you enter the password and all the steps are successfully completed, you
  744. will see "Done". You can check the status now:
  745. ----
  746. pve# pvecm status
  747. ...
  748. Votequorum information
  749. ~~~~~~~~~~~~~~~~~~~~~
  750. Expected votes: 3
  751. Highest expected: 3
  752. Total votes: 3
  753. Quorum: 2
  754. Flags: Quorate Qdevice
  755. Membership information
  756. ~~~~~~~~~~~~~~~~~~~~~~
  757. Nodeid Votes Qdevice Name
  758. 0x00000001 1 A,V,NMW (local)
  759. 0x00000002 1 A,V,NMW
  760. 0x00000000 1 Qdevice
  761. ----
  762. which means the QDevice is set up.
  763. Frequently Asked Questions
  764. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  765. Tie Breaking
  766. ^^^^^^^^^^^^
  767. In case of a tie, where two same-sized cluster partitions cannot see each other
  768. but the QDevice, the QDevice chooses randomly one of those partitions and
  769. provides a vote to it.
  770. Possible Negative Implications
  771. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  772. For clusters with an even node count there are no negative implications when
  773. setting up a QDevice. If it fails to work, you are as good as without QDevice at
  774. all.
  775. Adding/Deleting Nodes After QDevice Setup
  776. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  777. If you want to add a new node or remove an existing one from a cluster with a
  778. QDevice setup, you need to remove the QDevice first. After that, you can add or
  779. remove nodes normally. Once you have a cluster with an even node count again,
  780. you can set up the QDevice again as described above.
  781. Removing the QDevice
  782. ^^^^^^^^^^^^^^^^^^^^
  783. If you used the official `pvecm` tool to add the QDevice, you can remove it
  784. trivially by running:
  785. ----
  786. pve# pvecm qdevice remove
  787. ----
  788. //Still TODO
  789. //^^^^^^^^^^
  790. //There is still stuff to add here
  791. Corosync Configuration
  792. ----------------------
  793. The `/etc/pve/corosync.conf` file plays a central role in a {pve} cluster. It
  794. controls the cluster membership and its network.
  795. For further information about it, check the corosync.conf man page:
  796. [source,bash]
  797. ----
  798. man corosync.conf
  799. ----
  800. For node membership you should always use the `pvecm` tool provided by {pve}.
  801. You may have to edit the configuration file manually for other changes.
  802. Here are a few best practice tips for doing this.
  803. [[pvecm_edit_corosync_conf]]
  804. Edit corosync.conf
  805. ~~~~~~~~~~~~~~~~~~
  806. Editing the corosync.conf file is not always very straightforward. There are
  807. two on each cluster node, one in `/etc/pve/corosync.conf` and the other in
  808. `/etc/corosync/corosync.conf`. Editing the one in our cluster file system will
  809. propagate the changes to the local one, but not vice versa.
  810. The configuration will get updated automatically as soon as the file changes.
  811. This means changes which can be integrated in a running corosync will take
  812. effect immediately. So you should always make a copy and edit that instead, to
  813. avoid triggering some unwanted changes by an in-between safe.
  814. [source,bash]
  815. ----
  816. cp /etc/pve/corosync.conf /etc/pve/
  817. ----
  818. Then open the config file with your favorite editor, `nano` and `vim.tiny` are
  819. preinstalled on any {pve} node for example.
  820. NOTE: Always increment the 'config_version' number on configuration changes,
  821. omitting this can lead to problems.
  822. After making the necessary changes create another copy of the current working
  823. configuration file. This serves as a backup if the new configuration fails to
  824. apply or makes problems in other ways.
  825. [source,bash]
  826. ----
  827. cp /etc/pve/corosync.conf /etc/pve/corosync.conf.bak
  828. ----
  829. Then move the new configuration file over the old one:
  830. [source,bash]
  831. ----
  832. mv /etc/pve/ /etc/pve/corosync.conf
  833. ----
  834. You may check with the commands
  835. [source,bash]
  836. ----
  837. systemctl status corosync
  838. journalctl -b -u corosync
  839. ----
  840. If the change could be applied automatically. If not you may have to restart the
  841. corosync service via:
  842. [source,bash]
  843. ----
  844. systemctl restart corosync
  845. ----
  846. On errors check the troubleshooting section below.
  847. Troubleshooting
  848. ~~~~~~~~~~~~~~~
  849. Issue: 'quorum.expected_votes must be configured'
  850. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  851. When corosync starts to fail and you get the following message in the system log:
  852. ----
  853. [...]
  854. corosync[1647]: [QUORUM] Quorum provider: corosync_votequorum failed to initialize.
  855. corosync[1647]: [SERV ] Service engine 'corosync_quorum' failed to load for reason
  856. 'configuration error: nodelist or quorum.expected_votes must be configured!'
  857. [...]
  858. ----
  859. It means that the hostname you set for corosync 'ringX_addr' in the
  860. configuration could not be resolved.
  861. Write Configuration When Not Quorate
  862. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  863. If you need to change '/etc/pve/corosync.conf' on an node with no quorum, and you
  864. know what you do, use:
  865. [source,bash]
  866. ----
  867. pvecm expected 1
  868. ----
  869. This sets the expected vote count to 1 and makes the cluster quorate. You can
  870. now fix your configuration, or revert it back to the last working backup.
  871. This is not enough if corosync cannot start anymore. Here it is best to edit the
  872. local copy of the corosync configuration in '/etc/corosync/corosync.conf' so
  873. that corosync can start again. Ensure that on all nodes this configuration has
  874. the same content to avoid split brains. If you are not sure what went wrong
  875. it's best to ask the Proxmox Community to help you.
  876. [[pvecm_corosync_conf_glossary]]
  877. Corosync Configuration Glossary
  878. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  879. ringX_addr::
  880. This names the different link addresses for the kronosnet connections between
  881. nodes.
  882. Cluster Cold Start
  883. ------------------
  884. It is obvious that a cluster is not quorate when all nodes are
  885. offline. This is a common case after a power failure.
  886. NOTE: It is always a good idea to use an uninterruptible power supply
  887. (``UPS'', also called ``battery backup'') to avoid this state, especially if
  888. you want HA.
  889. On node startup, the `pve-guests` service is started and waits for
  890. quorum. Once quorate, it starts all guests which have the `onboot`
  891. flag set.
  892. When you turn on nodes, or when power comes back after power failure,
  893. it is likely that some nodes boots faster than others. Please keep in
  894. mind that guest startup is delayed until you reach quorum.
  895. Guest Migration
  896. ---------------
  897. Migrating virtual guests to other nodes is a useful feature in a
  898. cluster. There are settings to control the behavior of such
  899. migrations. This can be done via the configuration file
  900. `datacenter.cfg` or for a specific migration via API or command line
  901. parameters.
  902. It makes a difference if a Guest is online or offline, or if it has
  903. local resources (like a local disk).
  904. For Details about Virtual Machine Migration see the
  905. xref:qm_migration[QEMU/KVM Migration Chapter].
  906. For Details about Container Migration see the
  907. xref:pct_migration[Container Migration Chapter].
  908. Migration Type
  909. ~~~~~~~~~~~~~~
  910. The migration type defines if the migration data should be sent over an
  911. encrypted (`secure`) channel or an unencrypted (`insecure`) one.
  912. Setting the migration type to insecure means that the RAM content of a
  913. virtual guest gets also transferred unencrypted, which can lead to
  914. information disclosure of critical data from inside the guest (for
  915. example passwords or encryption keys).
  916. Therefore, we strongly recommend using the secure channel if you do
  917. not have full control over the network and can not guarantee that no
  918. one is eavesdropping on it.
  919. NOTE: Storage migration does not follow this setting. Currently, it
  920. always sends the storage content over a secure channel.
  921. Encryption requires a lot of computing power, so this setting is often
  922. changed to "unsafe" to achieve better performance. The impact on
  923. modern systems is lower because they implement AES encryption in
  924. hardware. The performance impact is particularly evident in fast
  925. networks where you can transfer 10 Gbps or more.
  926. Migration Network
  927. ~~~~~~~~~~~~~~~~~
  928. By default, {pve} uses the network in which cluster communication
  929. takes place to send the migration traffic. This is not optimal because
  930. sensitive cluster traffic can be disrupted and this network may not
  931. have the best bandwidth available on the node.
  932. Setting the migration network parameter allows the use of a dedicated
  933. network for the entire migration traffic. In addition to the memory,
  934. this also affects the storage traffic for offline migrations.
  935. The migration network is set as a network in the CIDR notation. This
  936. has the advantage that you do not have to set individual IP addresses
  937. for each node. {pve} can determine the real address on the
  938. destination node from the network specified in the CIDR form. To
  939. enable this, the network must be specified so that each node has one,
  940. but only one IP in the respective network.
  941. Example
  942. ^^^^^^^
  943. We assume that we have a three-node setup with three separate
  944. networks. One for public communication with the Internet, one for
  945. cluster communication and a very fast one, which we want to use as a
  946. dedicated network for migration.
  947. A network configuration for such a setup might look as follows:
  948. ----
  949. iface eno1 inet manual
  950. # public network
  951. auto vmbr0
  952. iface vmbr0 inet static
  953. address 192.X.Y.57
  954. netmask
  955. gateway 192.X.Y.1
  956. bridge_ports eno1
  957. bridge_stp off
  958. bridge_fd 0
  959. # cluster network
  960. auto eno2
  961. iface eno2 inet static
  962. address
  963. netmask
  964. # fast network
  965. auto eno3
  966. iface eno3 inet static
  967. address
  968. netmask
  969. ----
  970. Here, we will use the network as a migration network. For
  971. a single migration, you can do this using the `migration_network`
  972. parameter of the command line tool:
  973. ----
  974. # qm migrate 106 tre --online --migration_network
  975. ----
  976. To configure this as the default network for all migrations in the
  977. cluster, set the `migration` property of the `/etc/pve/datacenter.cfg`
  978. file:
  979. ----
  980. # use dedicated migration network
  981. migration: secure,network=
  982. ----
  983. NOTE: The migration type must always be set when the migration network
  984. gets set in `/etc/pve/datacenter.cfg`.
  985. ifdef::manvolnum[]
  986. include::pve-copyright.adoc[]
  987. endif::manvolnum[]