Tag Archives: DRBD

How to compile DRBD RPM for XenServer 6.0

A few quick notes on compiling your own DRBD RPM for XenServer 6.0

1. Download the latest XenServer DDK ISO – Available from Citrix.com

2. Mount or Extract the ISO – Import into XenServer as a VM

3. Make sure you add a network connection

4. SSH onto the VM

You need to install gcc and libxslt to compile DRBD

> yum –enablerepo=base -y install gcc libxml2.i386 libxslt.i386

> mkdir drbd

> cd drbd

> wget http://oss.linbit.com/drbd/8.4/drbd-8.4.1.tar.gz

> tar -xvf drbd-8.4.1.tar.gz

> cd drbd-8.4.1.tar.gz

> ./configure

> make km-rpm

> make rpm

RPM file are created in /usr/src/redhat/RPMS/i386/

You need,

drbd-km-2.6.32.12_0.7.1.xs6.0.0.529.170661xen-8.4.1-1.i386.rpm
drbd-utils-8.4.1-1.i386.rpm

Thats it enjoy!

DRBD RPM for Xen Server 6.0

Here is the latest RPM for Xen Server 6 – I haven’t had a chance to test XenServer 6.0 with DRBD local storage.

Download: http://bit.ly/v2S86L

I’m hopeful it will work without having to patch the Kernel – same as 5.6 FP2

If you have a chance let me know if it works.

******Update******

Here is the RPM for the latest Kernel drbd-km-2.6.32.12_0.7.1.xs6.0.0.529.170661xen-8.4.1-1.i386

Download here: http://bit.ly/zV9jVI

Cheers, Joe

XenServer 5.6 FP1 DRBD working

Xenlogo

Hi all,

The wait is over so to speak, XenServer 5.6 FP1 was released over a month ago but DRBD wouldn’t work due to a bug in blktap2,

The issue was highlighted by Tomoe Sugihara on the Xen-Api mailing list prior to FP1 being released – http://lists.xensource.com/archives/html/xen-api/2010-12/msg00001.html

There is mention of a couple of patches but neither of them fixed the issue – it was necessary to download the latest Soruce from the Xen Cloud Project release 1 RC1 and use the blktap2 source files.

The steps to make it work, Very simple,

1. Download the patched Kernel RPM (Link below)

2. Use WinSCP or similar to load it onto your XenServer

3. Login as root on the console

4. Run # rpm -ivh kernel-2.6.32.120.7.1.xs5.6.100.307.170586xen-1.i386.rpm –force

5. Reboot

This will replace the current kernel with the patched one.

That’s it DRBD is working now

Enjoy and let me know how it goes.

Cheers, Joe

If you already have DRBD installed and setup before installing the Kernel – you will need to reinstall the DRBD RPM, modprobe & start DRBD

Just run

# rpm -ivh drbd-km-2.6.32.12_0.7.1.xs5.6.100.307.170586xen-8.3.10-1.i386.rpm –force

# /etc/init.d/drbd start

# modprobe drbd

Direct link download Kernel + Utilities: http://tinyurl.com/6xr4g6h

For installing DRBD with XenServer including the latest release 8.3.10 please see http://joekane.eu/xenserver-drbd-update-4-the-guide

DRBD for Off-Site Disaster Recovery

DRBD for Off-Site Disaster Recovery

on Ubuntu Hardy

Issue

A local machine (server) is to be provided with off-site disaster recovery(backup). The off-site location is accessible via the public Internet withreasonable bandwidth (100 Mbit/s).

DRBD is a distributed block level remote replicationsolution. Initially it was designed for machines sitting side by site with adedicated network link between them. It does work well for remote setupslike this one here as well, given proper tuning.

OpenVPN is ‘the standard’ VPN system for Linux itprovides compressed VPN connections with minimal setup requirements.

Interesting read – Notes

XenServer + DRBD (Update 5) Failover Process

James White from the Citrix Forum (This Thread) asked for a video of VM failover if the Pool Master dies, This was part of my testing to I will add the guide.

Very impressed by how well it works!!!

See the DRBD install guide for my setup.

So the Pool Master has failed and is unrecoverable – all your VM’s are down – how to get them backup and running.

SSH onto a pool member (This will act as your new Pool Master)

