Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 07-28-2012, 09:56 AM   #1
LQ Newbie
Registered: Feb 2009
Posts: 3

Rep: Reputation: 0
High Availability and Failover with Centos 6.3


My aim is to setup a high-availability and failover setup for a webserver. I am a total newbie on this so I had quite a bit to read on this. I also followed a few tutorials/howtos on the web but without 100% success.

Here is my setup:

I have two machines with internal IPs, let's say: node01 and node02:

node01 also has a virtual IP, which is supposed to move between node01 and node02 in case of failover.

I have one external IP let's say: NAT'ed to

Both nodes have
Centos 6.3 minimal install
httpd 2

Here are the ha config files:

# cat /etc/ha.d/authkeys
auth 2
2 sha1 test-ha

# cat /etc/ha.d/
logfile /var/log/ha-log
logfacility local0
keepalive 2
deadtime 30
initdead 120
bcast eth0
udpport 694
auto_failback on
node node01
node node02

# cat /etc/ha.d/haresources
node01 httpd


If I shutdown heartbeat on node01, httpd automatically switches to node02.

However, if I shutdown just httpd on node01, the switch doesn't happen.

What I want to achieve is this:

If httpd fails, or mysqld fails, I want the virtual IP automatically switching to node01.

How can I achieve this?

Old 07-29-2012, 09:33 AM   #2
LQ Newbie
Registered: Feb 2009
Posts: 3

Original Poster
Rep: Reputation: 0
Old 01-15-2013, 10:13 PM   #3
LQ Newbie
Registered: Jan 2013
Posts: 2

Rep: Reputation: Disabled
Heartbeat does not work for Services directly
you would need a service monitoring script for that

heartbeat will only kick in on the slave if the other heartbeat itself shuts-down (network card issue, machine dies, etc) not if a service dies.
it doesn't care about whether Apache, bind, MySQL or any other service is running.

people often confuse what the haresources file actually does

lets break it down:
node01 httpd

the first word is the master node
then you have the virtual ip which by the way the "proper" syntax is IPaddr::ip/subnetmask/Ethernet-device (ex IPaddr::
next thing is a space separated list of services

a lot of times the list of services gets confused for what heartbeat monitors where its just what heartbeat starts (if master) and stops (if slave)
if you put for example

server1 IPaddr:: httpd mysql nfs-kernel-server

then heartbeat when master will execute:

service httpd start
service mysql start
service nfs-kernel-server start

and when as slave

service httpd stop
service mysql stop
service nfs-kernel-server stop

as you see its not monitoring them its just starting and stopping them
some services require the ip set *before* starting (without sysctl hacks) and that's why heartbeat works like this



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
High Availability (HA) and Load Balancing on single centos-6 or redhat-6 cluster linuxrndblog Linux - Server 8 12-02-2011 11:25 AM
LXer: High-Availability Storage With GlusterFS On CentOS 5.4 LXer Syndicated Linux News 0 03-19-2010 01:20 PM
[SOLVED] Linux high performance and high availability clustering Blue_Ice Linux - Software 2 03-27-2009 04:49 AM
LXer: Setting Up A High-Availability Load Balancer (With Failover and Session Support LXer Syndicated Linux News 0 11-07-2007 10:00 PM
LXer: Setting Up A High-Availability Load Balancer (With Failover and Session Support LXer Syndicated Linux News 0 10-29-2007 08:20 AM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:28 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration