Keepalived安装(一键编译安装Keepalived脚本)

Keepalived -----》 VIP
即使Master服务器挂了还有Slave服务器,Master服务器的VIP会漂移到Slave服务器
在这里插入图片描述

在这里插入图片描述

Keepalived 包安装

#CentOS
[root@centos ~]#yum -y install keepalived
#ubuntu
[root@ubuntu1804 ~]#apt -y install keepalived

查看keepalived.service

#dpkg -L keepalived |grep service
/lib/systemd/system/keepalived.service

#grep -Ev '^#' /lib/systemd/system/keepalived.service
[Unit]
Description=Keepalive Daemon (LVS and VRRP)
After=network-online.target
Wants=network-online.target
ConditionFileNotEmpty=/etc/keepalived/keepalived.conf

[Service]
Type=simple
EnvironmentFile=-/etc/default/keepalived
ExecStart=/usr/sbin/keepalived --dont-fork $DAEMON_ARGS
ExecReload=/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target

[root@ubuntu110 ~]#keepalived -v
Keepalived v2.0.19 (10/19,2019)

安装后服务并未启动
在这里插入图片描述
拷贝配置文件模版作为配置文件

#cp /usr/share/doc/keepalived/samples/keepalived.conf.sample /etc/keepalived/keepalived.conf

重启服务
#systemctl restart keepalived.service
#systemctl status keepalived.service

在这里插入图片描述

KA1主机IP
在这里插入图片描述

KA1配置文件

# vim /etc/keepalived/keepalived.conf
global_defs {
   
   router_id ka1
}

vrrp_instance VI_1 {
   
    state MASTER
    interface eth0
    virtual_router_id 66
    priority 100
    advert_int 1
    authentication {
   
        auth_type PASS
        auth_pass 123456
    }
    virtual_ipaddress {
   
        10.0.0.100/8 dev eth0 label eth0:1
    }
}

KA2主机IP
在这里插入图片描述

KA2配置文件

# vim /etc/keepalived/keepalived.conf
global_defs {
   
   
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值