天行流沙 2015-04-21 16:04 采纳率: 100%
浏览 3615
已结题

keepalived 备机启动自动从backup切换成master

按照网上的教程搭建,两台服务器,主机ip:10.1.21.211,备机ip:10.1.21.212,虚ip:10.1.21.213。搭完后备用机一**启动keepalived就自动从BACKUP切换到MASTER(另一机并未关keepalived服务)**,正常主机没有down之前备机应该是backup状态才对啊,用ip a查看时发现备用机的IP也包含虚拟IP。

主机配置:
! Configuration File for keepalived
global_defs {
notification_email {
wangch_sk@163.com
}
notification_email_from 764382548@qq.com
smtp_server 192.168.200.1
smtp_connect_timeout 30
router_id node1
}
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 {
10.1.21.213
}
}
备机配置:
! Configuration File for keepalived

global_defs {
notification_email {
wangch_sk@163.com
}
notification_email_from 764382548@qq.com
smtp_server 192.168.200.1
smtp_connect_timeout 30
router_id node1
}

vrrp_instance VI_1 {
state BACKUP
interface eth1 #这里备机的网卡就是eth1
virtual_router_id 51
priority 50
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
10.1.21.213
}
}

备机启动日志:
Apr 21 17:22:37 PEK1-OAHolidaySearch-02 Keepalived_healthcheckers[27471]: Using LinkWatch kernel netlink reflector...
Apr 21 17:22:37 PEK1-OAHolidaySearch-02 Keepalived_vrrp[27472]: VRRP_Instance(VI_1) Entering BACKUP STATE
Apr 21 17:22:37 PEK1-OAHolidaySearch-02 Keepalived_vrrp[27472]: VRRP sockpool: [ifindex(2), proto(112), fd(10,11)]
Apr 21 17:22:41 PEK1-OAHolidaySearch-02 Keepalived_vrrp[27472]: VRRP_Instance(VI_1) Transition to MASTER STATE
Apr 21 17:22:42 PEK1-OAHolidaySearch-02 Keepalived_vrrp[27472]: VRRP_Instance(VI_1) Entering MASTER STATE
Apr 21 17:22:42 PEK1-OAHolidaySearch-02 Keepalived_vrrp[27472]: VRRP_Instance(VI_1) setting protocol VIPs.
Apr 21 17:22:42 PEK1-OAHolidaySearch-02 Keepalived_vrrp[27472]: VRRP_Instance(VI_1) Sending gratuitous ARPs on eth1 for 10.1.21.213
Apr 21 17:22:42 PEK1-OAHolidaySearch-02 Keepalived_healthcheckers[27471]: Netlink reflector reports IP 10.1.21.213 added

tcpdump vrrp结果:
18:09:44.834042 IP 10.1.21.211 > vrrp.mcast.net: VRRPv2, Advertisement, vrid 51, prio 100, authtype simple, intvl 1s, length 20
18:09:45.331753 IP 10.1.21.212 > vrrp.mcast.net: VRRPv2, Advertisement, vrid 51, prio 50, authtype simple, intvl 1s, length 20
18:09:45.835228 IP 10.1.21.211 > vrrp.mcast.net: VRRPv2, Advertisement, vrid 51, prio 100, authtype simple, intvl 1s, length 20
18:09:46.332927 IP 10.1.21.212 > vrrp.mcast.net: VRRPv2, Advertisement, vrid 51, prio 50, authtype simple, intvl 1s, length 20

这是什么情况? 求教各位大神解决方法或思路,谢谢

  • 写回答

1条回答

      报告相同问题?

      相关推荐 更多相似问题

      悬赏问题

      • ¥50 求会调用皮质扫描这个库的扫码功能,Zxing的demo,
      • ¥15 关于ggplot2的包的下载遇到的相关问题
      • ¥15 求一个超难的动态新增元素的 click 事件无效的解决办法。
      • ¥20 怎么修改mediawiki允许上传的文件大小?
      • ¥15 agrySEXPAYm 是毒吗
      • ¥50 Java实现注册登录实现数据库增删改查功能,数据库至少两个表
      • ¥20 求解R语言的数据分析问题
      • ¥20 求GD32F105和305解除读保护方法教程
      • ¥15 C++代码优化,复杂度太高,无法通过clang-tidy检查,用什么办法可以优=化
      • ¥15 关于跨链隐私保护方案