- Convert your Member to a Master

$ xe pool-emergency-transition-to-master

- Recover connections to other member servers. (If Any)

$ xe pool-recover-slaves

- Verify the pool management has been restored

$ xe host-list

- Show the list of Pool members

$ xe host-list params=uuid,name-label,host-metrics-live

- Show the VM’s from the Failed Server – You will see their state as “Running”

$ xe vm-list is-control-domain=false resident-on=UUID_of_failed_server

- Reset the powerstate for all VM’s

$ xe vm-reset-powerstate resident-on=UUID_of_failed_server –force –multiple

Now all VM’s will be visable on XenCenter – Login to the Member server IP (The new Master) and Start your VM’s

——————

When you recover the old Master simply boot it up and recover the DRBD replication

restart DRBDon both servers

$ /etc/init.d/drbd restart

$ drbdadm — –overwrite-data-of-peer primary drbd-sr1 (On the New Master server)

$ drbdadm primary drbd-sr1 (On the Old Master)

Let me know how it works for you.

Cheers, Joe

DRBD + 10gig network

my intel cards are the supermicro aoc-stg-i2. i can't find the card on supermicro site any more but it is very similar to the aoc-utg-i2 which is still listed. both just use the 82598EB chip. only difference is the form factor.
my chelsio cards are the N320E-CXA.mike

Just ordered 2x Chelsio N320E 10Gig Cards for the production DRBD setup – Interesting that the Intel cards dont play nice with DRBD.

XenServer + DRBD (Update 4) The Guide

drbd guide

*** Is you are using XenSever 5.6 FP1 please see http://joekane.eu/xenserver-56-fp1-drbd-working first.

Here is the DRBD + XenServer install guide, Any issues post a comment and I’ll try my best to resolve.

###### DRBD + Xenserver Guide: JoeKane.eu ########

Create DRBD RPM for installation on XenServer

Download the Driver Development Kit (ISO) from http://www.citrix.com/lang/English/lp/lp_1688621.asp
Mount or Extract the ISO and import using XenCenter – Be sure to select XML as file type
$ mkdir /drbd/
$ cd /drbd/
$ wget http://oss.linbit.com/drbd/8.3/drbd-8.3.7.tar.gz
$ tar drbd-8.3.7.tar.gz
$ cd /drbd-8.3.7
$  ./configure –enable-spec –with-km
$ make tgz
$ cp drbd*.tar.gz `rpm -E _sourcedir`
$ rpmbuild -bb drbd.spec
$ rpmbuild -bb drbd-km.spec

RPM is located in /usr/src/redhat/RPMS/i386/

See: http://www.drbd.org/users-guide/s-build-rpm.html

If you want to skip this step I have attached the RPM’s needed!

Download RPM’s:

DRBD 8.3.7 + XenServer 5.5 U2 RPM: http://bit.ly/dmvv0g

DRBD 8.3.7 + XenServer 5.6 Beta RPM: http://bit.ly/9hHNEt

DRBD 8.3.7 + XenServer 5.6 Final RPM: http://bit.ly/diYtbY

DRBD 8.3.8.1 + XenServer 5.6 Final RPM: http://bit.ly/cNboke

If you are using XenSever 5.6 FP1 please see http://joekane.eu/xenserver-56-fp1-drbd-working first.

—————————————————————————

Install XenServer 5.5 U2 on each server – Don’t configure local storage – Connect the servers together using a crossover cable.
My setup has 1x 80GB drive for XenServer install and 1x 250GB drive for the DRBD storage

1.    Install DRBD (Both Servers)

Copy drbd-km-2.6.18_128.1.6.el5.xs5.5.0.505.1024xen-8.3.7-12.i386.rpm & drbd-utils-8.3.7-1.i386.rpm to your XenServer /tmp directories – Use Winscp for this

$ rpm -ivh drbd-utils-8.3.7-1.i386.rpm
$ rpm -ivh drbd-km-2.6.18_128.1.6.el5.xs5.5.0.505.1024xen-8.3.7-12.i386.rpm

2.     Configure another Management Nic’s for each XenServer

The IP addresses I’m using are 10.1.1.1 & 10.1.1.2 (255.255.255.0 netmask)

3.    Fdisk the Drives (Both Servers)
Be sure to configure your Drive using Fdisk, you can see your partition table using
$ Fdisk –l
I won’t go into too much detail here; fdisk is very easy to use, in my setup I have the 250GB as /dev/sda and a single partition /dev/sda1

4.    Configure DRBD (Both Servers)

 Nano /etc/drbd.conf

# ———————-
# You can find an example in  /usr/share/doc/drbd…/drbd.conf.example

#include “drbd.d/global_common.conf”;
#include “drbd.d/*.res”;

resource drbd-sr1 {
protocol C;
startup {
}

disk { max-bio-bvecs 1;
}

net {
allow-two-primaries;
cram-hmac-alg “sha1″;
shared-secret “password”;
after-sb-0pri discard-zero-changes;
after-sb-1pri consensus;
after-sb-2pri disconnect;
}

syncer {
rate 1G;
}

on xenserver-drbd1 {
device /dev/drbd1;
disk /dev/sda1;
address 10.1.1.1:7789;
meta-disk internal;
}
on xenserver-drbd2 {
device /dev/drbd1;
disk /dev/sda1;
address 10.1.1.2:7789;
meta-disk internal;
}
}
# ——————–

4. Configure Notifications in case of Split brain. (Both Servers)

nano /usr/lib/drbd/notify.sh

# Add to the bottom of the file

esac

#echo “$BODY” | mail -s “$SUBJECT” $RECIPIENT
HOST_UUID=`xe host-list –minimal`
xe message-create body=”$BODY” host-uuid=$HOST_UUID name=DRBD_ATERT priority=10

#I also changed the “BODY” message because it was received empty.

case “$0″ in
*split-brain.sh)
SUBJECT=”DRBD split brain on resource $DRBD_RESOURCE”
BODY=” Split brain detected, Manual split brain recovery is necessary! “
# BODY=”
#DRBD has detected split brain on resource $DRBD_RESOURCE
#between $(hostname) and $DRBD_PEER.
#Please rectify this immediately.
#Please see http://www.drbd.org/users-guide/s-resolve-split-brain.html for details on doing so.”
;;

——————————-

5.    Allow port 7788 through Iptables (Both Servers)

Get your interface alias using $ ifconfig

(Thanks Sam)

Ifconfig

——————————-
$ iptables -I INPUT 1 -i xenbr2 -p tcp –dport 7788:7799 -j ACCEPT
$ /etc/init.d/iptables save
——————————-

6.    Configure LVM to see your Drive (Both Servers)

nano /etc/lvm/lvm.conf

# By default we accept every block device:

Add your block device “r|/dev/sda.*|” to the filter,

e.g. filter = [ "r|/dev/xvd.|", "r|/dev/sda.*|" ]

#Set the write cache state to 0 default is 1

write_cache_state = 0

———————————

7. Remove LVM Cache (Thanks PF4)

rm -f /etc/lvm/cache/.cache

——————————–

8.    Create Xenserver pool using XenCenter

———————————

9.    Enable DRBD Storage and Replicate

On both XenServers execute the following

$ drbdadm create-md drbd-sr1
$ modprobe drbd
$ drbdadm up drbd-sr1

Now ONLY on the XenServer that will be your primary

$ drbdadm — –overwrite-data-of-peer primary drbd-sr1
$ cat /proc/drbd

After Full Sync – Make pool secondary drbd primary “$ drbdadm primary drbd-sr1″

$ cat /proc/drbd will not show Primary:Primary

10.    Create Storage Repository

$ xe sr-create shared=true device-config:device=”/dev/drbd1″ name-label=”DRBD-SR1″ type=lvm

$ chkconfig drbd on (on both XenServers)

That’s it – install your VM’s and test VM migration.
Any Questions post a comment.

Thanks go to,
Florian Haas from linbit.com (The Makers of DRBD): http://fghaas.wordpress.com/2007/09/03/drbd-806-brings-full-live-migration-fo…
Natanael Mignon of http://natanael-mignon.blogspot.com/ – Gave the starting steps to get everything working.
Citrix for providing XenServer and the Citrix Forums
Loads of website related to DRBD configs and the DRBD Mailing list.

*** Small Update – Dont forget to add the names of your servers to /etc/hosts using your crossover IP addresses