Skip to content

IP failover with UCARP on CentOS

March 11, 2010

UCARP allow two or more hosts share a common IP address providing a fail over solution , my example uses two hosts:

#host 1 – bob
Real IP: 10.1.2.4

#host 2 – joe
Real IP: 10.1.2.6

Virtual IP: 10.1.2.5

Make sure that bob and joe is communicating.

## UCARP installation on both is same:

# yum install ucarp -y

It depends repository EPEL installed and enabled, more information about look at http://fedoraproject.org/wiki/EPEL

## Basic Configuration ( bob )

Create a copy of example file for our personal configuration

# cp /etc/ucarp/vip-001.conf.example /etc/ucarp/vip-001.conf

Edit new file as described below:

#bob’s ID
ID=001

# Network Interface
BIND_INTERFACE=”eth0″

#Real bob’s IP
SOURCE_ADDRESS=”10.1.2.4″

# Virtual IP
VIP_ADDRESS=”10.1.2.5″

# Carp Password
PASSWORD=”vip-pw”

# Other Options, see documentation for more information
OPTIONS=”–shutdown –preempt”

## Basic Configuration ( joe )

Create a copy of example file for our personal configuration

# cp /etc/ucarp/vip-001.conf.example /etc/ucarp/vip-001.conf

Edit new file as described below:

#joe’s ID – make sure its the same on all nodes
ID=001

# Network Interface
BIND_INTERFACE=”eth0″

#Real bob’s IP
SOURCE_ADDRESS=”10.1.2.6″

# Virtual IP
VIP_ADDRESS=”10.1.2.5″

# Carp Password
PASSWORD=”vip-pw”

# Other Options, see documentation for more information
OPTIONS=”–shutdown –preempt”

PASSWORD and VIP_ADDRESS must be same on both hosts

## Start UCARP

bob# service ucarp start

joe# service ucarp start

My purpose here is a fail over solution for a Web server I have here, I tested this way:

turned off bob and looked if I still accessing my web server, I noticed some delay ( around 10-30s ), after it all working fine, of course you have to think about your app because it must be synchronized, if not, when host1 has down time, host2 will be outdated…

I wanted only show my experience testing fail over using ucarp, until today, I didn’t know ucarp

Thanks to Brian…

About these ads

From → Foss, Linux

3 Comments
  1. Brian Schonecker permalink

    The IDs of each node must match, otherwise BOTH nodes will will assume the VIP to be active on themselves. I did some testing and when you make the ID parameter different, ucarp doesn’t behave properly. When the IDs are the same, ucarp behaves perfectly.

  2. S.A. Baker permalink

    Differences with ucarp-1.5.2-1.el5.rf on CentOS 5.5.
    You won’t find the SOURCE_ADDRESS or VIP_ADDRESS in the example vip-XXX.conf , but you will find VIP_INTERFACE.

    So now it points you into the ‘normal’ location of the interface definition of CentOS dist.

Trackbacks & Pingbacks

  1. Bonding + VLAN + Heartbeat ou UCARP (Debian/RedHat like) | Djames Suhanko – Linux e Programação

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: