AWS keepalived备份立即去MASTER

参考这两个指南:

https://awsadvent.tumblr.com/post/105141640154/aws-advent-2014-high-availability-in-aws-with

https://blog.logentries.com/2014/12/keepalived-and-haproxy-in-aws-an-exploratory-guide/

试图让keepalived virtual_ipaddress在一对AWS实例的基础上工作。 它们被部署在VPC中的完全相同的区域中,并且VRRP似乎在它们之间stream动,但它们似乎并没有准备好进入BACKUP状态!

服务器A(“MASTER”):

configuration:

vrrp_instance VI_1 { debug 2 interface eth0 state MASTER virtual_router_id 51 priority 101 unicast_src_ip 172.31.13.67 unicast_peer { 172.31.14.193 } virtual_ipaddress { 172.31.100.100 dev eth0 } } 

服务器A上的相关/ var / log /消息:

 Aug 26 23:32:41 Server A systemd: Started LVS and VRRP High Availability Monitor. Aug 26 23:32:41 Server A Keepalived_healthcheckers[1041]: Opening file '/etc/keepalived/keepalived.conf'. Aug 26 23:32:41 Server A Keepalived_healthcheckers[1041]: Configuration is using : 5139 Bytes Aug 26 23:32:41 Server A Keepalived_vrrp[1042]: Opening file '/etc/keepalived/keepalived.conf'. Aug 26 23:32:41 Server A Keepalived_vrrp[1042]: Configuration is using : 60780 Bytes Aug 26 23:32:41 Server A Keepalived_vrrp[1042]: Using LinkWatch kernel netlink reflector... Aug 26 23:32:41 Server A Keepalived_vrrp[1042]: VRRP sockpool: [ifindex(2), proto(112), unicast(1), fd(10,11)] Aug 26 23:32:41 Server A Keepalived_healthcheckers[1041]: Using LinkWatch kernel netlink reflector... Aug 26 23:32:42 Server A Keepalived_vrrp[1042]: VRRP_Instance(VI_1) Transition to MASTER STATE Aug 26 23:32:43 Server A Keepalived_vrrp[1042]: VRRP_Instance(VI_1) Entering MASTER STATE Aug 26 23:32:43 Server A Keepalived_vrrp[1042]: VRRP_Instance(VI_1) setting protocol VIPs. Aug 26 23:32:43 Server A Keepalived_vrrp[1042]: VRRP_Instance(VI_1) Sending gratuitous ARPs on eth0 for 172.31.100.100 Aug 26 23:32:43 Server A Keepalived_healthcheckers[1041]: Netlink reflector reports IP 172.31.100.100 added Aug 26 23:32:48 Server A Keepalived_vrrp[1042]: VRRP_Instance(VI_1) Sending gratuitous ARPs on eth0 for 172.31.100.100 

tcpdump“ip proto 112”:

 listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes 23:36:48.823269 IP ip-172-31-13-67.us-west-2.compute.internal > ip-172-31-14-193.us-west-2.compute.internal: VRRPv2, Advertisement, vrid 51, prio 101, authtype none, intvl 1s, length 20 23:36:49.824407 IP ip-172-31-13-67.us-west-2.compute.internal > ip-172-31-14-193.us-west-2.compute.internal: VRRPv2, Advertisement, vrid 51, prio 101, authtype none, intvl 1s, length 20 23:36:50.825530 IP ip-172-31-13-67.us-west-2.compute.internal > ip-172-31-14-193.us-west-2.compute.internal: VRRPv2, Advertisement, vrid 51, prio 101, authtype none, intvl 1s, length 20 23:36:51.826660 IP ip-172-31-13-67.us-west-2.compute.internal > ip-172-31-14-193.us-west-2.compute.internal: VRRPv2, Advertisement, vrid 51, prio 101, authtype none, intvl 1s, length 20 23:36:52.827798 IP ip-172-31-13-67.us-west-2.compute.internal > ip-172-31-14-193.us-west-2.compute.internal: VRRPv2, Advertisement, vrid 51, prio 101, authtype none, intvl 1s, length 20 

服务器B(“备份”):

configuration:

 vrrp_instance VI_1 { debug 2 interface eth0 state BACKUP virtual_router_id 51 priority 100 unicast_src_ip 172.31.14.193 unicast_peer { 172.31.13.67 } virtual_ipaddress { 172.31.100.100 dev eth0 } } 

