Some instance configurations of Keepalived Vrrp_script

Source: Internet
Author: User
The code is as follows Copy Code

Vrrp_script Chk_sshd {
Script "killall-0 sshd" # cheaper than pidof
Interval 2 # Check every 2 seconds
Weight-4 # Default Prio:-4 if KO
}

Vrrp_script Chk_haproxy {
Script "killall-0 haproxy" # cheaper than pidof
Interval 2 # Check every 2 seconds
}

Vrrp_script Chk_http_port {
Script "/TCP/127.0.0.1/80" # Connects and exits
Interval 1 # Check every second
Weight-2 # Default Prio:-2 if Connect fails
}

Vrrp_script Chk_https_port {
Script "/tcp/127.0.0.1/443"
Interval 1
Weight-2
}

Vrrp_script Chk_smtp_port {
Script "/TCP/127.0.0.1/25"
Interval 1
Weight-2
}

Vrrp_instance Vi_1 {
Interface eth0
State MASTER
VIRTUAL_ROUTER_ID 51
Priority 100

virtual_ipaddress {
192.168.200.18/25
}

Track_interface {
eth1 Weight 2 # prio = +2 if up
Eth2 weight-2 # prio =-2 if down
Eth3 # no weight, fault if down
}

Track_script {
CHK_SSHD # Use default weight the script
Chk_haproxy Weight 2 # +2 If process is present
Chk_http_port
Chk_https_port
Chk_smtp_port
}
}

Vrrp_instance Vi_2 {
Interface eth1
State MASTER
VIRTUAL_ROUTER_ID 52
Priority 100

virtual_ipaddress {
192.168.201.18/26
}

Track_interface {
Eth0 Weight 2 # prio = +2 if up
Eth2 weight-2 # prio =-2 if down
Eth3 # no weight, fault if down
}

Track_script {
Chk_haproxy Weight 2
Chk_http_port
Chk_https_port
Chk_smtp_port
}
}

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.