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

Notices

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

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


Hi,

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 192.168.10.82 and node02: 192.168.10.83

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

I have one external IP let's say: 96.xxx.xxx.xxx NAT'ed to 192.168.10.81

Both nodes have
Centos 6.3 minimal install
heartbeat-3.0.4-1
httpd 2

Here are the ha config files:

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

# cat /etc/ha.d/ha.cf
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 192.168.10.81 httpd

SO FAR:

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?

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

Original Poster
Rep: Reputation: 0
Anyone?
 
Old 01-15-2013, 10:13 PM   #3
briermay
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 192.168.10.81 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::192.168.10.81/24/eth0)
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::192.168.0.174/24/eth0 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
 
  


Reply

Tags
heartbeat


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


All times are GMT -5. The time now is 04:38 AM.

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