HA 代理无法在 Ubuntu 13 上启动

ali*_*der 5 haproxy ubuntu-13.04

我正在尝试通过 sudo 在 ubuntu 13 VM 上启动 HA Proxy 1.4.24。我的 haproxy.cfg 文件复制如下。但是,当我使用sudo service haproxy start或尝试sudo /etc/init.d/haproxy start 时,进程无法启动。任何有关解决此问题的想法都会有所帮助。配置文件似乎通过了配置测试(sudo haproxy -f haproxy.cfg -c导致“配置文件有效”)。
此外,/ etc/init.d 中 haproxy 文件中的Enabled标志设置为 1。端口 80 似乎不受任何其他服务的约束。

更新: 我已在 /etc/init.d/haproxy 文件中将启用标志设置为 1,而不是在 /etc/default/haproxy 文件中 - 修复此更改使我可以正常运行 haproxy。

global
    maxconn     25000 # Total Max Connections. This is dependent on ulimit
    daemon
    nbproc      4 # Number of processing cores. Dual Dual-core Opteron is 4 cores for example.

defaults
    mode        http
    clitimeout  60000
    srvtimeout  30000
    contimeout  4000
    timeout http-request 5s  # added to tackle slow http requests
        option abortonclose
        option forwardfor


listen  http_proxy *:80
        #bind *:80
    balance roundrobin # Load Balancing algorithm
    option httpchk
    option forwardfor # This sets X-Forwarded-For
        default_backend bk_web

# Dynamic part of the application
backend bk_web
    ## Define your servers to balance
    balance roundrobin ## change to URL hashing
    cookie MYSRV insert indirect nocache  ## check this NOTE TO SELF
    server server1 0.0.0.0:81 weight 1 maxconn 512 check
    server server2 0.0.0.0:82 weight 1 maxconn 512 check
Run Code Online (Sandbox Code Playgroud)

小智 9

你应该使用

sh -x /etc/init.d/haproxy start
Run Code Online (Sandbox Code Playgroud)

这将打印调试信息。你出错的地方。