配置文件:

主:192.168.1.14

! Configuration File for keepalived

global_defs {
  script_user root
  enable_script_security
}

vrrp_script check_nginx {
    script "/etc/keepalived/nginx_check.sh"
    interval 10
}

vrrp_instance VI_1 {
    state BACKUP
    nopreempt
    interface eth0
    virtual_router_id 101
    priority 100
    unicast_src_ip 192.168.1.14
    unicast_peer { 
        192.168.1.15
    }
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass test123
    }
    virtual_ipaddress {
        118.24.101.16/24 dev eth1
    }
    track_interface {
        eth0
    }
    track_script {
        check_nginx
    }
}

keepalived.conf
keepalived.conf

相关文章: