Keepalive異常小計

來源:互聯網
上載者:User

環境:

OS:Centos 6.3 x86_64

Keepalived:1.2.8

現象:使用killall -g 導致 master不能釋放vip,slave偶爾能接管vip,偶爾不能接管vip;

最終強制去掉master vip:

ip addr del 192.168.1.249/32 dev eth0

man killall -g 的解釋為: 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.

配置部分:

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"}

使用killall keepalived 能正常接管vip;

查看keepalived本身的 keepalived指令碼:

是採用 killproc keepalived 這種方式結束掉keepalived進城的,

具體原因不知,在此僅作記錄!

最後只能改用官方的指令碼:

#!/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 $?

本文出自 “技術成就夢想” 部落格,請務必保留此出處http://weipengfei.blog.51cto.com/1511707/1300090

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.