global_defs {
    router_id SANQUAN_EDGE_02
    enable_script_security
}

vrrp_script chk_front_vip {
    script "/usr/local/sbin/check-front-vip.sh"
    interval 2
    timeout 3
    fall 2
    rise 2
    user root
}

vrrp_script chk_mqtt_vip {
    script "/usr/local/sbin/check-mqtt-vip.sh"
    interval 2
    timeout 3
    fall 2
    rise 2
    user root
}

vrrp_script chk_db_proxy_vip {
    script "/usr/local/sbin/check-db-proxy-vip.sh"
    interval 2
    timeout 3
    fall 2
    rise 2
    user root
}

vrrp_instance FRONT_VIP {
    state BACKUP
    interface @@NODE_INTERFACE@@
    virtual_router_id 115
    priority 100
    advert_int 1
    nopreempt
    unicast_src_ip 10.2.203.103
    unicast_peer { 10.2.203.102 }
    authentication {
        auth_type PASS
        auth_pass __VRRP_AUTH_PASS__
    }
    virtual_ipaddress {
        10.2.203.115/24
    }
    track_script {
        chk_front_vip
    }
}

vrrp_instance MQTT_VIP {
    state BACKUP
    interface @@NODE_INTERFACE@@
    virtual_router_id 116
    priority 100
    advert_int 1
    nopreempt
    unicast_src_ip 10.2.203.103
    unicast_peer { 10.2.203.102 }
    authentication {
        auth_type PASS
        auth_pass __VRRP_AUTH_PASS__
    }
    virtual_ipaddress {
        10.2.203.116/24
    }
    track_script {
        chk_mqtt_vip
    }
}

vrrp_instance DB_PROXY_VIP {
    state BACKUP
    interface @@NODE_INTERFACE@@
    virtual_router_id 117
    priority 100
    advert_int 1
    nopreempt
    unicast_src_ip 10.2.203.103
    unicast_peer { 10.2.203.102 }
    authentication {
        auth_type PASS
        auth_pass __VRRP_AUTH_PASS__
    }
    virtual_ipaddress {
        10.2.203.117/24
    }
    track_script {
        chk_db_proxy_vip
    }
}
