Setting up DRBD with only one node
I need to migrate an existing storage server running Debian 6, with many TB of data, to a HA setup. I can't simply shut down this server for any prolonged time (HA is required after all).
I plan to migrate this server to a DRBD cluster. I can't buy two new servers for this cluster; I need to reuse the existing server as a member of the cluster for cost reasons. Remember, I can't shut down anything for more than a few minutes at a time.
I have a new server ready, running Debian 8 to be the "master". I'd need to set up a "split brain" cluster using this "master" server; copy all data from the existing old server to the cluster; switch the existing services to the cluster; reconfigure the old server with Debian 8, then add it to the cluster as a "slave", resynchronize data, and at last have a redundant setup.
I've set up the cluster on the new machine, however, how to proceed? I can't even start the drbd service as the other "node" doesn't even exist yet...
I'm starting up from a previous drbd configuration that worked fine... with two available nodes.
Any help appreciated.
You can bring DRBD up without a peer and without starting the DRBD service:
# modprobe drbd
# drbdadm create-md <res>
# drbdadm up <res>
# drbdadm primary <res> --force
-- now you can use /dev/drbdX --
You could use DRBD to replicate from the existing server to the new server by installing DRBD on the existing storage.
If you're data is currently sitting on LVM you can unmount the logical volume, grow the logical volume (don't grow the filesystem) to make room for DRBD's metadata at the end of the device, set the disk
option in the DRBD configuration to the logical volume, create the DRBD's metadata, and then force it to become Primary (with or without a peer). The rule of thumb for how much room DRBD needs for metadata is 32MB per 1TB of data. It would look something like this (assuming a 1TB LV):
# umount /dev/vg_name/lv_name
# lvextend -L +32M /dev/vg_name/lv_name
# drbdadm create-md <res>
-- will warn you if it finds existing data at the end of the device --
# drbdadm up <res>
# drbdadm primary <res> --force
If you're not using LVM, you'd need to either shrink the filesystem to make room for DRBD's metadata, or use external metadata (described in the user's guide: https://www.drbd.org/en/doc/users-guide-84/ch-internals#s-metadata).
Once you bring DRBD up on the new server, it should start syncing your data. Just make sure the new server's backing disk is equal or larger in size.
Edit: If you are using Proxmox then the commands apply to you. If not, then a similar process is still used.
You can not create a single node cluster AND migrate all data from a different computer since there is no other computer to migrate to. There needs to be at least 2 nodes connected with DRBD in order to migrate data.
You can create a cluster using the command pvecm create <clustername>
. Do this on the new computer you wish to move your server to. You will then have to add the old computer with the existing server to the cluster. To do this, on the old computer where you created the cluster, type pvecm add <nodename>
. Now you will have both nodes in the cluster.
Set up the rest of DRBD and you will be able to migrate the servers.
Also, it would be helpful to know which distro you are using :)
For clarification, I put in some comments after each paragraph in your question. let me know if this helps!
I need to migrate an existing server to DRBD by adding another machine.
I need to migrate an existing server to another machine using DRBD
Therefore I need to create a "single node" drbd cluster on the new system, migrate all existing data to the "cluster", then reconfigure the old server as a member of the cluster.
Therefore I need to create a cluster on the new machine, add the old machine into the cluster and configure DRBD between the two machines. (For learning purposes, you can create the cluster on either the old or new machine. The cluster has no "host" information)
I've set up the cluster on the new machine, however, how to proceed? I can't even start the drbd service as the other "node" doesn't even exist yet...
Add the old machine to cluster by running pvecm add <ip address of new machine >
on the OLD machine. If you get errors about the ssh key please comment. I have ways around that.
I'm starting up from a previous drbd configuration that worked fine... with two available nodes.
Any help appreciated.
(Not too sure what you need here)