Ok, so i have 2 nodes. I want to automatically copying VMs from 1st server to 2nd server when a server failure occours. So what i need to do this?
Forget anything related to Ceph and RBD in a 2-node cluster
You need 3 or more nodes to make use of Ceph.
For a 2-node cluster the following can work:
- Create a ZFS Pool on both nodes with the same name. Make sure to have some kind of redunancy on the pool level (mirror, raid 10).
- The storage configuration (Datacenter -> Storage) should be there for this pool (more later)
- Make sure that all disks of the VMs are on that storage.
- Create a replication job (shortest interval is each minute
*/1
Once the initial replication is done, a live migration should be very fast.
You can now combine that with the HA functionality, which will start the VM on the other node, should the first one (where is used to run) fail.
But for that to work, you need a 3rd vote in the Proxmox VE cluster. A Proxmox VE cluster works by forming a majority. If one of 2 nodes is down, the remaining node has only 50% of the votes and cannot start a VM because it does not have the majority of votes.
You can use the
QDevice to get one more vote, without a full Proxmox VE installation. The external part can run on a Raspberry Pi or on another machine you have that is not part of the cluster. With that, the remaining node + the Qdevice still has 2 out of 3 votes and can start the VM.
The only downside with replicated VMs and HA is, that the VM will start with the disk image that was transferred in the last successful replication. Depending on the interval, this can be more or less.
Setting up local storage with the same name on multiple nodes:
- Create the ZFS pool on the first node, give it a name and let the "Add Storage" Checkbox enabled.
- On the second node, create the ZFS pool as well, but disable the "Add Storage" checkbox.
- under Datacenter->Storage edit the storage. In the top right, you have a list of nodes. Select the second node. This tells Proxmox VE on which nodes it can expect that storage to be present.