【问题标题】:haproxy error on restarting重启时出现haproxy错误
【发布时间】:2017-11-04 23:36:49
【问题描述】:

HAProxy 重启时出错。这是我遇到的错误:

# systemctl status haproxy

● haproxy.service - SYSV: HA-Proxy is a TCP/HTTP reverse proxy which is particularly suited for high availability environments.
   Loaded: loaded (/etc/rc.d/init.d/haproxy; bad; vendor preset: disabled)
   Active: failed (Result: exit-code) since Fri 2017-11-03 03:34:04 EDT; 16s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 6170 ExecStart=/etc/rc.d/init.d/haproxy start (code=exited, status=1/FAILURE)

Nov 03 03:34:04 server systemd[1]: Starting SYSV: HA-Proxy is a TCP/HTTP reverse proxy which is particularly suited for high availability environments....
Nov 03 03:34:04 server haproxy[6170]: /etc/rc.d/init.d/haproxy: line 26: [: =: unary operator expected
Nov 03 03:34:04 server haproxy[6170]: Starting haproxy: [WARNING] 306/033404 (6178) : config : frontend 'GLOBAL' has no 'bind' directive. Please declare it... intended.
Nov 03 03:34:04 server haproxy[6170]: [ALERT] 306/033404 (6178) : Starting frontend http_front: cannot bind socket [0.0.0.0:80]
Nov 03 03:34:04 server haproxy[6170]: [FAILED]
Nov 03 03:34:04 server systemd[1]: haproxy.service: control process exited, code=exited status=1
Nov 03 03:34:04 server systemd[1]: Failed to start SYSV: HA-Proxy is a TCP/HTTP reverse proxy which is particularly suited for high availability environments..
Nov 03 03:34:04 server systemd[1]: Unit haproxy.service entered failed state.
Nov 03 03:34:04 server systemd[1]: haproxy.service failed.
Hint: Some lines were ellipsized, use -l to show in full.

我的配置文件:

haproxy.cfg

【问题讨论】:

    标签: linux centos cloud haproxy


    【解决方案1】:

    由于您使用的是 systemd,因此您应该使用 systemd 单元文件而不是 init.d 脚本。

    不知道你是怎么安装haproxy的,可以在haproxy源码目录(contrib/systemd)找到haproxy.service,复制到systemd文件夹下使用。

    cp contrib/systemd_haproxy.service /lib/systemd/system/
    systemctl daemon-reload
    systemctl enable haproxy
    systemctl start haproxy
    systemctl status haproxy
    

    【讨论】:

      猜你喜欢
      • 2020-09-14
      • 2019-09-08
      • 2020-07-29
      • 1970-01-01
      • 1970-01-01
      • 2018-12-17
      • 1970-01-01
      • 1970-01-01
      • 2015-05-28
      相关资源
      最近更新 更多