Environment:
OS: Centos 6.3 x86_64
Keepalived: 1.2.8
Symptom: The master cannot release the vip due to the use of killall-g, and the slave can take over the vip occasionally;
The master vip is forcibly removed:
Ip addr del 192.168.1.249/32 dev eth0
Man killall-g is interpreted as: Kill the process group to which the process belongs. the kill signal is only sent once per group, even if multiple processes belonging to the same process group were found.
Configuration section:
global_defs { router_id MM}vrrp_instance VI_1 { state BACKUP interface eth0 virtual_router_id 232 priority 90 advert_int 1 nopreempt authentication { auth_type PASS auth_pass Root123 } virtual_ipaddress { 192.168.1.249 } notify_master "/usr/local/sbin/XXXXXXX" notify_backup "/usr/local/sbin/XXXXXXX" notify_fault "/usr/local/sbin/XXXXXXX"}
Use killall keepalived to take over vip normally;
View the keepalived script of keepalived itself:
Killproc keepalived is used to stop keepalived from entering the city,
I do not know the specific reason. Only record it here!
Finally, you can only use the official script:
#!/bin/sh## keepalived High Availability monitor built upon LVS and VRRP## chkconfig: - 86 14# description: Robust keepalive facility to the Linux Virtual Server project \# with multilayer TCP/IP stack checks.### BEGIN INIT INFO# Provides: keepalived# Required-Start: $local_fs $network $named $syslog# Required-Stop: $local_fs $network $named $syslog# Should-Start: smtpdaemon httpd# Should-Stop: smtpdaemon httpd# Default-Start:# Default-Stop: 0 1 2 3 4 5 6# Short-Description: High Availability monitor built upon LVS and VRRP# Description: Robust keepalive facility to the Linux Virtual Server# project with multilayer TCP/IP stack checks.### END INIT INFO# Source function library.. /etc/rc.d/init.d/functionsexec="/usr/sbin/keepalived"prog="keepalived"config="/etc/keepalived/keepalived.conf"[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$proglockfile=/var/lock/subsys/$progstart() { [ -x $exec ] || exit 5 [ -e $config ] || exit 6 echo -n $"Starting $prog: " daemon $exec $KEEPALIVED_OPTIONS retval=$? echo [ $retval -eq 0 ] && touch $lockfile return $retval}stop() { echo -n $"Stopping $prog: " killproc $prog retval=$? echo [ $retval -eq 0 ] && rm -f $lockfile return $retval}restart() { stop start}reload() { echo -n $"Reloading $prog: " killproc $prog -1 retval=$? echo return $retval}force_reload() { restart}rh_status() { status $prog}rh_status_q() { rh_status &>/dev/null}case "$1" in start) rh_status_q && exit 0 $1 ;; stop) rh_status_q || exit 0 $1 ;; restart) $1 ;; reload) rh_status_q || exit 7 $1 ;; force-reload) force_reload ;; status) rh_status ;; condrestart|try-restart) rh_status_q || exit 0 restart ;; *) echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" exit 2esacexit $?
This article from the "Technical Achievement dream" blog, please be sure to keep this source http://weipengfei.blog.51cto.com/1511707/1300090