安装配置Keepalived

Posted zhengchuzhou

tags:

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

一、在haproxy容器安装Keepalived

1、进入haproxy容器: docker exec -it h1 bash

2、apt-get update(因为haproxy容器为Ubuntu)

3、apt-get install -y keepalived

技术分享图片

二、配置:

1、安装vim编辑器:apt-get install -y vim

2、编辑keepalived.conf文件:vim /etc/keepalived/keepalived.conf

vrrp_instance  VI_1 {
    state  MASTER
    interface  eth0
    virtual_router_id  51
    priority  100
    advert_int  1
    authentication {
        auth_type  PASS
        auth_pass  123456
    }
    virtual_ipaddress {
        172.18.0.201
    }
}

3、开启keepalived:service keepalived start

 技术分享图片

4、检测:在宿主机ping接keepalived的ip,看是否能ping接成功

ping 172.18.0.201

技术分享图片

 

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

Keepalived 安装与配置

keepalived+haproxy 安装配置

Keepalived安装与配置

安装配置Keepalived

keepalived高可用搭建

keepalived源码安装与配置