apt-get install drbd8-utils
resource r0 { protocol C; handlers { } startup { degr-wfc-timeout 120; outdated-wfc-timeout 2; } disk { on-io-error detach; } net { after-sb-0pri discard-younger-primary; after-sb-1pri consensus; after-sb-2pri disconnect; rr-conflict disconnect; cram-hmac-alg "sha1"; shared-secret "mon_sercret"; } syncer { rate 90M; al-extents 257; } on srvvirt1 { device /dev/drbd0; disk /dev/vg_srv1/drbd0; address 172.20.0.6:7788; meta-disk internal; } on srvvirt2 { device /dev/drbd0; disk /dev/vg_srv2/drbd0; address 172.20.0.7:7788; meta-disk internal; } }
drbdadm create-md r0
/etc/init.d/drbd restart
drbdadm -- --overwrite-data-of-peer primary r0
apt-get install drbd8-utils
resource r0 { protocol C; handlers { } startup { degr-wfc-timeout 120; outdated-wfc-timeout 2; become-primary-on both; } disk { on-io-error detach; } net { after-sb-0pri discard-younger-primary; after-sb-1pri consensus; after-sb-2pri disconnect; rr-conflict disconnect; allow-two-primaries; cram-hmac-alg "sha1"; shared-secret "mon_sercret"; } syncer { rate 90M; al-extents 257; } on srvvirt1 { device /dev/drbd0; disk /dev/vg_srv1/drbd0; address 172.20.0.6:7788; meta-disk internal; } on srvvirt2 { device /dev/drbd0; disk /dev/vg_srv2/drbd0; address 172.20.0.7:7788; meta-disk internal; } }
drbdadm create-md r0
/etc/init.d/drbd restart
drbdadmn up r0
drbdadm -- --overwrite-data-of-peer primary r0
drbdadm primary r0
drbdadmin remove /dev/drbd0
Partons du principe qu'une ressource myvol partagé entre les machines hyp01 et hyp02 dans un LV myvol des VG LVM respectifs vg_hypXX :
lvresize -L+[size]G /dev/vg_hypXX/myvol
drbdadm resize myvol
resize2fs /dev/drbd0
Exemple :
handlers { pri-on-incon-degr "echo o > /proc/sysrq-trigger ; halt -f"; pri-lost-after-sb "echo o > /proc/sysrq-trigger ; halt -f"; local-io-error "echo o > /proc/sysrq-trigger ; halt -f"; }
Lorsque la communication entre les serveurs a été interrompu et que les périphériques DRBD sont donc désynchronisé, il faut :
drbdadm secondary r0 drbdadm -- --discard-my-data connect r0
drbdadm connect r0
La synchronisation des données démarre alors, on peut suivre son état via la comande :
cat /proc/drbd
drbdadm -- --overwrite-data-of-peer primary r0