I followed the instructions here https://kifarunix.com/install-and-setup-haproxy-on-ubuntu-20-04/ & have almost set up HTTPS. The function beam.smp
which is specific to couchdb was bound to 5984 & hence not allowing haproxy to start.
Error log from terminal:
Oct 04 08:11:58 AgentDost systemd[1]: haproxy.service: Scheduled restart job, restart counter is at 4.
Oct 04 08:11:58 AgentDost systemd[1]: Stopped HAProxy Load Balancer.
Oct 04 08:11:58 AgentDost systemd[1]: Starting HAProxy Load Balancer...
Oct 04 08:11:59 AgentDost haproxy[31476]: [ALERT] 276/081158 (31476) : Starting frontend couch.tezi.app: cannot bind socket [174.138.120.68:5984]
Oct 04 08:11:59 AgentDost haproxy[31476]: Proxy webapps started.
Oct 04 08:11:59 AgentDost haproxy[31476]: Proxy webapps started.
Oct 04 08:11:59 AgentDost haproxy[31476]: [ALERT] 276/081158 (31476) : Starting proxy stats: cannot bind socket [174.138.120.68:5984]
Oct 04 08:11:59 AgentDost systemd[1]: haproxy.service: Main process exited, code=exited, status=1/FAILURE
Oct 04 08:11:59 AgentDost systemd[1]: haproxy.service: Failed with result 'exit-code'.
Oct 04 08:11:59 AgentDost systemd[1]: Failed to start HAProxy Load Balancer.
So I stopped the service to be able to bind the haproxy service to the port. Now beam.smp
is not bound to the port but still haproxy is not able to takeover. What could be the reason here?
Oct 04 08:11:58 AgentDost systemd[1]: haproxy.service: Scheduled restart job, restart counter is at 4.
Oct 04 08:11:58 AgentDost systemd[1]: Stopped HAProxy Load Balancer.
Oct 04 08:11:58 AgentDost systemd[1]: Starting HAProxy Load Balancer...
Oct 04 08:11:59 AgentDost haproxy[31476]: [ALERT] 276/081158 (31476) : Starting frontend couch.tezi.app: cannot bind socket [174.138.120.68:5984]
Oct 04 08:11:59 AgentDost haproxy[31476]: Proxy webapps started.
Oct 04 08:11:59 AgentDost haproxy[31476]: Proxy webapps started.
Oct 04 08:11:59 AgentDost haproxy[31476]: [ALERT] 276/081158 (31476) : Starting proxy stats: cannot bind socket [174.138.120.68:5984]
Oct 04 08:11:59 AgentDost systemd[1]: haproxy.service: Main process exited, code=exited, status=1/FAILURE
Oct 04 08:11:59 AgentDost systemd[1]: haproxy.service: Failed with result 'exit-code'.
Oct 04 08:11:59 AgentDost systemd[1]: Failed to start HAProxy Load Balancer.
Oct 04 08:11:59 AgentDost systemd[1]: haproxy.service: Scheduled restart job, restart counter is at 5.
Oct 04 08:11:59 AgentDost systemd[1]: Stopped HAProxy Load Balancer.
Oct 04 08:11:59 AgentDost systemd[1]: haproxy.service: Start request repeated too quickly.
Oct 04 08:11:59 AgentDost systemd[1]: haproxy.service: Failed with result 'exit-code'.
Oct 04 08:11:59 AgentDost systemd[1]: Failed to start HAProxy Load Balancer.
root@AgentDost:~# sudo ss -4 -tlnp | grep 80
LISTEN 0 511 0.0.0.0:80 0.0.0.0:* users:(("nginx",pid=751,fd=6),("nginx",pid=750,fd=6))
root@AgentDost:~# ss -4 -tlnp | grep 5984
I tried changing the frontend to port 6984 but even that doesn't help.
Error log from terminal:
Oct 04 08:21:26 AgentDost systemd[1]: haproxy.service: Scheduled restart job, restart counter is at 4.
Oct 04 08:21:26 AgentDost systemd[1]: Stopped HAProxy Load Balancer.
Oct 04 08:21:26 AgentDost systemd[1]: Starting HAProxy Load Balancer...
Oct 04 08:21:27 AgentDost haproxy[31747]: [ALERT] 276/082126 (31747) : Starting frontend couch.tezi.app: cannot bind socket [174.138.120.68:6984]
Oct 04 08:21:27 AgentDost haproxy[31747]: Proxy webapps started.
Oct 04 08:21:27 AgentDost haproxy[31747]: Proxy webapps started.
Oct 04 08:21:27 AgentDost haproxy[31747]: [ALERT] 276/082126 (31747) : Starting proxy stats: cannot bind socket [174.138.120.68:5984]
Oct 04 08:21:27 AgentDost systemd[1]: haproxy.service: Main process exited, code=exited, status=1/FAILURE
Oct 04 08:21:27 AgentDost systemd[1]: haproxy.service: Failed with result 'exit-code'.
Oct 04 08:21:27 AgentDost systemd[1]: Failed to start HAProxy Load Balancer.
Oct 04 08:21:27 AgentDost systemd[1]: haproxy.service: Scheduled restart job, restart counter is at 5.
Oct 04 08:21:27 AgentDost systemd[1]: Stopped HAProxy Load Balancer.
Oct 04 08:21:27 AgentDost systemd[1]: haproxy.service: Start request repeated too quickly.
Oct 04 08:21:27 AgentDost systemd[1]: haproxy.service: Failed with result 'exit-code'.
Oct 04 08:21:27 AgentDost systemd[1]: Failed to start HAProxy Load Balancer.
root@AgentDost:~# ss -4 -tlnp | grep 6984
root@AgentDost:~# ss -4 -tlnp | grep 5984
LISTEN 0 128 0.0.0.0:5984 0.0.0.0:* users:(("beam.smp",pid=31658,fd=16))
Copyright Notice:Content Author:「Krishna」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/69433131/haproxy-cannot-bind-socket-error-ubuntu-20-04