在两台机器上执行yum install -y keepalived
128机器之前已经安装了nginx,所以只要在129机器上安装nginx yum install -y nginx
[[email protected] ~]# ls /etc/keepalived/keepalived.conf
/etc/keepalived/keepalived.conf
[[email protected] ~]# cat !$
把原始的文件清空掉
[[email protected] ~]# > /etc/keepalived/keepalived.conf
nginx与keepalived都没有问题
nginx服务停止后,自动启动了
/var/log/messages 存放keepalived日志
检查防火墙
检查从,发现有防火墙,systemctl stop firewalld
关闭主上的keepalived,发现主上192.168.5.100没有了,而从上有192.168.5.100
访问192.168.5.100,是从的默认页面
再开启主的keepalived服务,主上有192.168.5.100,而从上没有了
访问192.168.5.100,主的默认页面
原文地址:https://www.cnblogs.com/sisul/p/8728520.html
时间: 2024-10-21 06:20:23