DRBD & KVM replication is possible?
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.
Related videos on Youtube
Giovanni Bennelli
Updated on September 18, 2022Comments
-
Giovanni Bennelli almost 2 years
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??
-
Giovanni Bennelli over 11 yearsThank Jacek, one last question, in first case: 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. DRDB replicate the qcow images with VM running, is true?
-
Jacek Konieczny over 11 yearsYes. Each change made by the VM will be written to disk on both servers (unless DRBD is disconnected or not fully synced – both cases are no problem, as recovery by re-synchronisation is possible).