Changes

Jump to: navigation, search

HA cluster with DRBD and Heartbeat

3,529 bytes added, 07:09, 1 October 2011
m
Reverted edits by 189.3.215.146 (talk) to last revision by Kir
3wMokG <== Prerequisites ==The OpenVZ kernel already includes the DRBD module. The DRBD userspace tools and the cluster manager Heartbeat must be provided seperately. As the API version of the DRBD userspace tools must exactly match the API version of the module, compile them yourself. Also compile Heartbeat yourself, as at the time of this writing the CentOS extras repository only contained an old CVS version of Heartbeat. On a hardware node for production use there should not be any application that is not really needed for running OpenVZ (any things which are not needed by OpenVZ should run in a VE for security reasons). As a result, compile DRBD and Heartbeat on another machine running CentOS 4.3 (in this example I used a virtual machine on a hrefVMware Server). === Compiling Heartbeat =="=Heartbeat version 1.2.* has successfully been used in a lot of two-node-clusters around the world. As the codebase used in version 1.2.* is in production use for many years now, the code is very stable. At the time of writing, Heartbeat version 1.2.4 is the current version of the 1.2.* branch. Get the tar.gz of the current version of the 1.2.* branch from http://linux-ha.org/download/index.html, at the time of this writing this is http://xbjrbmuwoktflinux-ha.comorg/download/"heartbeat-1.2.4.tar.gz. Use rpmbuild to build the package:<pre>xbjrbmuwoktfrpmbuild -ta heartbeat-1.2.4.tar.gz</pre>After that, you find four rpm packes in /usr/src/redhat/RPMS/i386 (heartbeat-1.2.4-1.i386.rpm, heartbeat-ldirectord-1.2.4-1.i386.rpm, heartbeat-pils-1.2.4-1.i386.rpm, heartbeat-stonith-1.2.4-1.i386.rpm). In this example only heartbeat-1.2.4-1.i386.rpm, heartbeat-pils-1.2.4-1.i386.rpm, and heartbeat-stonith-1.2.4-1.i386.rpm are needed. === Compiling DRBD userspace tools ===When compiling the DRBD userspace tools, you have to take care to take the version that matches the DRBD version that is included in the OpenVZ kernel you want to use. If you are unsure about the version, do the following steps while running the OpenVZ kernel that you want to use on a test machine (I used another virtual machine on aVMware server to try this):<pre>, [url=httproot@testmachine ~]# cat /proc/versionLinux version 2.6.8-022stab078.10 (root@rhel4-32) (gcc version 3.4.5 20051201 (Red Hat 3.4.5-2)) #1 Wed Jun 21 12:01:20 MSD 2006[root@testmachine ~]# modprobe drbd[root@testmachine ~]# cat /proc/bxxlefalafktdrbdversion: 0.com7.17 (api:77/proto:74)SVN Revision: 2093 build by phil@mescal, 2006-03-06 15:04:12 0: cs:Unconfigured 1: cs:Unconfigured[root@testmachine ~]bxxlefalafkt# rmmod drbd[root@testmachine ~]#</urlpre>Here the version of the DRBD module is 0.7.17. So the userspace tools for 0.7.17 are neccessary. Back on the buildmachine, do the following to create the rpm:<pre>[root@buildmachine ~], # yum install kernel-devel gcc bison flexSetting up Install ProcessSetting up repositoriesReading repository metadata in from local filesParsing package install argumentsNothing to do[root@buildmachine ~]# tar xfz drbd-0.7.17.tar.gz[root@buildmachine ~]# cd drbd-0.7.17[root@buildmachine drbd-0.7.17]# make rpm[link=http...]You have now:-rw-r--r-- 1 root root 288728 Jul 30 10:40 dist/RPMS/zvxbehoiawyei386/drbd-0.7.17-1.i386.comrpm-rw-r--r-- 1 root root 518369 Jul 30 10:40 dist/RPMS/i386/drbd-km-2.6.9_34.0.2.EL-0.7.17-1.i386.rpm[root@buildmachine drbd-0.7.17]zvxbehoiawye[#</link]pre>Note that in this way the kernel-devel from CentOS is used, but this does not matter as the created drbd-km rpm will not be used (the DRBD kernel module is already included in OpenVZ kernel). If the kernel-devel package is not the same version as the kernel package that is currently running, http:it is possible to execute 'make rpm KDIR=/usr/src/kernels/djtxdwzhtuou2.6.9-34.0.com2.EL-i686/' to directly point to the kernel sources.
== Installing the two nodes ==

Navigation menu