大网数据广告活动
服务器运维问答

Setting up DRBD with only one node

· 52CE 我爱测

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 c…

问题原文

原帖链接 · wazoox · CC BY-SA 3.0

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.

已采纳解答

原帖链接 · Matt Kereczman · CC BY-SA 3.0

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.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-07-05)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。