- 论坛徽章:
- 0
|
keepalived 主(192.168.1.3)
! Configuration File for keepalived
global_defs {
notification_email {
#admin@demo.com
}
#notification_email_from admin@demo.com
#smtp_server 127.0.0.1
#smtp_connect_timeout 30
router_id LVS_DEVEL
}
vrrp_script chk_nginx {
script "/etc/keepalived/check_nginx.sh"
interval 2
weight 2
}
vrrp_instance VI_1 {
state MASTER
interface eth0
virtual_router_id 51
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
192.168.1.2
}
track_script {
chk_nginx
}
}
keepalived 备(192.168.1.4)
! Configuration File for keepalived
global_defs {
notification_email {
#admin@michael-demo.com
}
#notification_email_from admin@michael-demo.com
#smtp_server 127.0.0.1
#smtp_connect_timeout 30
router_id LVS_DEVEL
}
vrrp_script chk_nginx {
script "/etc/keepalived/check_nginx.sh"
interval 2
weight 2
}
vrrp_instance VI_1 {
state MASTER
interface eth0
virtual_router_id 51
priority 98
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
221.1.220.206
}
track_script {
chk_nginx
}
}
现在问题是两台机器都有VIP .但是一台重启或宕机。另外一台能接管。备机state改为BACKUP模式也白搭!
keepalived 主日志:
Apr 17 07:30:04 localhost kernel: Bluetooth: RFCOMM socket layer initialized
Apr 17 07:30:04 localhost kernel: Bluetooth: RFCOMM TTY layer initialized
Apr 17 07:30:04 localhost kernel: Bluetooth: RFCOMM ver 1.8
Apr 17 07:30:04 localhost kernel: Bluetooth: HIDP (Human Interface Emulation) ver 1.1
Apr 17 07:36:39 localhost Keepalived_vrrp[2520]: VRRP_Script(chk_nginx) timed out
Apr 17 07:36:39 localhost Keepalived_vrrp[2520]: VRRP_Script(chk_nginx) succeeded
Apr 17 07:36:55 localhost Keepalived_vrrp[2520]: VRRP_Script(chk_nginx) timed out
Apr 17 07:36:55 localhost Keepalived_vrrp[2520]: VRRP_Script(chk_nginx) succeeded
Apr 17 07:54:13 localhost Keepalived_vrrp[2520]: VRRP_Script(chk_nginx) timed out
Apr 17 07:54:13 localhost Keepalived_vrrp[2520]: VRRP_Script(chk_nginx) succeeded
keepalived 备日志:
Apr 16 23:51:29 Keepalived_vrrp[4733]: VRRP sockpool: [ifindex(2), proto(112), unicast(0), fd(10,11)]
Apr 16 23:51:29 Keepalived_vrrp[4733]: VRRP_Script(chk_nginx) succeeded
Apr 16 23:51:30 Keepalived_vrrp[4733]: VRRP_Instance(VI_1) Transition to MASTER STATE
Apr 16 23:51:31 Keepalived_vrrp[4733]: VRRP_Instance(VI_1) Entering MASTER STATE
Apr 16 23:51:31 Keepalived_vrrp[4733]: VRRP_Instance(VI_1) setting protocol VIPs.
Apr 16 23:51:31 Keepalived_healthcheckers[4732]: Netlink reflector reports IP 192.168.1.2 added
Apr 16 23:51:31 Keepalived_vrrp[4733]: VRRP_Instance(VI_1) Sending gratuitous ARPs on eth0 for 192.168.1.2
Apr 16 23:51:31 avahi-daemon[3246]: Registering new address record for 192.168.1.2 on eth0.
Apr 16 23:51:31 Keepalived_vrrp[4733]: Netlink reflector reports IP 19.168.1.2 added
Apr 16 23:51:36 Keepalived_vrrp[4733]: VRRP_Instance(VI_1) Sending gratuitous ARPs on eth0 for 192.168.1.2
|
|