1.安装yum -y install keepalive
2.编辑配置文件vim /etc/keepalive/keepalive.conf
global_defs {
router_id backup-node
}
vrrp_instance VI_1 {
state BACKUP#(如果是主节点写MASTER)
interface eth0
virtual_router_id 51(主备节点一致)
priority 90(主节点要大于从节点)
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
192.168.0.2/24(虚ip)
}
}
3.systemctl start keepalived启动
来源:https://www.cnblogs.com/CLAYJJ/p/12457405.html