Installing and Configuring DRBD on Ubuntu 10.04


In the following setup we have two servers with Ubuntu 10.04 server edition installed.

Tasks to be performed on both the Nodes

Pre-installation tasks

Create a new partition either in same or a different HDD. This partition will be used by DRBD after it is specified in DRBD.conf.

Installing DRBD

sudo apt-get install drbd8-utils

Initial configuration

Edit the file /etc/drbd.conf, remove all the lines in the file and add the following lines

include "drbd.d/global_common.conf";
resource r0 {
protocol C;
startup {
wfc-timeout 15;
degr-wfc-timeout 60;
}
net {
cram-hmac-alg sha1;
shared-secret "secret";
}
on storage1 {
device /dev/drbd0;
disk /dev/<partition>;
address <ip-address-of-node-1>:7788;
meta-disk internal;
}
on storage2 {
device /dev/drbd0;
disk /dev/<partition>;
address <ip-address-of-node-2>:7788;
meta-disk internal;
}
}

In case DNS server is not present in the network, add appropriate entries in the /etc/hosts file.
Edit the file /etc/drbd.d/global_common.conf and edit the line as follows

global { usage-count no; }
syncer
{
# rate after al-extents use-rle cpu-mask verify-alg csums-alg
rate 1000M;
}

Run the following command to initiate meta data area

 $ sudo  drbdadm create-md r0 

Start the DRBD service using the following command

 $ sudo /etc/init.d/drbd start 

Tasks to be performed in the primary node

On the primary server run the following command

 $ sudo drbdadm -- --overwrite-data-of-peer primary all 

To add a filesystem to /dev/drbd0, run the following command

 $ sudo mkfs.ext3 /dev/drbd0 

Mount the file-system created in /srv directory using the following command

 $ sudo mount /dev/drbd0 /srv 
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s