默认keepalive的日志文件是
/var/log/messages
[root@LB2 ~]# tail -5 /var/log/messages
Dec 7 22:40:10 LB2 Keepalived_vrrp: VRRP_Instance(VI_1) Entering BACKUP STATE
Dec 7 22:40:10 LB2 Keepalived_vrrp: VRRP sockpool: [ifindex(2), proto(112), fd(10,11)]
Dec 7 22:40:10 LB2 Keepalived_healthcheckers: Opening file '/etc/keepalived/keepalived.conf'.
Dec 7 22:40:10 LB2 Keepalived_healthcheckers: Configuration is using : 8425 Bytes
Dec 7 22:40:10 LB2 Keepalived_healthcheckers: Using LinkWatch kernel netlink reflector...
[root@LB2 ~]#
修改配置
[root@LB2 ~]# vim /etc/sysconfig/keepalived
......
#KEEPALIVED_OPTIONS="-D" //注释掉该行
KEEPALIVED_OPTIONS="-D -d -S 0" //添加改行
......
[root@LB2 ~]# vim /etc/rsyslog.conf
......
local0.* /var/log/keepalived.log //添加改行
[root@LB2 ~]# /etc/init.d/rsyslog restart //重启日志服务
Shutting down system logger: [ OK ]
Starting system logger: [ OK ]
[root@LB2 ~]# /etc/init.d/keepalived restart //重启keepalive服务
Stopping keepalived: [ OK ]
Starting keepalived: [ OK ]
[root@LB2 ~]# tail -5 /var/log/keepalived.log
Dec 8 01:02:06 LB2 Keepalived_vrrp: Virtual IP = 1
Dec 8 01:02:06 LB2 Keepalived_vrrp: 192.168.220.110/24 brd 192.168.220.110 dev eth0 scope global
Dec 8 01:02:06 LB2 Keepalived_vrrp: Using LinkWatch kernel netlink reflector...
Dec 8 01:02:06 LB2 Keepalived_vrrp: VRRP_Instance(VI_1) Entering BACKUP STATE
Dec 8 01:02:06 LB2 Keepalived_vrrp: VRRP sockpool: [ifindex(2), proto(112), fd(10,11)]