keepalive 双备机模式

双备机模式:互为备机,谁先开启,即为主机,重新restart,即成为备机。和网上的主备不一样噢


global_defs {
   notification_email {
     root@localhost
   }
   notification_email_from root@localhost
   smtp_server localhost  
   smtp_connect_timeout 30  
   router_id  NodeB
}
vrrp_script chk_magent { 
                                script "</dev/tcp/127.0.0.1/8080"
                interval 1
                weight -20
} 

vrrp_instance VI_1 {
    state BACKUP   #指定A节点为主节点 备用节点上设置为BACKUP即可  
    interface ens33  #绑定虚拟IP的网络接口  
    virtual_router_id 51  #VRRP组名,两个节点的设置必须一样,以指明各个节点属于同一VRRP组  
    priority 100  #主节点的优先级(1-254之间),备用节点必须比主节点优先级低  
    advert_int 1  #组播信息发送间隔,两个节点设置必须一样
    authentication {
        auth_type PASS
        auth_pass 1111
    }
    virtual_ipaddress {
        192.168.40.220
    }
}
192.168.40.122/24配置如上

! Configuration File for keepalived

global_defs {
   notification_email {
     root@localhost
   }
   notification_email_from root@localhost
   smtp_server localhost  
   smtp_connect_timeout 30  
   router_id  NodeA
}
vrrp_script chk_magent {
                script " "
                interval 5
                weight -20
}

vrrp_instance VI_1 {
    state BACKUP   #指定A节点为主节点 备用节点上设置为BACKUP即可  
    interface ens33  #绑定虚拟IP的网络接口  
    virtual_router_id 51  #VRRP组名,两个节点的设置必须一样,以指明各个节点属于同一VRRP组  
    priority 100  #主节点的优先级(1-254之间),备用节点必须比主节点优先级低  
    advert_int 1  #组播信息发送间隔,两个节点设置必须一样
    authentication {
        auth_type PASS
        auth_pass 1111
    }
    virtual_ipaddress {
        192.168.40.220
    }
}

192.168.40.60/24如上

192.168.40.60/24
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值