From 1879b9c76ad2a075e90da7fe812fd434ad8d4cee Mon Sep 17 00:00:00 2001 From: Christopher Winslett Date: Mon, 4 May 2015 13:39:30 -0700 Subject: [PATCH] fix state queries against secondaries --- haproxy_status.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/haproxy_status.sh b/haproxy_status.sh index 1ddf5899..8024f59e 100755 --- a/haproxy_status.sh +++ b/haproxy_status.sh @@ -7,10 +7,10 @@ do { if [ "${response}" == " f" ] then echo "HTTP/1.1 200 OK" - echo "X-XLOG-POSITION: $(echo "SELECT pg_current_xlog_location();" | psql -t postgres 2> /dev/null | tr -d ' ' | head -n 1)" + echo "X-XLOG-POSITION: $(echo "SELECT pg_current_xlog_location();" | psql -t postgres --port $2 --host $1 2> /dev/null | tr -d ' ' | head -n 1)" else echo "HTTP/1.1 503 Service unavailable" - echo "X-XLOG-POSITION: $(echo "SELECT pg_last_xlog_replay_location();" | psql -t postgres 2> /dev/null | tr -d ' ' | head -n 1)" + echo "X-XLOG-POSITION: $(echo "SELECT pg_last_xlog_replay_location();" | psql -t postgres --port $2 --host $1 2> /dev/null | tr -d ' ' | head -n 1)" fi } | nc -l $3; done