keepalived实现高可用

时间:2023-12-30 20:20:02

准备:

1、A-centos(192.168.6.177)  端口为9898的服务

2、B-ubuntu(192.168.6.182)  端口为9898的服务

3、keepalived安装包https://www.keepalived.org/software/keepalived-1.4.0.tar.gz

安装参考:https://blog.csdn.net/cuiyaoqiang/article/details/79412599

配置理解:https://blog.51cto.com/13055758/2071439?from=timeline

服务启动

service keepalived start

如果报错,参考

https://blog.csdn.net/zsg88/article/details/76690847

我遇到的错误和https://blog.csdn.net/zsg88/article/details/76690847不一样,但是可以参考

我发现报错信息中提示:

Unable to find configuration file /etc/keepalived/keepalived.conf (glob returned 3)

所有我执行了以下命令:

mkdir /etc/keepalived/

cp  /usr/local/keepalived/etc/keepalived/keepalived.conf /etc/keepalived/keepalived.conf

systemctl start keepalived.service

systemctl status keepalived.service

然后keepalived服务就运行起来了