【问题标题】:Haproxy Bind Error [closed]Haproxy绑定错误[关闭]
【发布时间】:2013-07-28 05:23:16
【问题描述】:

你好 StackOverflow,

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

[ALERT] 208/051346 (5865) : Starting proxy ah1: cannot bind socket
[ALERT] 208/051346 (5865) : Starting proxy ah2: cannot bind socket

我正在为 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

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

【问题讨论】:

    标签: linux tcp proxy haproxy rhel5


    【解决方案1】:

    使用端口 30000 和 30001 检查已经存在的进程:

    lsof -i 或 netstat -lnp

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

    ip 地址或 ifconfig

    如果您没有看到 207.254.9.41 列出,那么您可以将其更改为正确的 IP 地址或直接取消 IP 地址:

    :30000 而不是 207.254.9.41:30000

    如果这些都不能解决问题,那么我建议升级到 1.4 或 1.5(我已经在非常大的生产环境中使用 1.5 将近一年了,没有任何问题)。如果 1.4 和 1.5 不在包存储库中,那么我建议您自己编译。

    【讨论】:

    • ":30000 而不是 207.254.9.41:30000" 这帮助我摆脱了绑定错误的问题。谢谢。
    【解决方案2】:

    可能是您在该服务器上运行 apache,它使用的端口与您在 Haproxy 上使用的端口相同。然后只需停止您使用在 haproxy 上使用的相同端口的应用程序,然后重新启动它。它应该工作。

    谢谢

    【讨论】:

      猜你喜欢
      • 2013-09-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-06-09
      • 1970-01-01
      • 1970-01-01
      • 2017-01-15
      • 1970-01-01
      相关资源
      最近更新 更多