]>
Commit | Line | Data |
---|---|---|
d8742b0c | 1 | ifdef::manvolnum[] |
b2f242ab DM |
2 | pvecm(1) |
3 | ======== | |
d8742b0c | 4 | include::attributes.txt[] |
5f09af76 DM |
5 | :pve-toplevel: |
6 | ||
d8742b0c DM |
7 | NAME |
8 | ---- | |
9 | ||
74026b8f | 10 | pvecm - Proxmox VE Cluster Manager |
d8742b0c | 11 | |
49a5e11c | 12 | SYNOPSIS |
d8742b0c DM |
13 | -------- |
14 | ||
15 | include::pvecm.1-synopsis.adoc[] | |
16 | ||
17 | DESCRIPTION | |
18 | ----------- | |
19 | endif::manvolnum[] | |
20 | ||
21 | ifndef::manvolnum[] | |
22 | Cluster Manager | |
23 | =============== | |
24 | include::attributes.txt[] | |
25 | endif::manvolnum[] | |
5f09af76 DM |
26 | ifdef::wiki[] |
27 | :pve-toplevel: | |
28 | endif::wiki[] | |
29 | ||
8c1189b6 FG |
30 | The {PVE} cluster manager `pvecm` is a tool to create a group of |
31 | physical servers. Such a group is called a *cluster*. We use the | |
8a865621 | 32 | http://www.corosync.org[Corosync Cluster Engine] for reliable group |
5eba0743 | 33 | communication, and such clusters can consist of up to 32 physical nodes |
8a865621 DM |
34 | (probably more, dependent on network latency). |
35 | ||
8c1189b6 | 36 | `pvecm` can be used to create a new cluster, join nodes to a cluster, |
8a865621 | 37 | leave the cluster, get status information and do various other cluster |
e300cf7d FG |
38 | related tasks. The **P**rox**m**o**x** **C**luster **F**ile **S**ystem (``pmxcfs'') |
39 | is used to transparently distribute the cluster configuration to all cluster | |
8a865621 DM |
40 | nodes. |
41 | ||
42 | Grouping nodes into a cluster has the following advantages: | |
43 | ||
44 | * Centralized, web based management | |
45 | ||
5eba0743 | 46 | * Multi-master clusters: each node can do all management task |
8a865621 | 47 | |
8c1189b6 FG |
48 | * `pmxcfs`: database-driven file system for storing configuration files, |
49 | replicated in real-time on all nodes using `corosync`. | |
8a865621 | 50 | |
5eba0743 | 51 | * Easy migration of virtual machines and containers between physical |
8a865621 DM |
52 | hosts |
53 | ||
54 | * Fast deployment | |
55 | ||
56 | * Cluster-wide services like firewall and HA | |
57 | ||
58 | ||
59 | Requirements | |
60 | ------------ | |
61 | ||
8c1189b6 | 62 | * All nodes must be in the same network as `corosync` uses IP Multicast |
8a865621 | 63 | to communicate between nodes (also see |
ceabe189 | 64 | http://www.corosync.org[Corosync Cluster Engine]). Corosync uses UDP |
ff72a2ba | 65 | ports 5404 and 5405 for cluster communication. |
ceabe189 DM |
66 | + |
67 | NOTE: Some switches do not support IP multicast by default and must be | |
68 | manually enabled first. | |
8a865621 DM |
69 | |
70 | * Date and time have to be synchronized. | |
71 | ||
ceabe189 | 72 | * SSH tunnel on TCP port 22 between nodes is used. |
8a865621 | 73 | |
ceabe189 DM |
74 | * If you are interested in High Availability, you need to have at |
75 | least three nodes for reliable quorum. All nodes should have the | |
76 | same version. | |
8a865621 DM |
77 | |
78 | * We recommend a dedicated NIC for the cluster traffic, especially if | |
79 | you use shared storage. | |
80 | ||
81 | NOTE: It is not possible to mix Proxmox VE 3.x and earlier with | |
ceabe189 | 82 | Proxmox VE 4.0 cluster nodes. |
8a865621 DM |
83 | |
84 | ||
ceabe189 DM |
85 | Preparing Nodes |
86 | --------------- | |
8a865621 DM |
87 | |
88 | First, install {PVE} on all nodes. Make sure that each node is | |
89 | installed with the final hostname and IP configuration. Changing the | |
90 | hostname and IP is not possible after cluster creation. | |
91 | ||
92 | Currently the cluster creation has to be done on the console, so you | |
8c1189b6 | 93 | need to login via `ssh`. |
8a865621 | 94 | |
8a865621 | 95 | Create the Cluster |
ceabe189 | 96 | ------------------ |
8a865621 | 97 | |
8c1189b6 FG |
98 | Login via `ssh` to the first {pve} node. Use a unique name for your cluster. |
99 | This name cannot be changed later. | |
8a865621 DM |
100 | |
101 | hp1# pvecm create YOUR-CLUSTER-NAME | |
102 | ||
63f956c8 DM |
103 | CAUTION: The cluster name is used to compute the default multicast |
104 | address. Please use unique cluster names if you run more than one | |
105 | cluster inside your network. | |
106 | ||
8a865621 DM |
107 | To check the state of your cluster use: |
108 | ||
109 | hp1# pvecm status | |
110 | ||
111 | ||
112 | Adding Nodes to the Cluster | |
ceabe189 | 113 | --------------------------- |
8a865621 | 114 | |
8c1189b6 | 115 | Login via `ssh` to the node you want to add. |
8a865621 DM |
116 | |
117 | hp2# pvecm add IP-ADDRESS-CLUSTER | |
118 | ||
119 | For `IP-ADDRESS-CLUSTER` use the IP from an existing cluster node. | |
120 | ||
5eba0743 | 121 | CAUTION: A new node cannot hold any VMs, because you would get |
7980581f | 122 | conflicts about identical VM IDs. Also, all existing configuration in |
8c1189b6 FG |
123 | `/etc/pve` is overwritten when you join a new node to the cluster. To |
124 | workaround, use `vzdump` to backup and restore to a different VMID after | |
7980581f | 125 | adding the node to the cluster. |
8a865621 DM |
126 | |
127 | To check the state of cluster: | |
128 | ||
129 | # pvecm status | |
130 | ||
ceabe189 | 131 | .Cluster status after adding 4 nodes |
8a865621 DM |
132 | ---- |
133 | hp2# pvecm status | |
134 | Quorum information | |
135 | ~~~~~~~~~~~~~~~~~~ | |
136 | Date: Mon Apr 20 12:30:13 2015 | |
137 | Quorum provider: corosync_votequorum | |
138 | Nodes: 4 | |
139 | Node ID: 0x00000001 | |
140 | Ring ID: 1928 | |
141 | Quorate: Yes | |
142 | ||
143 | Votequorum information | |
144 | ~~~~~~~~~~~~~~~~~~~~~~ | |
145 | Expected votes: 4 | |
146 | Highest expected: 4 | |
147 | Total votes: 4 | |
148 | Quorum: 2 | |
149 | Flags: Quorate | |
150 | ||
151 | Membership information | |
152 | ~~~~~~~~~~~~~~~~~~~~~~ | |
153 | Nodeid Votes Name | |
154 | 0x00000001 1 192.168.15.91 | |
155 | 0x00000002 1 192.168.15.92 (local) | |
156 | 0x00000003 1 192.168.15.93 | |
157 | 0x00000004 1 192.168.15.94 | |
158 | ---- | |
159 | ||
160 | If you only want the list of all nodes use: | |
161 | ||
162 | # pvecm nodes | |
163 | ||
5eba0743 | 164 | .List nodes in a cluster |
8a865621 DM |
165 | ---- |
166 | hp2# pvecm nodes | |
167 | ||
168 | Membership information | |
169 | ~~~~~~~~~~~~~~~~~~~~~~ | |
170 | Nodeid Votes Name | |
171 | 1 1 hp1 | |
172 | 2 1 hp2 (local) | |
173 | 3 1 hp3 | |
174 | 4 1 hp4 | |
175 | ---- | |
176 | ||
e4ec4154 TL |
177 | Adding Nodes With Separated Cluster Network |
178 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
179 | ||
180 | When adding a node to a cluster with a separated cluster network you need to | |
181 | use the 'ringX_addr' parameters to set the nodes address on those networks: | |
182 | ||
183 | [source,bash] | |
4d19cb00 | 184 | ---- |
e4ec4154 | 185 | pvecm add IP-ADDRESS-CLUSTER -ring0_addr IP-ADDRESS-RING0 |
4d19cb00 | 186 | ---- |
e4ec4154 TL |
187 | |
188 | If you want to use the Redundant Ring Protocol you will also want to pass the | |
189 | 'ring1_addr' parameter. | |
190 | ||
8a865621 DM |
191 | |
192 | Remove a Cluster Node | |
ceabe189 | 193 | --------------------- |
8a865621 DM |
194 | |
195 | CAUTION: Read carefully the procedure before proceeding, as it could | |
196 | not be what you want or need. | |
197 | ||
198 | Move all virtual machines from the node. Make sure you have no local | |
199 | data or backups you want to keep, or save them accordingly. | |
200 | ||
8c1189b6 | 201 | Log in to one remaining node via ssh. Issue a `pvecm nodes` command to |
7980581f | 202 | identify the node ID: |
8a865621 DM |
203 | |
204 | ---- | |
205 | hp1# pvecm status | |
206 | ||
207 | Quorum information | |
208 | ~~~~~~~~~~~~~~~~~~ | |
209 | Date: Mon Apr 20 12:30:13 2015 | |
210 | Quorum provider: corosync_votequorum | |
211 | Nodes: 4 | |
212 | Node ID: 0x00000001 | |
213 | Ring ID: 1928 | |
214 | Quorate: Yes | |
215 | ||
216 | Votequorum information | |
217 | ~~~~~~~~~~~~~~~~~~~~~~ | |
218 | Expected votes: 4 | |
219 | Highest expected: 4 | |
220 | Total votes: 4 | |
221 | Quorum: 2 | |
222 | Flags: Quorate | |
223 | ||
224 | Membership information | |
225 | ~~~~~~~~~~~~~~~~~~~~~~ | |
226 | Nodeid Votes Name | |
227 | 0x00000001 1 192.168.15.91 (local) | |
228 | 0x00000002 1 192.168.15.92 | |
229 | 0x00000003 1 192.168.15.93 | |
230 | 0x00000004 1 192.168.15.94 | |
231 | ---- | |
232 | ||
233 | IMPORTANT: at this point you must power off the node to be removed and | |
234 | make sure that it will not power on again (in the network) as it | |
235 | is. | |
236 | ||
237 | ---- | |
238 | hp1# pvecm nodes | |
239 | ||
240 | Membership information | |
241 | ~~~~~~~~~~~~~~~~~~~~~~ | |
242 | Nodeid Votes Name | |
243 | 1 1 hp1 (local) | |
244 | 2 1 hp2 | |
245 | 3 1 hp3 | |
246 | 4 1 hp4 | |
247 | ---- | |
248 | ||
249 | Log in to one remaining node via ssh. Issue the delete command (here | |
8c1189b6 | 250 | deleting node `hp4`): |
8a865621 DM |
251 | |
252 | hp1# pvecm delnode hp4 | |
253 | ||
254 | If the operation succeeds no output is returned, just check the node | |
8c1189b6 | 255 | list again with `pvecm nodes` or `pvecm status`. You should see |
8a865621 DM |
256 | something like: |
257 | ||
258 | ---- | |
259 | hp1# pvecm status | |
260 | ||
261 | Quorum information | |
262 | ~~~~~~~~~~~~~~~~~~ | |
263 | Date: Mon Apr 20 12:44:28 2015 | |
264 | Quorum provider: corosync_votequorum | |
265 | Nodes: 3 | |
266 | Node ID: 0x00000001 | |
267 | Ring ID: 1992 | |
268 | Quorate: Yes | |
269 | ||
270 | Votequorum information | |
271 | ~~~~~~~~~~~~~~~~~~~~~~ | |
272 | Expected votes: 3 | |
273 | Highest expected: 3 | |
274 | Total votes: 3 | |
275 | Quorum: 3 | |
276 | Flags: Quorate | |
277 | ||
278 | Membership information | |
279 | ~~~~~~~~~~~~~~~~~~~~~~ | |
280 | Nodeid Votes Name | |
281 | 0x00000001 1 192.168.15.90 (local) | |
282 | 0x00000002 1 192.168.15.91 | |
283 | 0x00000003 1 192.168.15.92 | |
284 | ---- | |
285 | ||
286 | IMPORTANT: as said above, it is very important to power off the node | |
287 | *before* removal, and make sure that it will *never* power on again | |
288 | (in the existing cluster network) as it is. | |
289 | ||
290 | If you power on the node as it is, your cluster will be screwed up and | |
291 | it could be difficult to restore a clean cluster state. | |
292 | ||
293 | If, for whatever reason, you want that this server joins the same | |
294 | cluster again, you have to | |
295 | ||
26ca7ff5 | 296 | * reinstall {pve} on it from scratch |
8a865621 DM |
297 | |
298 | * then join it, as explained in the previous section. | |
d8742b0c | 299 | |
555e966b TL |
300 | Separate A Node Without Reinstalling |
301 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
302 | ||
303 | CAUTION: This is *not* the recommended method, proceed with caution. Use the | |
304 | above mentioned method if you're unsure. | |
305 | ||
306 | You can also separate a node from a cluster without reinstalling it from | |
307 | scratch. But after removing the node from the cluster it will still have | |
308 | access to the shared storages! This must be resolved before you start removing | |
309 | the node from the cluster. A {pve} cluster cannot share the exact same | |
310 | storage with another cluster, as it leads to VMID conflicts. | |
311 | ||
3be22308 TL |
312 | Its suggested that you create a new storage where only the node which you want |
313 | to separate has access. This can be an new export on your NFS or a new Ceph | |
314 | pool, to name a few examples. Its just important that the exact same storage | |
315 | does not gets accessed by multiple clusters. After setting this storage up move | |
316 | all data from the node and its VMs to it. Then you are ready to separate the | |
317 | node from the cluster. | |
555e966b TL |
318 | |
319 | WARNING: Ensure all shared resources are cleanly separated! You will run into | |
320 | conflicts and problems else. | |
321 | ||
322 | First stop the corosync and the pve-cluster services on the node: | |
323 | [source,bash] | |
4d19cb00 | 324 | ---- |
555e966b TL |
325 | systemctl stop pve-cluster |
326 | systemctl stop corosync | |
4d19cb00 | 327 | ---- |
555e966b TL |
328 | |
329 | Start the cluster filesystem again in local mode: | |
330 | [source,bash] | |
4d19cb00 | 331 | ---- |
555e966b | 332 | pmxcfs -l |
4d19cb00 | 333 | ---- |
555e966b TL |
334 | |
335 | Delete the corosync configuration files: | |
336 | [source,bash] | |
4d19cb00 | 337 | ---- |
555e966b TL |
338 | rm /etc/pve/corosync.conf |
339 | rm /etc/corosync/* | |
4d19cb00 | 340 | ---- |
555e966b TL |
341 | |
342 | You can now start the filesystem again as normal service: | |
343 | [source,bash] | |
4d19cb00 | 344 | ---- |
555e966b TL |
345 | killall pmxcfs |
346 | systemctl start pve-cluster | |
4d19cb00 | 347 | ---- |
555e966b TL |
348 | |
349 | The node is now separated from the cluster. You can deleted it from a remaining | |
350 | node of the cluster with: | |
351 | [source,bash] | |
4d19cb00 | 352 | ---- |
555e966b | 353 | pvecm delnode oldnode |
4d19cb00 | 354 | ---- |
555e966b TL |
355 | |
356 | If the command failed, because the remaining node in the cluster lost quorum | |
357 | when the now separate node exited, you may set the expected votes to 1 as a workaround: | |
358 | [source,bash] | |
4d19cb00 | 359 | ---- |
555e966b | 360 | pvecm expected 1 |
4d19cb00 | 361 | ---- |
555e966b TL |
362 | |
363 | And the repeat the 'pvecm delnode' command. | |
364 | ||
365 | Now switch back to the separated node, here delete all remaining files left | |
366 | from the old cluster. This ensures that the node can be added to another | |
367 | cluster again without problems. | |
368 | ||
369 | [source,bash] | |
4d19cb00 | 370 | ---- |
555e966b | 371 | rm /var/lib/corosync/* |
4d19cb00 | 372 | ---- |
555e966b TL |
373 | |
374 | As the configuration files from the other nodes are still in the cluster | |
375 | filesystem you may want to clean those up too. Remove simply the whole | |
376 | directory recursive from '/etc/pve/nodes/NODENAME', but check three times that | |
377 | you used the correct one before deleting it. | |
378 | ||
379 | CAUTION: The nodes SSH keys are still in the 'authorized_key' file, this means | |
380 | the nodes can still connect to each other with public key authentication. This | |
381 | should be fixed by removing the respective keys from the | |
382 | '/etc/pve/priv/authorized_keys' file. | |
d8742b0c | 383 | |
806ef12d DM |
384 | Quorum |
385 | ------ | |
386 | ||
387 | {pve} use a quorum-based technique to provide a consistent state among | |
388 | all cluster nodes. | |
389 | ||
390 | [quote, from Wikipedia, Quorum (distributed computing)] | |
391 | ____ | |
392 | A quorum is the minimum number of votes that a distributed transaction | |
393 | has to obtain in order to be allowed to perform an operation in a | |
394 | distributed system. | |
395 | ____ | |
396 | ||
397 | In case of network partitioning, state changes requires that a | |
398 | majority of nodes are online. The cluster switches to read-only mode | |
5eba0743 | 399 | if it loses quorum. |
806ef12d DM |
400 | |
401 | NOTE: {pve} assigns a single vote to each node by default. | |
402 | ||
e4ec4154 TL |
403 | Cluster Network |
404 | --------------- | |
405 | ||
406 | The cluster network is the core of a cluster. All messages sent over it have to | |
407 | be delivered reliable to all nodes in their respective order. In {pve} this | |
408 | part is done by corosync, an implementation of a high performance low overhead | |
409 | high availability development toolkit. It serves our decentralized | |
410 | configuration file system (`pmxcfs`). | |
411 | ||
412 | [[cluster-network-requirements]] | |
413 | Network Requirements | |
414 | ~~~~~~~~~~~~~~~~~~~~ | |
415 | This needs a reliable network with latencies under 2 milliseconds (LAN | |
416 | performance) to work properly. While corosync can also use unicast for | |
417 | communication between nodes its **highly recommended** to have a multicast | |
418 | capable network. The network should not be used heavily by other members, | |
419 | ideally corosync runs on its own network. | |
420 | *never* share it with network where storage communicates too. | |
421 | ||
422 | Before setting up a cluster it is good practice to check if the network is fit | |
423 | for that purpose. | |
424 | ||
425 | * Ensure that all nodes are in the same subnet. This must only be true for the | |
426 | network interfaces used for cluster communication (corosync). | |
427 | ||
428 | * Ensure all nodes can reach each other over those interfaces, using `ping` is | |
429 | enough for a basic test. | |
430 | ||
431 | * Ensure that multicast works in general and a high package rates. This can be | |
432 | done with the `omping` tool. The final "%loss" number should be < 1%. | |
433 | [source,bash] | |
434 | ---- | |
435 | omping -c 10000 -i 0.001 -F -q NODE1-IP NODE2-IP ... | |
436 | ---- | |
437 | ||
438 | * Ensure that multicast communication works over an extended period of time. | |
439 | This covers up problems where IGMP snooping is activated on the network but | |
440 | no multicast querier is active. This test has a duration of around 10 | |
441 | minutes. | |
442 | [source,bash] | |
4d19cb00 | 443 | ---- |
e4ec4154 | 444 | omping -c 600 -i 1 -q NODE1-IP NODE2-IP ... |
4d19cb00 | 445 | ---- |
e4ec4154 TL |
446 | |
447 | Your network is not ready for clustering if any of these test fails. Recheck | |
448 | your network configuration. Especially switches are notorious for having | |
449 | multicast disabled by default or IGMP snooping enabled with no IGMP querier | |
450 | active. | |
451 | ||
452 | In smaller cluster its also an option to use unicast if you really cannot get | |
453 | multicast to work. | |
454 | ||
455 | Separate Cluster Network | |
456 | ~~~~~~~~~~~~~~~~~~~~~~~~ | |
457 | ||
458 | When creating a cluster without any parameters the cluster network is generally | |
459 | shared with the Web UI and the VMs and its traffic. Depending on your setup | |
460 | even storage traffic may get sent over the same network. Its recommended to | |
461 | change that, as corosync is a time critical real time application. | |
462 | ||
463 | Setting Up A New Network | |
464 | ^^^^^^^^^^^^^^^^^^^^^^^^ | |
465 | ||
466 | First you have to setup a new network interface. It should be on a physical | |
467 | separate network. Ensure that your network fulfills the | |
468 | <<cluster-network-requirements,cluster network requirements>>. | |
469 | ||
470 | Separate On Cluster Creation | |
471 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
472 | ||
473 | This is possible through the 'ring0_addr' and 'bindnet0_addr' parameter of | |
474 | the 'pvecm create' command used for creating a new cluster. | |
475 | ||
476 | If you have setup a additional NIC with a static address on 10.10.10.1/25 | |
477 | and want to send and receive all cluster communication over this interface | |
478 | you would execute: | |
479 | ||
480 | [source,bash] | |
4d19cb00 | 481 | ---- |
e4ec4154 | 482 | pvecm create test --ring0_addr 10.10.10.1 --bindnet0_addr 10.10.10.0 |
4d19cb00 | 483 | ---- |
e4ec4154 TL |
484 | |
485 | To check if everything is working properly execute: | |
486 | [source,bash] | |
4d19cb00 | 487 | ---- |
e4ec4154 | 488 | systemctl status corosync |
4d19cb00 | 489 | ---- |
e4ec4154 TL |
490 | |
491 | [[separate-cluster-net-after-creation]] | |
492 | Separate After Cluster Creation | |
493 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
494 | ||
495 | You can do this also if you have already created a cluster and want to switch | |
496 | its communication to another network, without rebuilding the whole cluster. | |
497 | This change may lead to short durations of quorum loss in the cluster, as nodes | |
498 | have to restart corosync and come up one after the other on the new network. | |
499 | ||
500 | Check how to <<edit-corosync-conf,edit the corosync.conf file>> first. | |
501 | The open it and you should see a file similar to: | |
502 | ||
503 | ---- | |
504 | logging { | |
505 | debug: off | |
506 | to_syslog: yes | |
507 | } | |
508 | ||
509 | nodelist { | |
510 | ||
511 | node { | |
512 | name: due | |
513 | nodeid: 2 | |
514 | quorum_votes: 1 | |
515 | ring0_addr: due | |
516 | } | |
517 | ||
518 | node { | |
519 | name: tre | |
520 | nodeid: 3 | |
521 | quorum_votes: 1 | |
522 | ring0_addr: tre | |
523 | } | |
524 | ||
525 | node { | |
526 | name: uno | |
527 | nodeid: 1 | |
528 | quorum_votes: 1 | |
529 | ring0_addr: uno | |
530 | } | |
531 | ||
532 | } | |
533 | ||
534 | quorum { | |
535 | provider: corosync_votequorum | |
536 | } | |
537 | ||
538 | totem { | |
539 | cluster_name: thomas-testcluster | |
540 | config_version: 3 | |
541 | ip_version: ipv4 | |
542 | secauth: on | |
543 | version: 2 | |
544 | interface { | |
545 | bindnetaddr: 192.168.30.50 | |
546 | ringnumber: 0 | |
547 | } | |
548 | ||
549 | } | |
550 | ---- | |
551 | ||
552 | The first you want to do is add the 'name' properties in the node entries if | |
553 | you do not see them already. Those *must* match the node name. | |
554 | ||
555 | Then replace the address from the 'ring0_addr' properties with the new | |
556 | addresses. You may use plain IP addresses or also hostnames here. If you use | |
557 | hostnames ensure that they are resolvable from all nodes. | |
558 | ||
559 | In my example I want to switch my cluster communication to the 10.10.10.1/25 | |
560 | network. So I replace all 'ring0_addr' respectively. I also set the bindetaddr | |
561 | in the totem section of the config to an address of the new network. It can be | |
562 | any address from the subnet configured on the new network interface. | |
563 | ||
564 | After you increased the 'config_version' property the new configuration file | |
565 | should look like: | |
566 | ||
567 | ---- | |
568 | ||
569 | logging { | |
570 | debug: off | |
571 | to_syslog: yes | |
572 | } | |
573 | ||
574 | nodelist { | |
575 | ||
576 | node { | |
577 | name: due | |
578 | nodeid: 2 | |
579 | quorum_votes: 1 | |
580 | ring0_addr: 10.10.10.2 | |
581 | } | |
582 | ||
583 | node { | |
584 | name: tre | |
585 | nodeid: 3 | |
586 | quorum_votes: 1 | |
587 | ring0_addr: 10.10.10.3 | |
588 | } | |
589 | ||
590 | node { | |
591 | name: uno | |
592 | nodeid: 1 | |
593 | quorum_votes: 1 | |
594 | ring0_addr: 10.10.10.1 | |
595 | } | |
596 | ||
597 | } | |
598 | ||
599 | quorum { | |
600 | provider: corosync_votequorum | |
601 | } | |
602 | ||
603 | totem { | |
604 | cluster_name: thomas-testcluster | |
605 | config_version: 4 | |
606 | ip_version: ipv4 | |
607 | secauth: on | |
608 | version: 2 | |
609 | interface { | |
610 | bindnetaddr: 10.10.10.1 | |
611 | ringnumber: 0 | |
612 | } | |
613 | ||
614 | } | |
615 | ---- | |
616 | ||
617 | Now after a final check whether all changed information is correct we save it | |
618 | and see again the <<edit-corosync-conf,edit corosync.conf file>> section to | |
619 | learn how to bring it in effect. | |
620 | ||
621 | As our change cannot be enforced live from corosync we have to do an restart. | |
622 | ||
623 | On a single node execute: | |
624 | [source,bash] | |
4d19cb00 | 625 | ---- |
e4ec4154 | 626 | systemctl restart corosync |
4d19cb00 | 627 | ---- |
e4ec4154 TL |
628 | |
629 | Now check if everything is fine: | |
630 | ||
631 | [source,bash] | |
4d19cb00 | 632 | ---- |
e4ec4154 | 633 | systemctl status corosync |
4d19cb00 | 634 | ---- |
e4ec4154 TL |
635 | |
636 | If corosync runs again correct restart corosync also on all other nodes. | |
637 | They will then join the cluster membership one by one on the new network. | |
638 | ||
639 | Redundant Ring Protocol | |
640 | ~~~~~~~~~~~~~~~~~~~~~~~ | |
641 | To avoid a single point of failure you should implement counter measurements. | |
642 | This can be on the hardware and operating system level through network bonding. | |
643 | ||
644 | Corosync itself offers also a possibility to add redundancy through the so | |
645 | called 'Redundant Ring Protocol'. This protocol allows running a second totem | |
646 | ring on another network, this network should be physically separated from the | |
647 | other rings network to actually increase availability. | |
648 | ||
649 | RRP On Cluster Creation | |
650 | ~~~~~~~~~~~~~~~~~~~~~~~ | |
651 | ||
652 | The 'pvecm create' command provides the additional parameters 'bindnetX_addr', | |
653 | 'ringX_addr' and 'rrp_mode', can be used for RRP configuration. | |
654 | ||
655 | NOTE: See the <<corosync-conf-glossary,glossary>> if you do not know what each parameter means. | |
656 | ||
657 | So if you have two networks, one on the 10.10.10.1/24 and the other on the | |
658 | 10.10.20.1/24 subnet you would execute: | |
659 | ||
660 | [source,bash] | |
4d19cb00 | 661 | ---- |
e4ec4154 TL |
662 | pvecm create CLUSTERNAME -bindnet0_addr 10.10.10.1 -ring0_addr 10.10.10.1 \ |
663 | -bindnet1_addr 10.10.20.1 -ring1_addr 10.10.20.1 | |
4d19cb00 | 664 | ---- |
e4ec4154 TL |
665 | |
666 | RRP On A Created Cluster | |
667 | ~~~~~~~~~~~~~~~~~~~~~~~~ | |
668 | ||
669 | When enabling an already running cluster to use RRP you will take similar steps | |
670 | as describe in <<separate-cluster-net-after-creation,separating the cluster | |
671 | network>>. You just do it on another ring. | |
672 | ||
673 | First add a new `interface` subsection in the `totem` section, set its | |
674 | `ringnumber` property to `1`. Set the interfaces `bindnetaddr` property to an | |
675 | address of the subnet you have configured for your new ring. | |
676 | Further set the `rrp_mode` to `passive`, this is the only stable mode. | |
677 | ||
678 | Then add to each node entry in the `nodelist` section its new `ring1_addr` | |
679 | property with the nodes additional ring address. | |
680 | ||
681 | So if you have two networks, one on the 10.10.10.1/24 and the other on the | |
682 | 10.10.20.1/24 subnet, the final configuration file should look like: | |
683 | ||
684 | ---- | |
685 | totem { | |
686 | cluster_name: tweak | |
687 | config_version: 9 | |
688 | ip_version: ipv4 | |
689 | rrp_mode: passive | |
690 | secauth: on | |
691 | version: 2 | |
692 | interface { | |
693 | bindnetaddr: 10.10.10.1 | |
694 | ringnumber: 0 | |
695 | } | |
696 | interface { | |
697 | bindnetaddr: 10.10.20.1 | |
698 | ringnumber: 1 | |
699 | } | |
700 | } | |
701 | ||
702 | nodelist { | |
703 | node { | |
704 | name: pvecm1 | |
705 | nodeid: 1 | |
706 | quorum_votes: 1 | |
707 | ring0_addr: 10.10.10.1 | |
708 | ring1_addr: 10.10.20.1 | |
709 | } | |
710 | ||
711 | node { | |
712 | name: pvecm2 | |
713 | nodeid: 2 | |
714 | quorum_votes: 1 | |
715 | ring0_addr: 10.10.10.2 | |
716 | ring1_addr: 10.10.20.2 | |
717 | } | |
718 | ||
719 | [...] # other cluster nodes here | |
720 | } | |
721 | ||
722 | [...] # other remaining config sections here | |
723 | ||
724 | ---- | |
725 | ||
726 | Bring it in effect like described in the <<edit-corosync-conf,edit the | |
727 | corosync.conf file>> section. | |
728 | ||
729 | This is a change which cannot take live in effect and needs at least a restart | |
730 | of corosync. Recommended is a restart of the whole cluster. | |
731 | ||
732 | If you cannot reboot the whole cluster ensure no High Availability services are | |
733 | configured and the stop the corosync service on all nodes. After corosync is | |
734 | stopped on all nodes start it one after the other again. | |
735 | ||
736 | Corosync Configuration | |
737 | ---------------------- | |
738 | ||
739 | The `/ect/pve/corosync.conf` file plays a central role in {pve} cluster. It | |
740 | controls the cluster member ship and its network. | |
741 | For reading more about it check the corosync.conf man page: | |
742 | [source,bash] | |
4d19cb00 | 743 | ---- |
e4ec4154 | 744 | man corosync.conf |
4d19cb00 | 745 | ---- |
e4ec4154 TL |
746 | |
747 | For node membership you should always use the `pvecm` tool provided by {pve}. | |
748 | You may have to edit the configuration file manually for other changes. | |
749 | Here are a few best practice tips for doing this. | |
750 | ||
751 | [[edit-corosync-conf]] | |
752 | Edit corosync.conf | |
753 | ~~~~~~~~~~~~~~~~~~ | |
754 | ||
755 | Editing the corosync.conf file can be not always straight forward. There are | |
756 | two on each cluster, one in `/etc/pve/corosync.conf` and the other in | |
757 | `/etc/corosync/corosync.conf`. Editing the one in our cluster file system will | |
758 | propagate the changes to the local one, but not vice versa. | |
759 | ||
760 | The configuration will get updated automatically as soon as the file changes. | |
761 | This means changes which can be integrated in a running corosync will take | |
762 | instantly effect. So you should always make a copy and edit that instead, to | |
763 | avoid triggering some unwanted changes by an in between safe. | |
764 | ||
765 | [source,bash] | |
4d19cb00 | 766 | ---- |
e4ec4154 | 767 | cp /etc/pve/corosync.conf /etc/pve/corosync.conf.new |
4d19cb00 | 768 | ---- |
e4ec4154 TL |
769 | |
770 | Then open the Config file with your favorite editor, `nano` and `vim.tiny` are | |
771 | preinstalled on {pve} for example. | |
772 | ||
773 | NOTE: Always increment the 'config_version' number on configuration changes, | |
774 | omitting this can lead to problems. | |
775 | ||
776 | After making the necessary changes create another copy of the current working | |
777 | configuration file. This serves as a backup if the new configuration fails to | |
778 | apply or makes problems in other ways. | |
779 | ||
780 | [source,bash] | |
4d19cb00 | 781 | ---- |
e4ec4154 | 782 | cp /etc/pve/corosync.conf /etc/pve/corosync.conf.bak |
4d19cb00 | 783 | ---- |
e4ec4154 TL |
784 | |
785 | Then move the new configuration file over the old one: | |
786 | [source,bash] | |
4d19cb00 | 787 | ---- |
e4ec4154 | 788 | mv /etc/pve/corosync.conf.new /etc/pve/corosync.conf |
4d19cb00 | 789 | ---- |
e4ec4154 TL |
790 | |
791 | You may check with the commands | |
792 | [source,bash] | |
4d19cb00 | 793 | ---- |
e4ec4154 TL |
794 | systemctl status corosync |
795 | journalctl -b -u corosync | |
4d19cb00 | 796 | ---- |
e4ec4154 TL |
797 | |
798 | If the change could applied automatically. If not you may have to restart the | |
799 | corosync service via: | |
800 | [source,bash] | |
4d19cb00 | 801 | ---- |
e4ec4154 | 802 | systemctl restart corosync |
4d19cb00 | 803 | ---- |
e4ec4154 TL |
804 | |
805 | On errors check the troubleshooting section below. | |
806 | ||
807 | Troubleshooting | |
808 | ~~~~~~~~~~~~~~~ | |
809 | ||
810 | Issue: 'quorum.expected_votes must be configured' | |
811 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
812 | ||
813 | When corosync starts to fail and you get the following message in the system log: | |
814 | ||
815 | ---- | |
816 | [...] | |
817 | corosync[1647]: [QUORUM] Quorum provider: corosync_votequorum failed to initialize. | |
818 | corosync[1647]: [SERV ] Service engine 'corosync_quorum' failed to load for reason | |
819 | 'configuration error: nodelist or quorum.expected_votes must be configured!' | |
820 | [...] | |
821 | ---- | |
822 | ||
823 | It means that the hostname you set for corosync 'ringX_addr' in the | |
824 | configuration could not be resolved. | |
825 | ||
826 | ||
827 | Write Configuration When Not Quorate | |
828 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
829 | ||
830 | If you need to change '/etc/pve/corosync.conf' on an node with no quorum, and you | |
831 | know what you do, use: | |
832 | [source,bash] | |
4d19cb00 | 833 | ---- |
e4ec4154 | 834 | pvecm expected 1 |
4d19cb00 | 835 | ---- |
e4ec4154 TL |
836 | |
837 | This sets the expected vote count to 1 and makes the cluster quorate. You can | |
838 | now fix your configuration, or revert it back to the last working backup. | |
839 | ||
840 | This is not enough if corosync cannot start anymore. Here its best to edit the | |
841 | local copy of the corosync configuration in '/etc/corosync/corosync.conf' so | |
842 | that corosync can start again. Ensure that on all nodes this configuration has | |
843 | the same content to avoid split brains. If you are not sure what went wrong | |
844 | it's best to ask the Proxmox Community to help you. | |
845 | ||
846 | ||
847 | [[corosync-conf-glossary]] | |
848 | Corosync Configuration Glossary | |
849 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
850 | ||
851 | ringX_addr:: | |
852 | This names the different ring addresses for the corosync totem rings used for | |
853 | the cluster communication. | |
854 | ||
855 | bindnetaddr:: | |
856 | Defines to which interface the ring should bind to. It may be any address of | |
857 | the subnet configured on the interface we want to use. In general its the | |
858 | recommended to just use an address a node uses on this interface. | |
859 | ||
860 | rrp_mode:: | |
861 | Specifies the mode of the redundant ring protocol and may be passive, active or | |
862 | none. Note that use of active is highly experimental and not official | |
863 | supported. Passive is the preferred mode, it may double the cluster | |
864 | communication throughput and increases availability. | |
865 | ||
806ef12d DM |
866 | |
867 | Cluster Cold Start | |
868 | ------------------ | |
869 | ||
870 | It is obvious that a cluster is not quorate when all nodes are | |
871 | offline. This is a common case after a power failure. | |
872 | ||
873 | NOTE: It is always a good idea to use an uninterruptible power supply | |
8c1189b6 | 874 | (``UPS'', also called ``battery backup'') to avoid this state, especially if |
806ef12d DM |
875 | you want HA. |
876 | ||
8c1189b6 FG |
877 | On node startup, service `pve-manager` is started and waits for |
878 | quorum. Once quorate, it starts all guests which have the `onboot` | |
612417fd DM |
879 | flag set. |
880 | ||
881 | When you turn on nodes, or when power comes back after power failure, | |
882 | it is likely that some nodes boots faster than others. Please keep in | |
883 | mind that guest startup is delayed until you reach quorum. | |
806ef12d DM |
884 | |
885 | ||
d8742b0c DM |
886 | ifdef::manvolnum[] |
887 | include::pve-copyright.adoc[] | |
888 | endif::manvolnum[] |