High availability is a crucial aspect of any website or web application, as it ensures that the website is always available and accessible to users, even in the event of server failures or other disruptions. One effective way to achieve high availability is through the use of heartbeat, a software program that monitors the status of servers in a network and automatically redirects incoming traffic to healthy servers in the event of a failure.

Heartbeat works by regularly checking the status of each server in the network, using a variety of techniques such as sending ping requests or checking for specific services to be running. If a server is found to be unhealthy, heartbeat will automatically redirect incoming traffic to other healthy servers in the network.

To achieve high availability with heartbeat, it is important to have multiple servers in the network, as this allows for redundancy and failover capabilities. These servers should be configured to run heartbeat, and should be monitored and managed carefully to ensure that they are always operating at their best.

In addition to providing high availability, heartbeat also offers other benefits, such as allowing for automatic scaling of the network to meet changing traffic needs, and providing detailed monitoring and reporting capabilities to help identify and troubleshoot potential issues.

How to achieve high availability with 100% uptime? We all know it is possible to have high availability website but the configuration might be too technical for some person. I have successfully simulated and achieve high availability web server using heartbeat software. Since we are using Centos 7, there are no binary heartbeat software for Centos 7, and we need to compile the software from a source code.

I simulate Heartbeat using only 4 servers. 2 servers for haproxy load balance share with heartbeat while 2 servers for web server. You can find the manual to install the haproxy here. Technically the simple diagram same as below;

To compile the software from source code, we need to install some software and library. Below software are required;

yum install -y gcc gcc-c++ autoconf automake libtool glib2-devel libxml2 libxml2-devel bzip2 bzip2-devel e2fsprogs-devel libxslt-devel libtool-ltdl-devel asciidoc

*Below package maybe required if you install minimal Centos

yum install -y psmisc cifs-utils nfs-utils OpenIPMI-libs openhpi perl-TimeDate sbd bc libuuid-devel

Next step is to download the source code;

wget -c http://hg.linux-ha.org/glue/archive/0a7add1d9996.tar.bz2
wget -c https://github.com/ClusterLabs/resource-agents/archive/v3.9.6.tar.gz
wget -c http://hg.linux-ha.org/heartbeat-STABLE_3_0/archive/958e11be8686.tar.bz2

Compile the Cluster-glue first. (you must extract 0a7add1d9996.tar.bz2)

./configure --prefix=/usr/local/heartbeat --with-daemon-user=hacluster --with-daemon-group=haclient --enable-fatal-warnings=no
make install

Compile Resource-agents next.

tar -zxvf resource-agents-3.9.6.tar.gz
cd resource-agents-3.9.6
./configure --prefix=/usr/local/heartbeat --with-daemon-user=hacluster --with-daemon-group=haclient --enable-fatal-warnings=no
make install

Compile the Heartbeat.

export CFLAGS="$CFLAGS -I/usr/local/heartbeat/include -L/usr/local/heartbeat/lib"
./configure --prefix=/usr/local/heartbeat --with-daemon-user=hacluster --with-daemon-group=haclient --enable-fatal-warnings=no
make install

Leave a Reply

Your email address will not be published. Required fields are marked *

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.