Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to see if haproxy thinks a backend is down #6

Open
jjbuchan opened this issue May 14, 2021 · 0 comments
Open

How to see if haproxy thinks a backend is down #6

jjbuchan opened this issue May 14, 2021 · 0 comments

Comments

@jjbuchan
Copy link
Owner

Log into the desired server and pull the current haproxy stats:

echo "show stat" | sudo nc -U /etc/sv/haproxy/locks/haproxy.sock|awk "NR == 1 {print} /DOWN/ {print}"

They will have an "svname" of "127.0.0.n" where "n" is the service instance + 3. So "endpoint-6" is "127.0.0.9". If you see a down one, see if it is not properly listening on its 127.* address:

netstat -an|grep 127.0.0.$N|grep LISTEN

If it's not, that service instance likely needs to be restarted. NOTE it might take an sv force-stop to really stop it. Check that it is really gone in ps after attempted stop.

You also list all of the HAproxy services including the status column in a pretty format using:

echo "show stat" | \
  sudo nc -U /etc/sv/haproxy/locks/haproxy.sock| \
  cut -d, -f-18 | column -s, -nt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant