Listing 1. /etc/drbd.conf # Each resource is a configuration section for a # mirrored disk. # The drbd0 is the name we will use to refer # to this disk when starting or stopping it. resource drbd0 { protocol C; handlers { pri-on-incon-degr "echo 'DRBD: primary requested but inconsistent!' ↪| wall; /etc/init.d/heartbeat stop"; #"halt -f"; pri-lost-after-sb "echo 'DRBD: primary requested but lost!' ↪| wall; /etc/init.d/heartbeat stop"; #"halt -f"; } startup { degr-wfc-timeout 120; # 2 minutes. } disk { on-io-error detach; } # These are the network settings that worked best for me. # If you want to play around with them, go # ahead, but take a look in the man pages of drbd.conf # and drbdadm to see what each does. net { timeout 120; connect-int 20; ping-int 20; max-buffers 2048; max-epoch-size 2048; ko-count 30; # Remember to change this shared-secret on both the master # and slave machines. cram-hmac-alg "sha1"; shared-secret "FooFunFactory"; } syncer { rate 10M; al-extents 257; } # This next block defines the settings for the server # labeled as server1. This label should be in your # /etc/hosts file and point to a valid host. on server1 { # The following device will be created automatically by # the drbd kernel module when the DRBD # partition is in master mode and ready to write. # If you have more than one DRBD resource, name # this device drbd1, drbd2 and so forth. device /dev/drbd0 # Put the partition device name you've prepared here. disk /dev/sda5; # Now put the IP address of the primary server here. # Note: you will need to use a unique port number for # each resource. address 192.168.1.3:7788; meta-disk internal; } # This next block is identical to that of server1 but with # the appropriate settings of the server called # server2 in our /etc/hosts file. on server2 { device /dev/drbd0; disk /dev/sda5; address 192.168.1.2:7788; meta-disk internal; } }