CentOS 7.0 安装keepalived

Posted

tags:

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

1、安装目录包

yum install -y net-tools psmisc

2、安装keepalived

yum install -y ipvsadm keepalived

3、master配置文件

! Configuration File for keepalived
global_defs {
   notification_email {
     [email protected]
     [email protected]
     [email protected]
   }
   notification_email_from [email protected]
   smtp_server 192.168.200.1
   smtp_connect_timeout 30
   router_id LVS_DEVEL
}
vrrp_script chk_nginx {
   script "killall -0 nginx"
   interval 1
   weight -15
}
vrrp_instance VI_1 {
    state MASTER
    interface eno16777736
    virtual_router_id 51
    priority 100
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass 1111
    }
    virtual_ipaddress {
        172.16.1.10
    }
    track_script {
        chk_nginx
        }
}

4、backup配置文件

! Configuration File for keepalived
global_defs {
   notification_email {
     [email protected]
     [email protected]
     [email protected]
   }
   notification_email_from [email protected]
   smtp_server 192.168.200.1
   smtp_connect_timeout 30
   router_id LVS_DEVEL
}
vrrp_script chk_nginx {
   script "killall -0 nginx"
   interval 1
   weight -15
}
vrrp_instance VI_1 {
    state BACKUP
    interface eno16777736
    virtual_router_id 51
    priority 99
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass 1111
    }
    virtual_ipaddress {
        172.16.1.10
    }
    track_script {
        chk_nginx
        }
}

5、设置开启启动和启动keepalived

systemctl enable keepalived
systemctl start keepalived

参考博文:http://soulful.blog.51cto.com/468033/1676442

以上是关于CentOS 7.0 安装keepalived的主要内容,如果未能解决你的问题,请参考以下文章

CentOS 7离线安装Keepalived

CentOS安装Keepalived

centos7安装keepalived

Centos 7 Nginx+Keepalived+Tomcat 源码安装与运用

centos7安装keepalived问题

Centos7下安装keepalived