Links to below you maybe likes:
How to install php7 on centos 6
How to install and configure redmine on centos 6
How to owncloud 9 install ssl certificate centos 7
How To Install the BIND DNS Server on CentOS 6
KeepAlived IP Failover on CentOS & Red Hat
Keepalived use highly available to make Virtual IP call VIP . it's a linux implementation make of VRRP
my post, use keepAlived IP Failover on CentOS & Red Hat. I'm running commands as root account.
Links to below you maybe likes:
How to install php7 on centos 6
How to install and configure redmine on centos 6
How to owncloud 9 install ssl certificate centos 7
How To Install the BIND DNS Server on CentOS 6
KeepAlived IP Failover on CentOS & Red Hat
priority: The hight is master, nguoc lai la Backup.
virtual_router_id : the same bettween node 1 vs node 2
If you used Unicast, notify and track script then full script as bellow
Starting keepalived services
How to install php7 on centos 6
How to install and configure redmine on centos 6
How to owncloud 9 install ssl certificate centos 7
How To Install the BIND DNS Server on CentOS 6
KeepAlived IP Failover on CentOS & Red Hat
Keepalived use highly available to make Virtual IP call VIP . it's a linux implementation make of VRRP
my post, use keepAlived IP Failover on CentOS & Red Hat. I'm running commands as root account.
Links to below you maybe likes:
How to install php7 on centos 6
How to install and configure redmine on centos 6
How to owncloud 9 install ssl certificate centos 7
How To Install the BIND DNS Server on CentOS 6
KeepAlived IP Failover on CentOS & Red Hat
To install keepalived on centos
yum update -y
yum install -y keepalived
To configure keepalived
On Node 1! Configuration File for keepalivedOn Node 2
global_defs {
notification_email {
[email protected]
[email protected]
}
notification_email_from [email protected]
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 You-Add-Password-Here
}
virtual_ipaddress {
192.168.10.121
}
}
! Configuration File for keepalived*Note
global_defs {
notification_email {
[email protected]
[email protected]
}
notification_email_from [email protected]
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 You-Add-Password-Here
}
virtual_ipaddress {
192.168.10.121 dev eth0
}
}
priority: The hight is master, nguoc lai la Backup.
virtual_router_id : the same bettween node 1 vs node 2
If you used Unicast, notify and track script then full script as bellow
! Configuration File for keepalivedThe bash script keepalivecheck_haproxy.sh
global_defs {
notification_email {
[email protected]
[email protected]
}
notification_email_from [email protected]
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 You-Add-Password-Here
}
unicast_src_ip 192.168.10.122 # Unicast specific option, this is the IP of the interface keepalived listens on
unicast_peer { # Unicast specific option, this is the IP of the peer instance
192.168.10.123
}
virtual_ipaddress {
192.168.10.121 dev eth0
}
vrrp_script check_haproxy {
script "/opt/scripts/keepalivecheck_haproxy.sh"
interval 2
fall 2
rise 2
}
track_script {
check_haproxy
}
notify /opt/scripts/keepalivekeepalived.state.sh
}
cat /opt/scripts/keepalivecheck_haproxy.shAs the output below
#!/bin/bashThe bash script keepalivekeepalived.state.sh
# Check if haproxy is running, return 1 if not.
# Used by keepalived to initiate a failover in case haproxy is down
HAPROXY_STATUS=$(/bin/ps -e | grep -w haproxy)
if [ "$HAPROXY_STATUS" != "" ]
then
exit 0
else
logger "HAProxy is NOT running. Setting keepalived state to FAULT."
exit 1
fi
cat /opt/scripts/keepalivekeepalived.state.shAs the output below
#!/bin/bash
TYPE=$1
NAME=$2
STATE=$3
echo $STATE > /var/run/keepalived.state
Starting keepalived services
service keepalived startTo verify keepalived
chkconfig keepalived on
ip addr show eth1
tailf /var/messages
Thanks for reading KeepAlived IP Failover on CentOS & Red Hat My blog Effortless Zimbra Mail Management: Unleashing the Power of Linux Commands, How-To, and Bash Scripts I hope this is useful.