HAProxy community

Getting Error While starting haproxy

[root@haproxy_restored haproxy]# haproxy -c -f haproxy.cfg

Configuration file is valid
[root@haproxy_restored haproxy]#
[root@haproxy_restored haproxy]# systemctl restart haproxy.service
[root@haproxy_restored haproxy]# systemctl status haproxy.service
● haproxy.service - HAProxy Load Balancer
Loaded: loaded (/usr/lib/systemd/system/haproxy.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Fri 2020-08-14 15:04:27 +0530; 4s ago
Process: 4310 ExecStart=/usr/sbin/haproxy-systemd-wrapper -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid $OPTIONS (code=exited, status=1/FAILURE)
Main PID: 4310 (code=exited, status=1/FAILURE)

Aug 14 15:04:27 haproxy_restored haproxy-systemd-wrapper[4310]: [ALERT] 226/150427 (4311) : Starting proxy xcurrent_coinone1_l2: cannot bind socket…4:5000]
Aug 14 15:04:27 haproxy_restored haproxy-systemd-wrapper[4310]: [ALERT] 226/150427 (4311) : Starting proxy xcurrent_coinone2_l2: cannot bind socket…4:3999]
Aug 14 15:04:27 haproxy_restored haproxy-systemd-wrapper[4310]: [ALERT] 226/150427 (4311) : Starting proxy xcurrent_coinone3_l3: cannot bind socket…4:3002]
Aug 14 15:04:27 haproxy_restored haproxy-systemd-wrapper[4310]: [ALERT] 226/150427 (4311) : Starting proxy xcurrent_coinone4_l4: cannot bind socket…4:3009]
Aug 14 15:04:27 haproxy_restored haproxy-systemd-wrapper[4310]: [ALERT] 226/150427 (4311) : Starting proxy xcurrent_sabb1_l1: cannot bind socket [1…44:443]
Aug 14 15:04:27 haproxy_restored haproxy-systemd-wrapper[4310]: [ALERT] 226/150427 (4311) : Starting proxy kapruka: cannot bind socket [192.168.5.44:8080]
Aug 14 15:04:27 haproxy_restored haproxy-systemd-wrapper[4310]: haproxy-systemd-wrapper: exit, haproxy RC=1
Aug 14 15:04:27 haproxy_restored systemd[1]: haproxy.service: main process exited, code=exited, status=1/FAILURE
Aug 14 15:04:27 haproxy_restored systemd[1]: Unit haproxy.service entered failed state.
Aug 14 15:04:27 haproxy_restored systemd[1]: haproxy.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
[root@haproxy_restored haproxy]#

Can you should the output of:

haproxy -vv
cat /usr/lib/systemd/system/haproxy.service

Also please explain what OS you have and the install history of haproxy here.

1 Like

[root@haproxy_restored ~]# haproxy -vv
HA-Proxy version 1.5.18 2016/05/10
Copyright 2000-2016 Willy Tarreau willy@haproxy.org

Build options :
TARGET = linux2628
CPU = generic
CC = gcc
CFLAGS = -O2 -g -fno-strict-aliasing -DTCP_USER_TIMEOUT=18
OPTIONS = USE_LINUX_TPROXY=1 USE_GETADDRINFO=1 USE_ZLIB=1 USE_REGPARM=1 USE_OPENSSL=1 USE_PCRE=1

Default settings :
maxconn = 2000, bufsize = 16384, maxrewrite = 8192, maxpollevents = 200

Encrypted password support via crypt(3): yes
Built with zlib version : 1.2.7
Compression algorithms supported : identity, deflate, gzip
Built with OpenSSL version : OpenSSL 1.0.2k-fips 26 Jan 2017
Running on OpenSSL version : OpenSSL 1.0.2k-fips 26 Jan 2017
OpenSSL library supports TLS extensions : yes
OpenSSL library supports SNI : yes
OpenSSL library supports prefer-server-ciphers : yes
Built with PCRE version : 8.32 2012-11-30
PCRE library supports JIT : no (USE_PCRE_JIT not set)
Built with transparent proxy support using: IP_TRANSPARENT IPV6_TRANSPARENT IP_FREEBIND

Available polling systems :
epoll : pref=300, test result OK
poll : pref=200, test result OK
select : pref=150, test result OK
Total: 3 (3 usable), will use epoll.

[root@haproxy_restored ~]# cat /usr/lib/systemd/system/haproxy.service
[Unit]
Description=HAProxy Load Balancer
After=syslog.target network.target

[Service]
EnvironmentFile=/etc/sysconfig/haproxy
ExecStart=/usr/sbin/haproxy-systemd-wrapper -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid $OPTIONS
ExecReload=/bin/kill -USR2 $MAINPID
KillMode=mixed

[Install]
WantedBy=multi-user.target
[root@haproxy_restored ~]#

[root@haproxy_restored ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.8 (Maipo)
[root@haproxy_restored ~]#

You probably cannot bind to those IP:port combination, either because the IP does not exist or because there already is another application bound to those ports.

Did you check that?

Thanks. It is already bound to another application.