我使用haproxy使用后端rabbitmq服务器进行负载均衡。
vrrp_script chk_haproxy { # Requires keepalived-1.1.13
script "killall -0 haproxy" # cheaper than pidof
interval 2 # check every 2 seconds
weight 20 # add 2 points of prio if OK
}
vrrp_instance VI_1 {
interface enp2s0
lvs_sync_daemon_inteface enp2s0
state BACKUP
virtual_router_id 51
priority 101 # 101 on master, 100 on backup
advert_int 1
unicast_src_ip 192.168.0.38
unicast_peer
{
192.168.0.41
}
virtual_ipaddress {
192.168.0.100
}
track_script {
chk_haproxy
}
}
vrrp_instance VI_2 {
interface enp2s0
state BACKUP
priority 100
virtual_router_id 61
advert_int 1
unicast_src_ip 192.168.0.38
unicast_peer
{
192.168.0.41
}
virtual_ipaddress {
192.168.0.101
}
track_script {
chk_haproxy
}
}
我在keepalived.conf文件的代码中使用了此配置。是否可以在另一个节点上创建相同的配置?我想配置haproxy active-active。