Last active
April 27, 2022 20:24
-
-
Save liejuntao001/2d65ce6e71bb45dd8e4f4db97e75f36d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this is for haproxy1 | |
vrrp_instance VI_1 { | |
state MASTER | |
interface eth0 | |
virtual_router_id 101 | |
priority 101 # higher priority | |
advert_int 1 | |
unicast_src_ip 192.168.3.122 # haproxy1 private ip | |
unicast_peer { | |
192.168.2.17 # haproxy2 private ip | |
} | |
authentication { | |
auth_type PASS | |
auth_pass password | |
} | |
virtual_ipaddress { | |
192.168.4.130/17 # floating private ip | |
45.xx.xx.xx/24 # floating public ip | |
} | |
notify_master "/bin/echo 'now master' > /tmp/keepalived.state" | |
notify_backup "/bin/echo 'now backup' > /tmp/keepalived.state" | |
notify_fault "/bin/echo 'now fault' > /tmp/keepalived.state" | |
smtp_alert | |
} | |
# this is for haproxy2 | |
vrrp_instance VI_1 { | |
state MASTER | |
interface eth0 | |
virtual_router_id 101 | |
priority 100 # lower priority | |
advert_int 1 | |
unicast_src_ip 192.168.2.17 | |
unicast_peer { | |
192.168.3.122 | |
} | |
authentication { | |
auth_type PASS | |
auth_pass password | |
} | |
virtual_ipaddress { | |
192.168.4.130/17 # floating private ip | |
45.xx.xx.xx/24 # floating public ip | |
} | |
notify_master "/bin/echo 'now master' > /tmp/keepalived.state" | |
notify_backup "/bin/echo 'now backup' > /tmp/keepalived.state" | |
notify_fault "/bin/echo 'now fault' > /tmp/keepalived.state" | |
smtp_alert | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment