The Keepalived node VIP address is a dual-vip address at two nodes.
I. symptom
Install the keepalived two-node server 10.11.4.186/187, which is mainly used for high availability and sets VIP10.11.4.185.
Ii. Cause 1. View logs
Check the log of 10.11.4.187 and find that the keepalived service on it enters master mode shortly after it is started to obtain the VIP. Also, check the log of 10.11.4.186 without any exception.
It is preliminarily determined that there is a problem with the negotiation mechanism (vrrp) on both sides. The negotiation between the 10.11.4.187 backup node and the 10.11.4.186 master node fails, and the master node is considered to be faulty and switched to the master node.
2. verify the analysis
# Use tcpdump to locate the problem. The following is the packet capture result on the 10.11.4.186 master node [root @ psql_master ~] # Tcpdump-I eth0 vrrp-n
# The following is the packet capture result of the 10.11.4.187 slave node [root @ psql_standby ~] # Tcpdump-I eth0 vrrp-n
Analysis 3. solution 1. Configure iptables
# Configure iptables to allow vrrp traffic or multicast traffic [root @ psql_standby ~] # Vim/etc/sysconfig/iptables-a input-p vrrp-j ACCEPT # Or:-a input-m pkttype -- pkt-type multicast-j ACCEPT # restart iptables: [root @ psql_standby ~] # Service iptables restart
After the iptables policy is released, tcpdump captures packets and finds that the slave node 10.11.4.187 receives more advanced notifications, and no longer sends vrrp notifications.
2. Set vrrp unicast announcement (not verified)
# If multicast is disabled on the uplink switch of two nodes, you can only use the vrrp unicast notification method [root @ psql_master ~] # Vim/etc/keepalived. conf priority 100 unicast_src_ip 10.11.4.186 # source ip unicast_peer {10.11.4.187 # dest ip} [root @ psql_standby ~] # Vim/etc/keepalived. conf priority 90 unicast_src_ip 10.11.4.187 # source ip unicast_peer {10.11.4.186 # dest ip}