DRBD & KVM replication is possible?

i have two KVM servers with some virtual machines.

Server (A) KVM with qcow2 images

Server (B) KVM mount NFS for partiton (with qcow2 images present on server A).

My question is simple, what is the best solution for creating virtual disk copies on server B (with virtual machines running obviously). DRBD is one solution??


Solution 1:

If you just want to replicate the server A qcow2 images on the server B, but they don't have to be accessed at the same time on both A and B, then you may use DRBD with any file system on it (like ext4), running as Primary on A and Secondary on B. When A fails you will be able to switch DRBD on B to Primary and use the images there.

In case you want those images available and used on A and B at the same time – then this will be more tricky. A clustered file system may help, but I don't think performance will be right.

If you just want to make a one time copy of the images, then just stop the VMs on A, copy the images with scp/rsync/over-NFS/whatever. If the VMs must be running on A, then, for a consistent image, you will need to make some kind of snapshot. I don't know KVM and QCOW2, but maybe they provide some snapshot functionality. If not, then LVM snapshots may have if you store the images on an LVM volume.

Solution 2:

Take a look at https://alteeve.ca/w/2-Node_Red_Hat_KVM_Cluster_Tutorial it will take you through the steps.