mirror, mirror on the wall

mirror, mirror on the wall

CentOS (5.5) drbd configuration

Posted on .

The configuration is with two nodes:
  • node01 - 192.168.100.68
  • node02 - 192.168.100.69
The following commands should be executed on the both hosts.

# yum install drbd kmod-drbd
# vim /etc/drbd.conf
global { usage-count no; }
resource repdata {
  protocol C;
  startup { wfc-timeout 0; degr-wfc-timeout     120; }
  disk { on-io-error detach; } # or panic, ...
  net {  cram-hmac-alg "sha1"; shared-secret "Cent0Salmostrulez"; } # choose a secret for auth !
  syncer { rate 10M; }
  on node01 {
    device /dev/drbd0;
    disk /dev/sdb;
    address 192.168.100.68:7788;
    meta-disk internal;
  }
  on node02 {
    device /dev/drbd0;
    disk /dev/sdb;
    address 192.168.100.69:7788;
    meta-disk internal;
  }
}
The following commands should be executed only on node01 host.

drbdadm create-md repdata
# /etc/init.d/drbd start
# drbdadm -- --overwrite-data-of-peer primary repdata
# watch -n 1 cat /proc/drbd
# mkfs.ext3 /dev/drbd0
# mkdir /drbd
# mount /dev/dbrd0 /drbd

If want to access the drbd device on node02.

On node01:

# umount /drbd
# drbdadm secondary repdata

On node02:

# drbdadm primary repdata
# mount /dev/drbd0 /drbd

Summary: At the same time only one of the hosts can operate with the shared block devices. They are will be replicated but will be on the different machines (different IP addresses) and will be more difficult to make them working like one machine and become useful for our data replication solution.

About

github

Creative Commons

RSS