How to Install Pacemaker in Amazon Cloud Machine Image (AMI)

How to Install Pacemaker in Amazon Cloud Machine Image (AMI)

Pacemaker ClusterLabs logoPacemaker is an open source, high availability resource manager suitable for both small and large clusters. It supports many deployment scenarios and can dramatically reduce hardware costs by allowing several active/passive clusters to be combined to share a common backup node. It monitors the system for hardware and software failures, using advanced algorithms to automatically recover applications in the event of a failure.

In this article, Yossi Nachum of Emind Systems gives a step-by-step guide to installing Pacemaker in Amazon AMI.

How to Install Pacemaker in Amazon AMI

Tested On

OS: Amazon Linux AMI release 2021.03
Corosync version: 1.4.1
phpLDAPadmin version: 1.1.8
Hardware: Virtual Machine (AWS AMI)

Prerequisite

1. 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

2. Install Pacemaker Repository

wget -O /etc/yum.repos.d/pacemaker.repo http://clusterlabs.org/rpm-next/rhel-6/clusterlabs.repo

3. Install Pacemaker Repository

yum install libqb libqb-devel libaio-devel -y

DRBD Installation

4. Download and Install drbd-utils

mkdir /usr/local/src/drbd
cd /usr/local/src/drbd
wget http://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

5. 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

6. Check drbd status

cat /proc/drbd
drbd-overview

7. Create file system on the drbd device

mkfs.ext4 /dev/drbd1

[See your cost centers, business units, P&L structures within your organization and the actual consumption of the associated Cloud infrastructure. Be able to track, account and analyze their precise usage and spend. Align your revenues with your costs, see how you can increase margins and profits from this correlation.

Sign up to Newvem For Free]


Pacemaker Installation

8. 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

9. Install DRBD-Pacemaker package

rpm -Uvh /usr/src/rpm/RPMS/x86_64/drbd-pacemaker-8.3.11-1.x86_64.rpm

10. 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
}

11. Start Corosync

service corosync start
chkconfig corosync on

12. Start Pacemaker

service pacemaker start
chkconfig --add pacemaker
chkconfig pacemaker on

Install crmsh For Cluster Configuration

13. Download and Install Reusable Cluster Components (glue)

cd /usr/local/src/pacemaker
wget http://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

14. Download and Install crmsh

cd /usr/local/src/pacemaker
wget http://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

15. 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

 


[Newvem analytics tracks your AWS cloud utilization:

  • Hourly Utilization Pattern Analysis 
  • Reserved Instances Decision Tool 
  • Resource Resizing Opportunities

Get Started For Free or Learn More]


About the Author

Yossi Nachum Emind

 

 

 

Yossi Nachum, DevOps Team Leader at Emind Systems, has more than a decade of experience as an IT systems engineer. He has extensive knowledge in open source systems as well as Unix/Linux operating systems. In addition to leading DevOps at Emind Systems, Nachum also offers his expertise as an IT consultant to the Israeli Air Force.

Emind Systems – a certified Amazon Solution Provider and Consulting Partner – proudly offers goCloud, the field-proven and assured route to effective hosting of your system in the cloud. Emind have developed goCloud to provide us with the power to smoothly design, deploy, manage, and maintain secure high-availability production environments in the cloud.

Keywords: Pacemaker, IT Automation, Applications Deployment, Cloud Management, Cloud Scalability,  Amazon AMI, ClusterLabs Resource Agents, Amazon Machine Image

You must be to post a comment.

* As a bonus, you'll receive our weekly newsletter!

Hitchhiker's Guide to The Cloud

Newvem's eBook for Cloud Operations