公式wikiのdrbdの通りにやってできた。
注意点
- すでに/dev/sdbにLVMを作っている場合、vgreduceとかしないといけない。
よくわからない場合はOS再インストールがよい。 - LVMだとkvmのみ格納できる。
- mkfs.ext4 /dev/drbd0してmountすればOpenVzでも使える。
- HA構成でfailover時、drbdを組んでいないサーバに移ると起動できないので注意。
/etc/fstab
+/dev/drbd0 /srv ext4 noauto 0 0
- /dev/drbd0 と /var/lib/vz/images/ 間の移動は
Move disk
から可能。
サイズが大きいので時間かかります。
セットアップ
# apt-get install -y drbd8-utils
/etc/drbd.d/global_common.conf
global { usage-count no; }
common {
syncer { rate 30M; verify-alg md5; }
handlers { out-of-sync "/usr/lib/drbd/notify-out-of-sync.sh root"; }
}
/etc/drbd.d/r0.res
resource r0 {
protocol C;
startup {
wfc-timeout 0; # non-zero wfc-timeout can be dangerous (http://forum.proxmox.com/threads/3465-Is-it-safe-to-use-wfc-timeout-in-DRBD-configuration)
degr-wfc-timeout 60;
become-primary-on both;
}
net {
cram-hmac-alg sha1;
shared-secret "my-secret";
allow-two-primaries;
after-sb-0pri discard-zero-changes;
after-sb-1pri discard-secondary;
after-sb-2pri disconnect;
#data-integrity-alg crc32c; # has to be enabled only for test and disabled for production use (check man drbd.conf, section "NOTES ON DATA INTEGRITY")
}
on proxmox-97 {
device /dev/drbd0;
disk /dev/pve/pve-drbd;
address 192.168.100.97:7788;
meta-disk internal;
}
on proxmox-62 {
device /dev/drbd0;
disk /dev/sdc1;
address 192.168.100.62:7788;
meta-disk internal;
}
disk {
# no-disk-barrier and no-disk-flushes should be applied only to systems with non-volatile (battery backed) controller caches.
# Follow links for more information:
# http://www.drbd.org/users-guide-8.3/s-throughput-tuning.html#s-tune-disable-barriers
# http://www.drbd.org/users-guide/s-throughput-tuning.html#s-tune-disable-barriers
no-disk-barrier;
no-disk-flushes;
}
}
リソースの初期化
# drbdadm create-md r0
md_offset 98213818368
al_offset 98213785600
bm_offset 98210787328
Found some data
==> This might destroy existing data! <==
Do you want to proceed?
[need to type 'yes' to confirm] yes
Writing meta data...
initializing activity log
NOT initialized bitmap
New drbd meta data block successfully created.