今天在安装haproxy 过程中报错报错 Starting proxy rabbitmq: cannot bind socket
#下载haproxy rpm包网址 http://www.rpmfind.net/linux/rpm2html/search.php?query=haproxy # 因为我的是Centos 7 [root@kl tools]# wget http://www.rpmfind.net/linux/centos/7.4.1708/os/x86_64/Packages/haproxy-1.5.18-6.el7.x86_64.rpm # rpm -ivh 安装 [root@kl tools]# rpm -ivh haproxy-1.5.18-6.el7.x86_64.rpm Preparing... ################################# [100%] Updating / installing... 1:haproxy-1.5.18-6.el7 ################################# [100%]
启动查看没有端口
[root@kl haproxy]# systemctl start haproxy [root@kl haproxy]# netstat -lntulp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1155/sshd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1517/master tcp6 0 0 :::22 :::* LISTEN 1155/sshd tcp6 0 0 ::1:25
查看报错
# 在这个查看报错 [root@kl6 ~]# vim /var/log/messages Mar 6 23:01:29 localhost haproxy-systemd-wrapper: [WARNING] 064/230129 (2396) : config : log format ignored for proxy 'private_monitoring' since it has no log address. Mar 6 23:01:29 localhost haproxy-systemd-wrapper: [ALERT] 064/230129 (2396) : Starting proxy rabbitmq: cannot bind socket [172.16.1.10:5672]
# 设置
# 开启允许绑定非本机的IP [root@kl6 ~]# vi /etc/sysctl.conf net.ipv4.ip_nonlocal_bind=1 # 生效 [root@kl6 ~]# sysctl -p net.ipv4.ip_nonlocal_bind = 1
再次启动
[root@kl6 ~]# systemctl start haproxy [root@kl6 ~]# netstat -lntup Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1142/sshd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1489/master tcp 0 0 0.0.0.0:8100 0.0.0.0:* LISTEN 2426/haproxy tcp 0 0 172.16.1.110:5672 0.0.0.0:* LISTEN 2426/haproxy tcp6 0 0 :::22 :::* LISTEN 1142/sshd tcp6 0 0 ::1:25 :::* LISTEN 1489/master