Hi,
I decided not to use heartbeat and ldirectord for the failover any more, due to
the difficulties am facing. Right now, I used keepalived and it is fantastic.
The only problem I have with it right now and will need help is that, when I
take off the network cable from the master, the slave is able to detect that,
the interface is down, takeover is not taking place.
But when I stop the keepadlived service on the master or shatdown, the slave is
able to takeover and act as the master until I start the keepalived or the
machine.
my configurations is as follows:
Master:/etc/keepalived/keepalived.conf
Configuration File for Keepalived
# Global Configuration
global_defs {
notification_email {
[email protected]
}
notification_email_from [email protected]
smtp_server localhost
smtp_connect_timeout 30
router_id LVS_MASTER # string identifying the machine
}
# describe virtual service ip
vrrp_instance VI_1 {
# initial state
state MASTER
interface eth0
# arbitary unique number 0..255
# used to differentiate multiple instances of vrrpd
virtual_router_id 1
# for electing MASTER, highest priority wins.
# to be MASTER, make 50 more than other machines.
priority 100
authentication {
auth_type PASS
auth_pass 1q2w3e
}
virtual_ipaddress {
41.211.31.60/25 dev eth1
}
# Invoked to master transition
notify_master "/etc/keepalived/bypass_ipvs.sh del 41.211.31.60"
# Invoked to slave transition
notify_backup "/etc/keepalived/bypass_ipvs.sh add 41.211.31.60"
# Invoked to fault transition
notify_fault "/etc/keepalived/bypass_ipvs.sh add 41.211.31.60"
}
# describe virtual mail server
virtual_server 41.211.31.60 25 {
delay_loop 15
lb_algo rr
lb_kind DR
persistence_timeout 50
protocol TCP
real_server 192.168.2.3 25 {
TCP_CHECK {
connect_timeout 3
}
}
}
# describe virtual web server
virtual_server 41.211.31.60 80 {
delay_loop 30
lb_algo rr
lb_kind DR
persistence_timeout 50
protocol TCP
real_server 192.168.2.3 80 {
HTTP_GET {
url {
path /var/www/html/index.html
digest 9c740d4a0e350371229915359a614d63
}
connect_timeout 3
nb_get_retry 3
delay_before_retry 2
}
}
real_server 192.168.2.2 80 {
HTTP_GET {
url {
path /var/www/html/index.html
digest 98049d2520fe2ae1cfefc647b9e7e95d
}
connect_timeout 3
nb_get_retry 3
delay_before_retry 2
}
}
}
And on the slave:
# Configuration File for Keepalived
# Global Configuration
global_defs {
notification_email {
[email protected]
}
notification_email_from [email protected]
smtp_server localhost
smtp_connect_timeout 30
router_id LVS_MASTER # string identifying the machine
}
# describe virtual service ip
vrrp_instance VI_1 {
# initial state
state BACKUP
interface eth0
# arbitary unique number 0..255
# used to differentiate multiple instances of vrrpd
virtual_router_id 1
# for electing MASTER, highest priority wins.
# to be MASTER, make 50 more than other machines.
priority 50
authentication {
auth_type PASS
auth_pass 1q2w3e
}
virtual_ipaddress {
41.211.31.60/25 dev eth1
}
# Invoked to master transition
notify_master "/etc/keepalived/bypass_ipvs.sh del 41.211.31.60"
# Invoked to slave transition
notify_backup "/etc/keepalived/bypass_ipvs.sh add 41.211.31.60"
# Invoked to fault transition
notify_fault "/etc/keepalived/bypass_ipvs.sh add 41.211.31.60"
}
# describe virtual mail server
virtual_server 41.211.31.60 25 {
delay_loop 15
lb_algo rr
lb_kind DR
persistence_timeout 50
protocol TCP
real_server 192.168.2.3 25 {
TCP_CHECK {
connect_timeout 3
}
}
real_server 192.168.2.2 25 {
TCP_CHECK {
connect_timeout 3
}
}
}
# describe virtual web server
virtual_server 41.211.31.60 80 {
delay_loop 30
lb_algo rr
lb_kind DR
persistence_timeout 50
protocol TCP
real_server 192.168.2.3 80 {
HTTP_GET {
url {
path /var/www/html/index.html
digest 9c740d4a0e350371229915359a614d63
}
connect_timeout 3
nb_get_retry 3
delay_before_retry 2
}
}
real_server 192.168.2.2 80 {
HTTP_GET {
url {
path /var/www/html/index.html
digest 98049d2520fe2ae1cfefc647b9e7e95d
}
connect_timeout 3
nb_get_retry 3
delay_before_retry 2
}
}
}
Any one to help?