简体   繁体   English

Keepalived运行状况检查无法连接到127.0.0.1

[英]Keepalived health check can't connect to 127.0.0.1

I've currently got a cluster of servers running Centos 7 and Docker, and I want to use Keepalived to allocate a floating IP between them. 我目前有一个运行Centos 7和Docker的服务器集群,我想使用Keepalived在它们之间分配浮动IP。 I've configured Keepalived to run a check command on each node which just does curl --silent --fail localhost:80 to ensure a HTTP server is listening. 我已经将Keepalived配置为在每个节点上运行一个check命令, curl --silent --fail localhost:80执行curl --silent --fail localhost:80以确保HTTP服务器正在侦听。

The web app is running using a Docker container bound to port 80 and --net=host on Docker 1.10.3. Web应用程序使用绑定到端口80的Docker容器和Docker 1.10.3上的--net=host运行。 Firewalld is also completely disabled. Firewalld也完全禁用。

The problem I'm having is that the curl never succeeds. 我遇到的问题是卷曲永远不会成功。 If I change the check command to echo '' or anything else which exits 0 (without any network interaction) it works fine, but for some reason the curl doesn't work. 如果我将check命令更改为echo ''或退出0的任何其他内容(没有任何网络交互),它可以正常工作,但由于某种原因,卷曲不起作用。 When I run it from a normal bash terminal it is fine, and echo $? 当我从普通的bash终端运行它很好,并echo $? prints a 0. 打印0。

I'm not even sure how to debug this as Keepalived doesn't provide any documentation on the matter and doesn't seem to log anything in relation to errors coming from the vrrp script. 我甚至不确定如何调试它,因为Keepalived没有提供任何关于此事的文档,并且似乎没有记录与来自vrrp脚本的错误相关的任何内容。

Any help or suggestions would be greatly appreciated. 任何帮助或建议将不胜感激。

Turns out I was using an ancient version of Keepalived. 事实证明我使用的是古代版本的Keepalived。 Compiling the latest version from source fixed the issue (rather than using the binary from Centos repos) 从源代码编译最新版本修复了问题(而不是使用Centos repos中的二进制文件)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM