博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Keepalive异常小计
阅读量:5862 次
发布时间:2019-06-19

本文共 3044 字,大约阅读时间需要 10 分钟。

环境:

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.

配置部分:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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进城的,

具体原因不知,在此仅作记录!

最后只能改用官方的脚本:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/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
/functions
exec
=
"/usr/sbin/keepalived"
prog=
"keepalived"
config=
"/etc/keepalived/keepalived.conf"
[ -e 
/etc/sysconfig/
$prog ] && . 
/etc/sysconfig/
$prog
lockfile=
/var/lock/subsys/
$prog
start() {
    
[ -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 
2
esac
exit 
$?
本文转自 位鹏飞 51CTO博客,原文链接:http://blog.51cto.com/weipengfei/1300090,如需转载请自行联系原作者
你可能感兴趣的文章
Linux系统资源监控命令vmstat\mpstat\sar\iostat\top
查看>>
java笔试面试题---基础部分2
查看>>
并发编程源码分析一之Log接口
查看>>
[ASP.NET]跨页面传值
查看>>
我的友情链接
查看>>
Hello World
查看>>
关于nginx upstream的几种配置方式
查看>>
IE9 table显示问题
查看>>
ceph 快照,克隆,cow
查看>>
ImageMagick更改图片格式进而缩小图片
查看>>
需求感太强
查看>>
珠心算测验
查看>>
NFS安装及挂载
查看>>
国内网站监控分析网站
查看>>
Junit系列之六
查看>>
FSMO图形界面转移角色主机
查看>>
Windows server 2012多元化密码策略
查看>>
VI编辑器
查看>>
Spark 启动脚本——sbin/slaves.sh
查看>>
我的友情链接
查看>>