Keepalived 安装 配置 Nginx 高可用

发布时间 2023-12-26 14:58:31作者: zdtiio

Keepalived 安装 配置 Nginx 高可用

Keepalived 安装

yum install -y keepalived

配置文件位置

/etc/keepalived/keepalived.conf

配置nginx高可用

vi /etc/keepalived/keepalived.conf
vrrp_script chk_gluster {
    script "/usr/bin/systemctl is-active glusterd"
    interval 2
    weight -2
}

vrrp_instance VI_1 {
    state MASTER
    interface eth0
    virtual_router_id 51
    priority 101
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass YourAuthenticationPassword
    }
    virtual_ipaddress {
        10.158.16.150
    }
    track_script {
        chk_gluster
    }
}