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
成功启动

上一篇:2019 Feb-Mar To Do List


下一篇:HTTPS的内网访问和访问外网