I'm trying to setup haproxy for the first time, and it has been giving me a lot of trouble. Right now, when I call the haproxy file in the /etc/init.d folder to start it up, I get the following:
$ ./haproxy start
Starting haproxy: [FAILED]
I've confirmed that chef installed haproxy:
$ haproxy -v
HA-Proxy version 1.5.18 2016/05/10
Copyright 2000-2016 Willy Tarreau <willy@haproxy.org>
To investigating further, I used the following commands:
$ haproxy -c -f /etc/haproxy/haproxy.cfg
[WARNING] 023/190620 (24869) : parsing [/etc/haproxy/haproxy.cfg:19] : 'option httplog' not usable with frontend 'https' (needs 'mode http'). Falling back to 'option tcplog'.
Configuration file is valid
$ ha proxy -db -f /etc/haproxy/haproxy.cfg
[WARNING] 023/190810 (25554) : parsing [/etc/haproxy/haproxy.cfg:19] : 'option httplog' not usable with frontend 'https' (needs 'mode http'). Falling back to 'option tcplog'.
[WARNING] 023/190810 (25554) : Server servers-http/test001.company.org is DOWN, reason: Layer4 connection problem, info: "Connection refused", check duration: 0ms. 0 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
[ALERT] 023/190810 (25554) : backend 'servers-http' has no server available!
[WARNING] 023/190811 (25554) : Server servers-https/test001.company.org is DOWN, reason: Layer4 connection problem, info: "Connection refused", check duration: 0ms. 0 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
[ALERT] 023/190811 (25554) : backend 'servers-https' has no server available!
I'm not sure how server cannot be available, as the that server is the same server haproxy is deployed to; its the localhost, I'm just have the actual server name in the config file. That file is as follows:
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
#log loghost local0 info
maxconn 4096
#debug
#quiet
user root
group root
defaults
log global
mode http
retries 3
timeout client 50s
timeout connect 5s
timeout server 50s
option dontlognull
option httplog
option redispatch
balance roundrobin
# Set up application listeners here.
listen admin
bind 127.0.0.1:22002
mode http
stats uri /
frontend http
maxconn 2000
bind 0.0.0.0:4000
default_backend servers-http
frontend https
mode tcp
maxconn 2000
bind 0.0.0.0:4001
default_backend servers-https
backend servers-http
server test001.company.com <IP address here>:4002 weight 1 maxconn 100 check
backend servers-https
mode tcp
server test001.company.com <IP address here>:4003 weight 1 maxconn 100 check
option ssl-hello-chk
I've also used netstat -nlp
to make sure each port does not have anything running on it. I'm not sure what else I can check.
EDIT:
I opened another terminal just to check and confirmed that HAProxy is starting up and running on ports 4000 and 4001. However, the backend ports cannot be used. I've also confirmed that nothing is using these ports, using netstat -nlp | grep 4002
and netstat -nlp | grep 4003
. I've also tried using 127.0.0.1 as the IP address instead of the actual IP address, but continue to get the same error.