Posts

Showing posts from December, 2010

Howto make your private VM Cluster, Part III

Continuing with my saga , next up is DRBD . I'm using DRBD because I also want to test it as a viable alternative for network raid . To use DRBD I first created a LVM volume to use: lvcreate -n drbd-demo -L 100M internal-hd Then I configured DRBD on both nodes, fortunately gentoo simplifies a great part of the process (you have to do this on both nodes): cd /etc cp /usr/share/doc/drbd-*/drbd.conf.bz2 . bunzip2 drbd.conf.bz2 Then I created a wwwdata resource by first configuring it (again on both nodes). This is done by creating a file /etc/drbd.d/wwwdata.res with the contents: resource wwwdata { meta-disk internal; device /dev/drbd1; syncer { verify-alg sha1; } net { allow-two-primaries; } on node1 { disk /dev/mapper/internalhd-drbd--demo; address 192.168.100.10:7789; } on node2 { disk /dev/mapper/internalhd-drbd--demo; address 192.168.100.11:7789; } } I added the drbd module

Howto make your private VM Cluster, Part II

In the previous entry I showed how to build the basic structure for your own private VM Cluster. Today I'm going to show you how to create a cluster with two VMs that provides High-Availability for a WebServer using DRBD to replicate the Web Site. First you need to create a virtual machine. I decided to create a VM with Gentoo . I will use LVM to keep the partition to use for drbd small since this is a simple test. I created a qemu-img for a base gentoo installation (my goal is to install gentoo on the VM and then reuse it as base for the other VMs). To create the image just run: qemu-img create -f qcow2 gentoo.qcow2 10G I started the VM using that image and followed Gentoo's installation guide . My partition scheme was 100Mb (boot), 512Mb (swap), 5Gb (root), rest for lvm. I used the gentoo-sources, configuring all virtio devices, drbd and the device-mapper. I configured genkernel to use lvm so it detects the lvm volumes at boot. I used grub and added all the genkern

Howto make your private VM Cluster, Part I

I wanted to make some experiments with DRBD , pacemaker and others. The goal is to test a few configurations for an high availability scenario. Since I don't want to make changes to my machine the solution is to use Virtual Machines. I decided to go all open source and use KVM . Since I want more that a single VM I decided to setup a private bridge to which all the VMs would connect. The bridge would provide DHCP and DNS services and NAT + Firewall to the internet. I use Gentoo . If you use another distribution or firewall tool you should adapt these instructions and scripts to fit your needs. First I created a script that sets up my bridge. The script is as follows (I called it setupBridge): # !/bin/ bash set -x # Setup the bridge sudo brctl addbr br0 sudo ifconfig br0 192.168.100.1 netmask 255.255.255.0 up # Launch DNS and DHCP Server on br0 sudo dnsmasq -q -a 192.168.100.1 --dhcp-range=192.168.100.50,192.168.100.150,forever --pid-file=/tmp/br0-dnsmasq.pid # Launch updated fire