Introduction
Pacemaker is a Cluster Resource Manager (CRM) that help running a service in a high availability mode. Using Pacemaker you can create small and large cluster of different services.
Tested On
OS: Amazon Linux AMI release 2012.03
Corosync version: 1.4.1
phpLDAPadmin version: 1.1.8
Hardware: Virtual Machine (AWS AMI)
Prerequisite
- Install Dependencies
yum install make libuuid-devel ncurses-libs kernel-devel flex libtool-ltdl-devel libtool-ltdl libtool libcurl-devel git ncurses-devel openssl-devel libselinux-devel cluster-glue-libs-devel libesmtp-devel lm_sensors-devel net-snmp-devel asciidoc help2man publican inkscape docbook-style-xsl corosync corosynclib-devel automake autoconf libtool-ltdl-devel pkgconfig python glib2-devel libxml2-devel libxslt-devel python-devel gcc-c++ bzip2-devel gnutls-devel pam-devel libqb-devel -y
- Install Pacemaker Repository
wget -O /etc/yum.repos.d/pacemaker.repo https://clusterlabs.org/rpm-next/rhel-6/clusterlabs.repo
- Install Pacemaker Repository
yum install libqb libqb-devel libaio-devel -y
DRBD Installation
- Download and Install drbd-utils
mkdir /usr/local/src/drbd cd /usr/local/src/drbd wget https://oss.linbit.com/drbd/8.3/drbd-8.3.11.tar.gz -O drbd.tar.gz tar zxf drbd.tar.gz cd drbd-* ./configure mkdir -p /usr/src/rpm/SOURCES make rpm rpm -Uvh /usr/src/rpm/RPMS/x86_64/drbd-utils-8.3.11-1.x86_64.rpm
- Configure drbd
cd /etc/drbd.d/ vi r0.res
resource r0 {
on ftp-1.humus.cloud {
device /dev/drbd1;
disk /dev/xvdf1;
address 192.168.11.12:7789;
meta-disk internal;
}
on ftp-2.humus.cloud {
device /dev/drbd1;
disk /dev/xvdf1;
address 192.168.21.12:7789;
meta-disk internal;
}
}
drbdadm create-md r0 modprobe drbd drbdadm up r0 drbdadm -- --overwrite-data-of-peer primary r0 drbdadm primary --force r0
- Check drbd status
cat /proc/drbd drbd-overview
- Create file system on the drbd device
mkfs.ext4 /dev/drbd1
Pacemaker Installation
- Download and install pacemaker
mkdir /usr/local/src/pacemaker cd /usr/local/src/pacemaker git clone git://github.com/ClusterLabs/pacemaker.git cd pacemaker ./autogen.sh export LIBS=/lib64/libtinfo.so.5 ./configure groupadd haclient useradd -g haclient hacluster make make install
- Install DRBD-Pacemaker package
rpm -Uvh /usr/src/rpm/RPMS/x86_64/drbd-pacemaker-8.3.11-1.x86_64.rpm
- Configure Corosync
vi /etc/corosync/corosync.conf
# Please read the corosync.conf.5 manual page
compatibility: whitetank
totem {
version: 2
secauth: off
interface {
member {
memberaddr: 192.168.11.12
}
member {
memberaddr: 192.168.21.12
}
ringnumber: 0
bindnetaddr: 192.168.11.12
mcastport: 5405
ttl: 1
}
transport: udpu
}
logging {
fileline: off
to_logfile: yes
to_syslog: no
debug: on
logfile: /var/log/cluster/corosync.log
debug: off
timestamp: on
logger_subsys {
subsys: AMF
debug: off
}
}
vi /etc/corosync/service.d/pcmk
service {
# Load the Pacemaker Cluster Resource Manager
name: pacemaker
ver: 1
}
- Start Corosync
service corosync start chkconfig corosync on
- Start Pacemaker
service pacemaker start chkconfig --add pacemaker chkconfig pacemaker on
Install crmsh For Cluster Configuration
- Download and Install Reusable Cluster Components (glue)
cd /usr/local/src/pacemaker wget https://hg.linux-ha.org/glue/archive/67224d37df80.tar.gz -O glue.tar.gz tar zxf glue.tar.gz cd Reusable-Cluster-Components-glue-* ./autogen.sh && ./configure && make && make install
- Download and Install crmsh
cd /usr/local/src/pacemaker wget https://hg.savannah.gnu.org/hgweb/crmsh/archive/tip.tar.gz -O crmsh.tar.gz tar zxf crmsh.tar.gz cd crmsh-* ./autogen.sh && ./configure && make && make install
- Download and Install ClusterLabs Resource Agents
cd /usr/local/src/pacemaker wget https://github.com/ClusterLabs/resource-agents/tarball/v3.9.2 -O ocf-scripts.tar.gz tar zxf ocf-scripts.tar.gz cd ClusterLabs-resource-agents-* ./autogen.sh && ./configure && make && make install