服务器B上的相关/ var / log / messages /

 Aug 26 23:13:20 Server B systemd: Started LVS and VRRP High Availability Monitor. Aug 26 23:13:20 Server B Keepalived_vrrp[11498]: Netlink reflector reports IP 172.31.14.193 added Aug 26 23:13:20 Server B Keepalived_vrrp[11498]: Netlink reflector reports IP fe80::839:ffff:fe8f:db75 added Aug 26 23:13:20 Server B Keepalived_vrrp[11498]: Registering Kernel netlink reflector Aug 26 23:13:20 Server B Keepalived_vrrp[11498]: Registering Kernel netlink command channel Aug 26 23:13:20 Server B Keepalived_vrrp[11498]: Registering gratuitous ARP shared channel Aug 26 23:13:20 Server B Keepalived_healthcheckers[11497]: Netlink reflector reports IP 172.31.14.193 added Aug 26 23:13:20 Server B Keepalived_healthcheckers[11497]: Netlink reflector reports IP fe80::839:ffff:fe8f:db75 added Aug 26 23:13:20 Server B Keepalived_healthcheckers[11497]: Registering Kernel netlink reflector Aug 26 23:13:20 Server B Keepalived_healthcheckers[11497]: Registering Kernel netlink command channel Aug 26 23:13:20 Server B Keepalived_vrrp[11498]: Opening file '/etc/keepalived/keepalived.conf'. Aug 26 23:13:20 Server B Keepalived_vrrp[11498]: Configuration is using : 60782 Bytes Aug 26 23:13:20 Server B Keepalived_vrrp[11498]: Using LinkWatch kernel netlink reflector... Aug 26 23:13:20 Server B Keepalived_vrrp[11498]: VRRP_Instance(VI_1) Entering BACKUP STATE Aug 26 23:13:20 Server B Keepalived_vrrp[11498]: VRRP sockpool: [ifindex(2), proto(112), unicast(1), fd(10,11)] Aug 26 23:13:20 Server B Keepalived_healthcheckers[11497]: Opening file '/etc/keepalived/keepalived.conf'. Aug 26 23:13:20 Server B Keepalived_healthcheckers[11497]: Configuration is using : 5141 Bytes Aug 26 23:13:20 Server B Keepalived_healthcheckers[11497]: Using LinkWatch kernel netlink reflector... Aug 26 23:13:23 Server B Keepalived_vrrp[11498]: VRRP_Instance(VI_1) Transition to MASTER STATE Aug 26 23:13:24 Server B Keepalived_vrrp[11498]: VRRP_Instance(VI_1) Entering MASTER STATE Aug 26 23:13:24 Server B Keepalived_vrrp[11498]: VRRP_Instance(VI_1) setting protocol VIPs. Aug 26 23:13:24 Server B Keepalived_vrrp[11498]: VRRP_Instance(VI_1) Sending gratuitous ARPs on eth0 for 172.31.100.100 Aug 26 23:13:24 Server B Keepalived_healthcheckers[11497]: Netlink reflector reports IP 172.31.100.100 added Aug 26 23:13:29 Server B Keepalived_vrrp[11498]: VRRP_Instance(VI_1) Sending gratuitous ARPs on eth0 for 172.31.100.100 Aug 26 23:15:30 Server B kernel: device eth0 entered promiscuous mode Aug 26 23:15:35 Server B kernel: device eth0 left promiscuous mode 

tcpdump“ip proto 112”:

 listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes 23:37:03.060867 IP ip-172-31-14-193.us-west-2.compute.internal > ip-172-31-13-67.us-west-2.compute.internal: VRRPv2, Advertisement, vrid 51, prio 100, authtype none, intvl 1s, length 20 23:37:04.062044 IP ip-172-31-14-193.us-west-2.compute.internal > ip-172-31-13-67.us-west-2.compute.internal: VRRPv2, Advertisement, vrid 51, prio 100, authtype none, intvl 1s, length 20 23:37:05.063169 IP ip-172-31-14-193.us-west-2.compute.internal > ip-172-31-13-67.us-west-2.compute.internal: VRRPv2, Advertisement, vrid 51, prio 100, authtype none, intvl 1s, length 20 23:37:06.064375 IP ip-172-31-14-193.us-west-2.compute.internal > ip-172-31-13-67.us-west-2.compute.internal: VRRPv2, Advertisement, vrid 51, prio 100, authtype none, intvl 1s, length 20 23:37:07.065562 IP ip-172-31-14-193.us-west-2.compute.internal > ip-172-31-13-67.us-west-2.compute.internal: VRRPv2, Advertisement, vrid 51, prio 100, authtype none, intvl 1s, length 20 23:37:08.066790 IP ip-172-31-14-193.us-west-2.compute.internal > ip-172-31-13-67.us-west-2.compute.internal: VRRPv2, Advertisement, vrid 51, prio 100, authtype none, intvl 1s, length 20 

我有一种感觉,我可能做了非常基本的非常错误的事情,但是我经历了大约十几次configuration文件的迭代,现在我正试图在绝对最“愚蠢”的层面上做所有事情。 我想重新启动“MASTER”并让“BACKUP”select变化,而是进入“FAULT”状态,或者随机做任何事情……