centos7 keepalived 配置高可用

Posted s--s

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos7 keepalived 配置高可用相关的知识,希望对你有一定的参考价值。

! Configuration File for keepalived
global_defs {
   notification_email {
     xaioqiang[email protected]com
   }
   notification_email_from [email protected].com
   smtp_server 192.168.200.1
   smtp_connect_timeout 30
   router_id keepalived1
   vrrp_skip_check_adv_addr
   #vrrp_strict 如果在ping不通的情况下 要注释这条
   vrrp_garp_interval 0
   vrrp_gna_interval 0
}
vrrp_script chk_nginx {
   script "killall -0 nginx"
   interval 2
   weight -20
}
vrrp_instance VI_1 {
    state MASTER
    interface ens33
    virtual_router_id 51
    priority 100
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass 1114
    }
    virtual_ipaddress {
        192.168.132.16/32 dev ens33 label ens33:0
    }
    track_script {
    chk_nginx
    }
}
vrrp_instance VI_2 {
    state BACKUP
    interface ens33
    virtual_router_id 59
    priority 98
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass 2224
    }
    virtual_ipaddress {
        192.168.132.17/32 dev ens33 label ens33:1
    }
    track_script {
    chk_nginx
    }
}

 

以上是关于centos7 keepalived 配置高可用的主要内容,如果未能解决你的问题,请参考以下文章

keepalived安装与配置,组建高可用服务器

CentOS7.4—构建LVS+Keepalived高可用群集

nginx+keepalived实现高可用负载均衡

CentOS7构建LVS+Keepalived高可用方案

搭建:LVS+Keepalived高可用Web服务群集环境

centos7下配置LVS+KeepAlived高可用主备+2台tomcat负载图文篇