Haproxy Bind Error

Com*_*ock 2 linux proxy tcp rhel5 haproxy

你好StackOverflow,

我的haproxy似乎有一个错误,这是我尝试运行它时得到的

[ALERT] 208/051346 (5865) : Starting proxy ah1: cannot bind socket
[ALERT] 208/051346 (5865) : Starting proxy ah2: cannot bind socket
Run Code Online (Sandbox Code Playgroud)

我正在为TCP代理运行它.

这是我的配置:

#---------------------------------------------------------------------
# Example configuration for a possible web application.  See the
# full configuration options online.
#
#   http://haproxy.1wt.eu/download/1.3/doc/configuration.txt
#
#---------------------------------------------------------------------

#---------------------------------------------------------------------
# Global settings
#---------------------------------------------------------------------
    global
    log         127.0.0.1 local2 
    chroot      /var/lib/haproxy
    pidfile     /var/run/haproxy.pid
    maxconn     4000
    user        haproxy
    group       haproxy
    daemon

#---------------------------------------------------------------------
# common defaults that all the 'listen' and 'backend' sections will 
# use if not designated in their block
#---------------------------------------------------------------------
defaults
    mode        tcp
    log         global
    option      dontlognull
    option      forwardfor
    option      redispatch
    timeout connect 10000 # default 10 second time out if a backend is not found
    timeout client 300000
    timeout server 300000
    maxconn     60000
    retries     3


listen ah1 207.254.9.41:30000
mode tcp
balance leastconn
server ah1_1 46.16.77.23:30000

listen ah2 207.254.9.41:30001
mode tcp
balance leastconn
server ah2_1 46.16.77.23:30001
Run Code Online (Sandbox Code Playgroud)

我们正在运行Red Hat Enterprise Linux 5(x64)

dto*_*rgo 7

使用端口30000和30001检查现有进程:

lsof -i或netstat -lnp

如果您没有侦听端口30000或30001上的任何内容,请确保您在系统上实际配置了IP地址207.254.9.41:

ip addr或ifconfig

如果您没有看到列出的207.254.9.41,则可以将其更改为正确的IP地址,或者只关闭IP地址:

:30000而不是207.254.9.41:30000

如果没有一个修复它,那么我建议升级到1.4或1.5(我已经在一个非常大的生产环境中使用1.5近一年没有问题).如果1.4和1.5不在软件包存储库中,那么我建议自己编译.