Friday, August 18, 2017

Configuration DRBD

1. install DRBD  > sudo apt install drbd8-utils
2.
To configure drbd, on the first host edit /etc/drbd.conf

global { usage-count no; }
common { syncer { rate 100M; } }
resource r0 {
        protocol C;
        startup {
                wfc-timeout  15;
                degr-wfc-timeout 60;
        }
        net {
                cram-hmac-alg sha1;
                shared-secret "secret";
        }
        on eoblas03 {
                device /dev/drbd0;
                disk /dev/sdb1;
                address 192.168.0.1:7788;
                meta-disk internal;
        }
        on eoblas03 {
                device /dev/drbd0;
                disk /dev/sdb1;
                address 192.168.0.2:7788;
                meta-disk internal;
        }
} 
 
3.  Now copy /etc/drbd.conf to the second host:
     scp /etc/drbd.conf drbd02:~
4.  Now using the drbdadm utility initialize the meta data storage.  On each server
          execute:
    suudo drbdadm create-md r0
5.  Next, on both hosts, start the drbd daemon:
    sudo systemctl start drbd.service 
 
6.  On the drbd01, or whichever host you wish to be the primary, enter the following:
    sudo drbdadm -- --overwrite-data-of-peer primary all 
 
7.  After executing the above command, the data will start syncing with the secondary host.  To watch the progress, on
          drbd02 enter the following:
    watch -n1 cat /proc/drbd
    To stop watching the output press Ctrl+c.
          
8.  Finally, add a filesystem to /dev/drbd0 and mount it:
    sudo mkfs.ext3 /dev/drbd0
    sudo mount /dev/drbd0 /srv 
 

No comments: