安装配置Keepalived

通过Yum下载

yum -y install keepalived

编辑配置文件

vi /etc/keepalived/keepalived.conf

主要配置参数

参数字段示例说明
interface ens33侦听的网卡
priority 90优先级,越大越优先
virtual_ipaddress虚拟IP地址
nopreempt非抢占模式,Master起来之后不会再抢占
! Configuration File for keepalived

global_defs {
   notification_email {
     acassen@firewall.loc
     failover@firewall.loc
     sysadmin@firewall.loc
   }
   notification_email_from Alexandre.Cassen@firewall.loc
   smtp_server 192.168.200.1
   smtp_connect_timeout 30
   router_id LVS_DEVEL
   vrrp_skip_check_adv_addr
   vrrp_strict
   vrrp_garp_interval 0
   vrrp_gna_interval 0
}

vrrp_instance VI_1 {
    state MASTER
    interface ens33
    virtual_router_id 51
    priority 90
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass 1111
    }
    virtual_ipaddress {
        192.168.31.100
    }
}

设置开机启动

systemctl enable  keepalived

启动keepalive服务

systemctl start  keepalived
Last modification:March 12th, 2022 at 11:56 pm
硬币投入口