Keepalived is used for IP failover between two servers. It facilities for load balancing and high-availability to Linux based infrastructures. It works on VRRP ( Virtual Router Redundancy Protocol ) protocol. We have running two load balance servers using HAProxy and now we need to implement VRRP between both servers. This tutorial will help you to configure KeepAlived, Use this tutorial to configure HAProxy on both servers.
Network Scenario:
1. LB1 Server: 192.168.10.111 ( eth1 )
2. LB2 Server: 192.168.10.112 ( eth1 )
3. Virtual IP: 192.168.10.121
Now we are implementing ip failover setup between LB1 and LB2 servers.
Graphical representation of Fail over Setup:
Step 1: Install Required Packages
Use following command to install required packages to configure Keepalived on server.
# yum install gcc kernel-headers kernel-devel
Step 2: Install Keepalived
Keepalived is available in centos base repository. Install it using yum command line tool.
# yum install keepalived
Keepalived configuration File: /etc/keepalived/keepalived.conf
Step 3: Configure Keepalived on LB1.
Edit Keepalived configuration file on LB1 and add following configuration. Update all red highlighted values with your network and system configuration.
! Configuration File for keepalived
global_defs {
notification_email {
sysadmin@mydomain.com
support@mydomain.com
}
notification_email_from lb1@mydomain.com
smtp_server localhost
smtp_connect_timeout 30
}
vrrp_instance VI_1 {
state MASTER
interface eth1
virtual_router_id 51
priority 101
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
192.168.10.121
}
}
Step 4: Configure KeepAlived on LB2.
Edit Keepalived configuration file on LB2 and add following configuration. While making changes in LB2 configuration file, make sure to set priority values to lower than LB1. For example below configuration is showing 100 priority value than LB1 has it 101.
! Configuration File for keepalived
global_defs {
notification_email {
sysadmin@mydomain.com
support@mydomain.com
}
notification_email_from lb2@mydomain.com
smtp_server localhost
smtp_connect_timeout 30
}
vrrp_instance VI_1 {
state MASTER
interface eth1
virtual_router_id 51
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
192.168.10.121
}
}
1. Priority value will be higher on Master server, It doesn’t matter what you used in state. If your state is MASTER but your priority is lower than the router with BACKUP, you will lose the MASTER state.
2. virtual_router_id should be same on both LB1 and LB2 servers.
3. By default single vrrp_instance support up to 20 virtual_ipaddress. In order to add more addresses you need to add more vrrp_instance
Step 5: Start KeepAlived
Start KeepAlived service using following command and also configure to auto start on system boot.
# service keepalived start
# chkconfig keepalived on
Step 6: Check Virtual IPs
By default virtual ip will assigned to master server, In case of master get down, it will automatically assigned to slave server. Use following command to show assigned virtual ip on interface.
# ip addr show eth1
Sample output
2: eth1: <broadcast,multicast,up,lower_up> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
link/ether 00:0c:29:6f:ed:60 brd ff:ff:ff:ff:ff:ff
inet 192.168.10.111/24 brd 192.168.1.255 scope global eth1
inet 192.168.10.121/32 scope global eth1
inet6 fe80::20c:29ff:fe6f:ed60/64 scope link
valid_lft forever preferred_lft forever
Verify IP Failover
- Shutdown master server ( LB1 ) and check if ips are automatically assigned to slave server.
# ip addr show eth1
- Now start LB1 and stop slave server ( LB2 ). IPs will automatically assigned to master server.
# ip addr show eth1
- Watch log files to insure its working
# tailf /var/log/messages
Sample Output
Mar 19 17:30:24 localhost Keepalived_vrrp[6958]: VRRP_Instance(VI_1) Transition to MASTER STATE
Mar 19 17:30:25 localhost Keepalived_vrrp[6958]: VRRP_Instance(VI_1) Entering MASTER STATE
Mar 19 17:30:25 localhost Keepalived_vrrp[6958]: VRRP_Instance(VI_1) setting protocol VIPs.
Mar 19 17:30:25 localhost Keepalived_healthcheckers[6957]: Netlink reflector reports IP 192.168.10.121 added
Mar 19 17:30:25 localhost avahi-daemon[1407]: Registering new address record for 192.168.10.121 on eth1.IPv4.
Mar 19 17:30:25 localhost Keepalived_vrrp[6958]: VRRP_Instance(VI_1) Sending gratuitous ARPs on eth1 for
I hope this article will help to setup IP failover between two load balance servers.
http://zosel.net/trackback/241
from. 2016/01/23 19:51
"鍩烘湰浠曟銈兂銉嗐儕銈裤偆銉椼偄銉炽儐銉婂垎闆㈠瀷闆绘簮銆€姗熻兘ITS銈广儩銉冦儓锛圖SRC锛夊蹇溾棆鏂欓噾妗堝唴銆€鏂欓噾灞ユ銆€闊冲0妗堝唴銆€銈兗銉夋姕銇嶅繕銈岃鍛娿€€銉娿儞閫e嫊姗熻兘鈼嬨偟銈ゃ偤銉婚噸閲忋偟銈ゃ偤70x15x113 mm閲嶉噺130 g銆€璩煎叆銇亗銇熴仯銇︺伄銇娿伃銇屻亜涓嬭 銇旀敞鎰忋€佸強銇?銈ゃ兂銉曘偐銉°兗銈枫儳銉炽倰銈堛亸纰鸿獚銇勩仧銇犮亜銇︺亱銈夈仈娉ㄦ枃銇忋仩銇曘亜銆?4
from.Mcm Sale Backpack 2016/01/24 21:00
where to find nike free runs
from.锟秸ワ拷锟襟シー锟斤拷锟矫トハットo拷Fancy That Hat) 锟斤拷锟斤拷锟絗锟斤拷锟斤拷膝氓取锟斤拷庭锟斤拷萤`锟街ワ拷`锟桔ワイ锟饺ドッワ拷 BR08008081391锟斤拷 2016/01/26 20:07
"銇亷銈勩亱銇с亱銈忋亜銈夈仐銇勩儑銈躲偆銉斥槅鍕曠墿銈勮櫕銇曘倱銆併仼銈撱亹銈婄瓑銆佹ソ銇椼亸銇︺仺銇c仸銈傘伀銇庛倓銇嬨仾銇婂瓙妲樸亴鍠溿伋銇濄亞銇偒銉┿儠銉仾銉囥偠銈ゃ兂銇с仚锛?0鍊嬨伄绱欒=銇銈掔銇夸笂銇掋仸閬娿伓銉栥儹銉冦偗銈广仹銇欌槅灏忋仌銇勯爢銇?銇嬨倝10銇俱仹鏁板瓧銇屻伒銇c仸銇傘倞鏁般倓澶с亶銇曘倰瑾嶈瓨銇с亶銇熴倞銇婂媺寮枫伀銈傘仾銈娿仢銇嗐仹銇欍伃鈽嗛噸銇仸绠便伀鍏ャ倢銇︺€併偝銉炽儜銈儓銇弾绱嶅彲鑳解槅 銆愬璞″勾榻€?12銉舵湀浠ヤ笂 銆...
from.銉°兗銈裤兗 2016/01/27 19:24
"鏃ョ珛绱旀娑堣€楀搧锛侊紒HITACHI 鏃ョ珛銈兗銉栥兂銉兂銈哥敤鐨匡紙MRO-FA4 001锛夊晢鍝佽┏绱?鍝佺暘 MRO-FA4 001 鏈綋鍨嬪紡 銆斿瀷寮忋亴MRH-銇绋€曘兓MRH-530銉籑RH-540銉籑RH-560銉籑RH-570銉籑RH-580 銆斿瀷寮忋亴MRO-5銇绋€曘兓MRO-50Y 銆斿瀷寮忋亴MRO-A銇绋€曘兓MRO-A4 銉籑RO-A610Y銉籑RO-AT5 銆斿瀷寮忋亴MRO-B銇绋€?銉籑RO-B40K1銉籑RO-B600M...
from.Prezzi Ugg In Italia 2016/02/15 12:14
nike air max ladies
from.Mcm Sunglasses 2016/02/15 15:45
buy nike flyknit air max
from.Mcm Handbags Uk 2016/02/15 16:51
buy nike free 5.0
from.Mcm Online Store Us 2016/02/15 18:09
nike free runs 5.0 blue
from.Scarpe Tipo Ugg 2016/02/15 18:34
nike air max 90 blue
from.Ugg Australia Roma 2016/02/15 19:08
cheap nike free fun
from.Ugg Uomo Italia 2016/02/15 19:36
clearance nike
from.Ugg Punti Vendita 2016/02/15 19:48
nike free run eastbay
from.Ugg Scarpe Donna 2016/02/15 21:20
cheap nike air max trainers for men
from.Cheap Mcm Handbags 2016/02/15 21:32
womens nike flyknit
from.Ugg Shop 2016/02/15 23:15
nike white air max
from.Ugg Guanti 2016/02/15 23:23
nike air max tailwind 2
from.Ugg Australia On Line 2016/02/15 23:29
nike free run for cheap
from.Ugg Alti 2016/02/16 00:59
nike free running 4.0
from.Ugg 38 2016/02/16 02:11
women white nike air max
from.Ugg Falsi 2016/02/16 05:05
discount mcm bags
from.Ugg Offerte Online 2016/02/16 05:07
nike free runs 3.0
from.Ugg Short Classic 2016/02/16 05:45
air jordan nike shoes
from.Ugg Boots Milano 2016/02/16 08:32
mcm satchel bag
from.Stivali Ugg Scontati Online 2016/02/16 08:35
shoes like nike air max
from.Stivale Ugg 2016/02/16 09:51
nike shoes for women air max
from.Ugg Australia Online Shop 2016/02/16 10:46
nike air black and white
from.Ugg Bailey Button 2016/02/16 11:10
nike free for running
from.Stivali Ugg On Line 2016/02/16 11:17
nike air max wholesale china
from.Offerte Ugg Boots 2016/02/16 11:43
store nike id
from.Ugg Di Lana 2016/02/16 11:55
nike air 2012
from.Vendita Ugg 2016/02/16 12:10
nike black and white
from.Outlet Ugg Roma 2016/02/16 12:58
nike free run tiffany blue
from.Sandali Ugg 2014 2016/02/16 13:30
boys nike air max
from.Mcm Boutique 2016/02/16 14:52
purple nike free run
from.Ugg Scontati Online 2016/02/16 15:16
vintage mcm backpack
from.Ugg Australia Eu 2016/02/16 15:31
nike clearance online
from.Ugg Bassi 2016/02/16 15:54
nike outlet san leandro
from.Ugg Stivali Scontati 2016/02/16 16:10
nike shox r2
from.Stivale Ugg 2016/02/16 17:00
nike shoes online
from.Mcm MüNchen 2016/02/16 17:20
nike id website
from.Ugg Grigi 2016/02/16 19:29
nike air max plus
from.Mcm Back Pack 2016/02/16 23:48
nike free run 5.o
from.Mcm Black 2016/02/17 01:57
store nike
from.Mcm Latest Collection 2016/02/17 04:20
nike free run black and teal
from.Mcm Electronics Uk 2016/02/17 05:17
mcm bag 2014
from.Mcm Limited Edition Backpack 2016/02/17 05:50
nike.com store
from.Mcm Parts 2016/02/17 06:29
nike basketball cleats
from.Bag Mcm 2016/02/17 06:44
nike lunar eclipse
from.Comic Con Mcm London 2016/02/17 09:45
nike sneakers air
from.Ugg Australia Scontati 2016/02/17 16:03
nike free running cheap
from.Ugg Italia Shop Online 2016/02/17 18:36
mcm con
from.Vendita Ugg On Line 2016/02/17 20:09
mcm black backpack
from.Negozi Ugg Milano 2016/02/17 23:27
mcm medium backpack
from.Mcm Outlet Store 2016/02/18 02:51
nike shop on line
from.Modelli Ugg 2013 2016/02/18 03:05
cheap nike high tops
from.Mcm Latest Collection 2016/02/18 03:47
nike shocks for kids
from.Mcm Video 2016/02/18 06:55
free runs nike womens
from.Prezzo Stivali Ugg 2016/02/18 07:07
nike dunk low
from.Mcm Luggage Cheap 2016/02/18 09:39
new nike free run
from.Ugg Sale Online 2016/02/18 10:21
nike outlet auburn
from.Scarpe Ugg Donna 2016/02/18 10:27
nike flyknit free runs
from.Ugg 5825 2016/02/18 10:54
nike women s 5.0
from.Colori Ugg 2016/02/18 13:26
cheap nike shox from china
from.Ugg Wikipedia 2016/02/18 13:51
blue nike shoes
from.Cheap Mcm Backpack Uk 2016/02/18 15:59
all nike free shoes
from.Mcm Luggage 2016/02/18 16:35
nike sneakers free run
from.Mcm Handbags Outlet Sale 2016/02/18 16:49
nike air run women
from.Price Of Mcm Bag 2016/02/18 17:56
london underground nike air max
from.Ugg Sito Ufficiale 2016/02/18 18:28
mcm bags online store
from.Mcm Backpack Shop Online 2016/02/18 19:37
cheap jordan and nike shoes
from.Ugg Australia Italia 2016/02/18 20:14
running shoes nike men
from.Vendita Ugg Originali 2016/02/18 22:23
buy nike free run online
from.Stivali Modello Ugg 2016/02/19 02:00
discount nike shoe
from.Ugg Scarpe Prezzo 2016/02/19 02:07
free run nike blue
from.Mcm Backpack 2016/02/19 05:16
discount mens nike air max
from.Mcm Backpacks Cheap 2016/02/19 06:32
nike free tiffany blue
from.Mcm London Comic Con 2014 Guests 2016/02/19 11:32
nike free run shoes women
from.Mcm Shopper Bag 2016/02/19 14:49
nike free run 5.0 discount
from.Red Mcm Backpack 2016/02/19 15:20
nike free flyknit women
from.Mcm Handbags 2014 2016/02/19 16:16
nike id customize your own shoes
from.Mcm Backpack Outlet 2016/02/19 17:06
nike id free run
from.Mcm Korea Online Shop 2016/02/19 17:27
nike air max 2000
from.Mcm Online Shop Korea 2016/02/19 19:18
mcm handbags on sale
from.Mcm Cognac Backpack 2016/02/19 19:30
nike air max thea buy
from.Mcm Backpack White 2016/02/20 04:53
where to get cheap nike running shoes
from.Mcm Usa 2016/02/20 09:54
nike flyknit max
from.Ugg Australia Outlet Online 2016/02/20 11:12
womens nike shoes on sale
from.Mcm Collection 2016/02/20 11:15
mens nike air max white
from.Scarpe Ugg Milano 2016/02/20 11:41
nike basketball store
from.Ugg Sito Ufficiale Italiano 2016/02/20 12:42
air max nike id
from.Ugg Compra Online 2016/02/20 16:08
nike freee
from.Ugg Originali 2016/02/20 17:27
nike air max 2014 online
from.Ugg Australian 2016/02/20 18:53
mcm men
from.Italia Ugg Online 2016/02/20 19:06
nike sneaker outlet
from.Mcm Sale 2016/02/20 20:18
nike air 90
from.Stivali Ugg Italia 2016/02/20 20:35
nike free 3.0 v4
from.Sito Ugg 2016/02/20 20:37
nike air maxs cheap
from.Ugg Ebay Originali 2016/02/20 23:07
nike free run womens 3
from.Sito Ugg Australia 2016/02/20 23:32
where to find nike free runs
from.Mcm Handbags Sale 2016/02/21 01:49
nike outlet charleston sc
from.Ugg Milano Centro 2016/02/21 02:45
nike free run pink 5.0
from.Mcm Handbags Sale 2016/02/21 02:48
shop nike
from.Ugg Su Ebay 2016/02/21 03:42
cheap nike 6.0 shoes
from.Ugg Uomo Prezzo 2016/02/21 04:11
womens nike free run sneakers
from.Ugg Australia Italia 2016/02/21 04:57
nike air max 2013 nike.com
from.Calzature Ugg 2016/02/21 07:14
nike free run men
from.Mcm Red Backpack 2016/02/21 11:56
nike collection
from.Mcm Electronics Coupon 2016/02/21 18:16
cheap womens nike free
from.Mcm Coupons 2016/02/21 20:56
free run 3 nike women
from.carson tinker jersey 2016/02/21 23:06
I visit everyday some blogs and sites to read articles or reviews, except this weblog gives quality based content ::: ZOSEL ::: :: Linux CentOS VRRP 구현 .
from.Mcm Outlet Stores 2016/02/22 04:23
nike air max black shoes
from.Mcm Black Bag 2016/02/22 04:30
new nike for women
from.Ugg Modelli 2016/02/22 13:33
nike shoks
from.Ugg Italia Shop Online 2016/02/22 15:58
nike air max 2013 buy online
from.Ugg Outlet Online Italia 2016/02/23 01:31
nike air trainer max 94
from.Negozi Ugg A Milano 2016/02/23 01:54
nike cheap shoes online
from.Mcm Sneakers Men 2016/02/23 17:48
nike sneakers air max
from.Mcm Outlet Online 2016/02/24 02:05
nike sale air max
from.Ugg Uomo Italia 2016/02/25 00:50
nike free run 3 zappos
from.Mcm Electronics Coupon 2016/02/25 03:52
nike free run flexibility
from.Ugg Chocolate 2016/02/25 05:39
mcm 2014 london
from.Ugg Mini Scontati 2016/02/25 08:15
kids nike free run 3.0
from.Authentic Mcm Handbags 2016/02/25 09:11
nike air max shoes for cheap
from.Ugg Non Originali 2016/02/25 10:23
nike factory outlet price
from.Ugg Sito Ufficiale Outlet 2016/02/25 12:59
nike shoes cheap
125