本文共 9538 字,大约阅读时间需要 31 分钟。
Aug 21 13:59:03 192_168_173_203 Keepalived[421]: Starting Keepalived v1.2.13 (08/19,2014)Aug 21 13:59:03 192_168_173_203 Keepalived[422]: Starting Healthcheck child process, pid=423Aug 21 13:59:03 192_168_173_203 Keepalived[422]: Starting VRRP child process, pid=424Aug 21 13:59:03 192_168_173_203 Keepalived_vrrp[424]: Netlink reflector reports IP 192.168.173.203 addedAug 21 13:59:03 192_168_173_203 Keepalived_vrrp[424]: Netlink reflector reports IP 192.168.173.156 addedAug 21 13:59:03 192_168_173_203 Keepalived_vrrp[424]: Netlink reflector reports IP fe80::f6ce:46ff:fe86:4234 addedAug 21 13:59:03 192_168_173_203 Keepalived_vrrp[424]: Registering Kernel netlink reflectorAug 21 13:59:03 192_168_173_203 Keepalived_healthcheckers[423]: Netlink reflector reports IP 192.168.173.203 addedAug 21 13:59:03 192_168_173_203 Keepalived_vrrp[424]: Registering Kernel netlink command channelAug 21 13:59:03 192_168_173_203 Keepalived_healthcheckers[423]: Netlink reflector reports IP 192.168.173.156 addedAug 21 13:59:03 192_168_173_203 Keepalived_vrrp[424]: Registering gratuitous ARP shared channelAug 21 13:59:03 192_168_173_203 Keepalived_healthcheckers[423]: Netlink reflector reports IP fe80::f6ce:46ff:fe86:4234 addedAug 21 13:59:03 192_168_173_203 Keepalived_healthcheckers[423]: Registering Kernel netlink reflectorAug 21 13:59:03 192_168_173_203 Keepalived_healthcheckers[423]: Registering Kernel netlink command channelAug 21 13:59:03 192_168_173_203 Keepalived_vrrp[424]: Opening file '/opt/keepalived/etc/keepalived/keepalived.conf'.Aug 21 13:59:03 192_168_173_203 Keepalived_healthcheckers[423]: Opening file '/opt/keepalived/etc/keepalived/keepalived.conf'.Aug 21 13:59:03 192_168_173_203 Keepalived_healthcheckers[423]: Configuration is using : 7937 BytesAug 21 13:59:03 192_168_173_203 Keepalived_vrrp[424]: Configuration is using : 69311 BytesAug 21 13:59:03 192_168_173_203 Keepalived_vrrp[424]: Using LinkWatch kernel netlink reflector...Aug 21 13:59:03 192_168_173_203 Keepalived_vrrp[424]: VRRP sockpool: [ifindex(2), proto(112), unicast(1), fd(10,11)]Aug 21 13:59:03 192_168_173_203 Keepalived_healthcheckers[423]: Using LinkWatch kernel netlink reflector...Aug 21 13:59:03 192_168_173_203 Keepalived_vrrp[424]: VRRP_Script(nag) succeededAug 21 13:59:03 192_168_173_203 Keepalived_vrrp[424]: VRRP_Script(zero) succeededAug 21 13:59:03 192_168_173_203 Keepalived_vrrp[424]: VRRP_Script(pos) succeededAug 21 13:59:04 192_168_173_203 Keepalived_vrrp[424]: VRRP_Instance(vi_1) Transition to MASTER STATEAug 21 13:59:05 192_168_173_203 Keepalived_vrrp[424]: VRRP_Instance(vi_1) Entering MASTER STATEAug 21 13:59:05 192_168_173_203 Keepalived_vrrp[424]: VRRP_Instance(vi_1) setting protocol VIPs.Aug 21 13:59:05 192_168_173_203 Keepalived_vrrp[424]: VRRP_Instance(vi_1) Sending gratuitous ARPs on eth0 for 172.16.173.100Aug 21 13:59:05 192_168_173_203 Keepalived_healthcheckers[423]: Netlink reflector reports IP 172.16.173.100 addedAug 21 13:59:06 192_168_173_203 rgmanager[652]: [script] Executing /usr/local/bin/pgctl.sh statusAug 21 13:59:10 192_168_173_203 Keepalived_vrrp[424]: VRRP_Instance(vi_1) Sending gratuitous ARPs on eth0 for 172.16.173.100Aug 21 13:59:26 192_168_173_203 rgmanager[1041]: [script] Executing /usr/local/bin/pgctl.sh statusAug 21 13:59:29 192_168_173_203 Keepalived_vrrp[424]: VRRP_Instance(vi_1) Received higher prio advertAug 21 13:59:29 192_168_173_203 Keepalived_vrrp[424]: VRRP_Instance(vi_1) Entering BACKUP STATEAug 21 13:59:29 192_168_173_203 Keepalived_vrrp[424]: VRRP_Instance(vi_1) removing protocol VIPs.Aug 21 13:59:29 192_168_173_203 Keepalived_healthcheckers[423]: Netlink reflector reports IP 172.16.173.100 removedAug 21 13:59:03 192_168_173_203 Keepalived[421]: Starting Keepalived v1.2.13 (08/19,2014)Aug 21 13:59:03 192_168_173_203 Keepalived[422]: Starting Healthcheck child process, pid=423Aug 21 13:59:03 192_168_173_203 Keepalived[422]: Starting VRRP child process, pid=424Aug 21 13:59:03 192_168_173_203 Keepalived_vrrp[424]: Netlink reflector reports IP 192.168.173.203 addedAug 21 13:59:03 192_168_173_203 Keepalived_vrrp[424]: Netlink reflector reports IP 192.168.173.156 addedAug 21 13:59:03 192_168_173_203 Keepalived_vrrp[424]: Netlink reflector reports IP fe80::f6ce:46ff:fe86:4234 addedAug 21 13:59:03 192_168_173_203 Keepalived_vrrp[424]: Registering Kernel netlink reflectorAug 21 13:59:03 192_168_173_203 Keepalived_healthcheckers[423]: Netlink reflector reports IP 192.168.173.203 addedAug 21 13:59:03 192_168_173_203 Keepalived_vrrp[424]: Registering Kernel netlink command channelAug 21 13:59:03 192_168_173_203 Keepalived_healthcheckers[423]: Netlink reflector reports IP 192.168.173.156 addedAug 21 13:59:03 192_168_173_203 Keepalived_vrrp[424]: Registering gratuitous ARP shared channelAug 21 13:59:03 192_168_173_203 Keepalived_healthcheckers[423]: Netlink reflector reports IP fe80::f6ce:46ff:fe86:4234 addedAug 21 13:59:03 192_168_173_203 Keepalived_healthcheckers[423]: Registering Kernel netlink reflectorAug 21 13:59:03 192_168_173_203 Keepalived_healthcheckers[423]: Registering Kernel netlink command channelAug 21 13:59:03 192_168_173_203 Keepalived_vrrp[424]: Opening file '/opt/keepalived/etc/keepalived/keepalived.conf'.Aug 21 13:59:03 192_168_173_203 Keepalived_healthcheckers[423]: Opening file '/opt/keepalived/etc/keepalived/keepalived.conf'.Aug 21 13:59:03 192_168_173_203 Keepalived_healthcheckers[423]: Configuration is using : 7937 BytesAug 21 13:59:03 192_168_173_203 Keepalived_vrrp[424]: Configuration is using : 69311 BytesAug 21 13:59:03 192_168_173_203 Keepalived_vrrp[424]: Using LinkWatch kernel netlink reflector...Aug 21 13:59:03 192_168_173_203 Keepalived_vrrp[424]: VRRP sockpool: [ifindex(2), proto(112), unicast(1), fd(10,11)]Aug 21 13:59:03 192_168_173_203 Keepalived_healthcheckers[423]: Using LinkWatch kernel netlink reflector...Aug 21 13:59:03 192_168_173_203 Keepalived_vrrp[424]: VRRP_Script(nag) succeededAug 21 13:59:03 192_168_173_203 Keepalived_vrrp[424]: VRRP_Script(zero) succeededAug 21 13:59:03 192_168_173_203 Keepalived_vrrp[424]: VRRP_Script(pos) succeededAug 21 13:59:04 192_168_173_203 Keepalived_vrrp[424]: VRRP_Instance(vi_1) Transition to MASTER STATEAug 21 13:59:05 192_168_173_203 Keepalived_vrrp[424]: VRRP_Instance(vi_1) Entering MASTER STATEAug 21 13:59:05 192_168_173_203 Keepalived_vrrp[424]: VRRP_Instance(vi_1) setting protocol VIPs.Aug 21 13:59:05 192_168_173_203 Keepalived_vrrp[424]: VRRP_Instance(vi_1) Sending gratuitous ARPs on eth0 for 172.16.173.100Aug 21 13:59:05 192_168_173_203 Keepalived_healthcheckers[423]: Netlink reflector reports IP 172.16.173.100 addedAug 21 13:59:10 192_168_173_203 Keepalived_vrrp[424]: VRRP_Instance(vi_1) Sending gratuitous ARPs on eth0 for 172.16.173.100Aug 21 13:59:29 192_168_173_203 Keepalived_vrrp[424]: VRRP_Instance(vi_1) Received higher prio advertAug 21 13:59:29 192_168_173_203 Keepalived_vrrp[424]: VRRP_Instance(vi_1) Entering BACKUP STATEAug 21 13:59:29 192_168_173_203 Keepalived_vrrp[424]: VRRP_Instance(vi_1) removing protocol VIPs.Aug 21 13:59:29 192_168_173_203 Keepalived_healthcheckers[423]: Netlink reflector reports IP 172.16.173.100 removed当我把192.168.173.204的nag.var调成1, nag.sh脚本检查失败, 日志如下
Aug 21 13:59:43 192_168_173_204 Keepalived_vrrp[13887]: VRRP_Script(nag) failed但是不影响 192.168.173.204的优先级, 所以它还是master.
[root@192_168_173_204 ~]# ifconfigeth0 Link encap:Ethernet HWaddr F4:CE:46:85:15:FC inet addr:192.168.173.204 Bcast:192.168.173.255 Mask:255.255.255.0 inet6 addr: fe80::f6ce:46ff:fe85:15fc/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:10360595 errors:0 dropped:0 overruns:0 frame:0 TX packets:4714379 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:1469576774 (1.3 GiB) TX bytes:661681617 (631.0 MiB)eth0:1 Link encap:Ethernet HWaddr F4:CE:46:85:15:FC inet addr:172.16.173.100 Bcast:172.16.173.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:163476 errors:0 dropped:0 overruns:0 frame:0 TX packets:163476 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:8835522 (8.4 MiB) TX bytes:8835522 (8.4 MiB)[参考]
if (vrrp->base_priority == VRRP_PRIO_OWNER) { /* we will not run a PRIO_OWNER into a non-PRIO_OWNER */ vrrp->effective_priority = VRRP_PRIO_OWNER; } else { /* WARNING! we must compute new_prio on a signed int in order to detect overflows and avoid wrapping. */ new_prio = vrrp->base_priority + prio_offset; if (new_prio < 1) new_prio = 1; else if (new_prio > 254) new_prio = 254; vrrp->effective_priority = new_prio; }keepalived / include / vrrp.h#define VRRP_PRIO_OWNER 255 /* priority of the ip owner -- rfc2338.5.3.4 */换句话说, 只有初始优先级配置<255的instance, 才可以动态调整优先级. 并且动态调整后的优先级范围是1到254.
priority# VRRP PRIO
转载地址:http://ebzel.baihongyu.com/