Keepalived VIP automatic failover

Source: Internet
Author: User
Tags failover haproxy

Keepalived VIP automatic failover

Keepalived:

1. The keepalived process is stopped.

2. track_script detection failed in keepalived.

Haproxy Detection:

Vrrp_script chk_haproxy {
Script "killall-0 haproxy" # cheaper than pidof
Interval 2 # check every 2 seconds
Weight-2
}

Switch related logs: tail-f/var/log/messages

Keepalived_vrrp [1, 32408]: VRRP_Script (chk_haproxy) failed
Keepalived_vrrp [32408]: VRRP_Instance (VI_1) initialized ed higher prio advert
Keepalived_vrrp [32408]: VRRP_Instance (VI_1) Entering BACKUP STATE
Keepalived_vrrp [32408]: VRRP_Instance (VI_1) removing protocol VIPs.
Keepalived_vrrp [1, 32408]: VRRP_Script (chk_haproxy) succeeded
Keepalived_vrrp [32408]: VRRP_Instance (VI_1) forcing a new MASTER election
Keepalived_vrrp [32408]: VRRP_Instance (VI_1) forcing a new MASTER election
Keepalived_vrrp [32408]: VRRP_Instance (VI_1) Transition to MASTER STATE
Keepalived_vrrp [32408]: VRRP_Instance (VI_1) Entering MASTER STATE
Keepalived_vrrp [32408]: VRRP_Instance (VI_1) setting protocol VIPs.
Keepalived_vrrp [32408]: VRRP_Instance (VI_1) Sending gratuitous ARPs on eth1 for 10.1.1.56
Keepalived_vrrp [32408]: VRRP_Instance (VI_1) Sending gratuitous ARPs on eth1 for 10.1.1.56

Failed switchover:

When the keepalived process is stopped, the VIP can be switched normally. When the keepalived process is running and the haproxy service is stopped, the VIP fails to be switched as scheduled.

Analysis:

Stop the haproxy service and manually execute killall-0 haproxy & echo "success" | echo "fail". The returned result is success.

After the haproxy service is stopped, ps aux | grep haproxy finds a properly started haproxy. After killall-9 haproxy, logs of normal VIP switching in tail-f/var/log/messages are found.

HAProxy + Keepalived dual-host high availability solution in Linux

Haproxy + Keepalived build Weblogic high-availability server Load balancer Cluster

Keepalived + HAProxy configure high-availability Load Balancing

Haproxy + Keepalived + Apache configuration notes in CentOS 6.3

Haproxy + KeepAlived WEB Cluster on CentOS 6

Haproxy + Keepalived build high-availability Load Balancing

This article permanently updates the link address:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.