haproxy 无法启动,需要添加内核参数
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了haproxy 无法启动,需要添加内核参数相关的知识,希望对你有一定的参考价值。
安装好haproxy后,配置正确无法启动,看日志:
Feb 13 09:32:50 cluster-node2 systemd: Started HAProxy Load Balancer.
Feb 13 09:32:50 cluster-node2 haproxy-systemd-wrapper: [ALERT] 043/093250 (6538) : Starting proxy mysql-pxc-cluster: cannot bind socket [192.168.22.30:3306]
Feb 13 09:32:50 cluster-node2 haproxy-systemd-wrapper: [ALERT] 043/093250 (6538) : Starting proxy rabbitmq-cluster: cannot bind socket [192.168.22.30:5673]
Feb 13 09:32:50 cluster-node2 haproxy-systemd-wrapper: [ALERT] 043/093250 (6538) : Starting proxy rabbitmq-cluster-management: cannot bind socket [192.168.22.30:15673]
Feb 13 09:32:50 cluster-node2 haproxy-systemd-wrapper: haproxy-systemd-wrapper: exit, haproxy RC=1
Feb 13 09:32:50 cluster-node2 systemd: haproxy.service: main process exited, code=exited, status=1/FAILURE
Feb 13 09:32:50 cluster-node2 systemd: Unit haproxy.service entered failed state.
Feb 13 09:32:50 cluster-node2 systemd: haproxy.service failed.
解决:
vim /etc/sysctl.conf
net.ipv4.ip_nonlocal_bind=1
然后sysctl -p
成功启动
以上是关于haproxy 无法启动,需要添加内核参数的主要内容,如果未能解决你的问题,请参考以下文章
sh Unbounce脚本片段,用于在零停机时间内重新启动HAProxy