mirror of
https://github.com/outbackdingo/patroni.git
synced 2026-08-25 14:53:37 +00:00
Made healtcheck port configurable, fixed standalone status page.
This commit is contained in:
+1
-1
@@ -80,7 +80,7 @@ def main():
|
||||
governor = Governor(config)
|
||||
|
||||
# Start the http_server to serve a simple healthcheck
|
||||
http_server = getHTTPServer(governor.postgresql, http_port=8008, listen_address='0.0.0.0')
|
||||
http_server = getHTTPServer(governor.postgresql, http_port=config.get('healtcheck_port', 8080), listen_address='0.0.0.0')
|
||||
http_thread = threading.Thread(target=http_server.serve_forever, args=())
|
||||
http_thread.daemon = True
|
||||
|
||||
|
||||
@@ -44,8 +44,8 @@ class StatusPage(BaseHTTPRequestHandler):
|
||||
to_char(pg_postmaster_start_time(), 'YYYY-MM-DD HH24:MI:SS.MS TZ')
|
||||
""")
|
||||
res = cursor.fetchone()
|
||||
status = {'role': ('master' if not res[0] else 'slave'), 'recovery': {'last_transaction_timestamp': res[1],
|
||||
'delay': res[2]}, 'server': {'hostaddr': res[3], 'port': res[4], 'start_time': res[5]}}
|
||||
status = {'role': ('master' if not res[0] else 'slave'), 'recovery': {'last_transaction_timestamp': res[1]},
|
||||
'server': {'hostaddr': res[3], 'port': res[4], 'start_time': res[5]}}
|
||||
|
||||
self.send_header('Content-Type', 'application/json')
|
||||
|
||||
@@ -71,8 +71,10 @@ if __name__ == '__main__':
|
||||
postgres_config = {
|
||||
'name': 'dummy',
|
||||
'listen': 'localhost:5432',
|
||||
'data_dir': None,
|
||||
'data_dir': 'nonsense',
|
||||
'replication': {'username': None, 'password': None},
|
||||
'superuser': None,
|
||||
'admin': None,
|
||||
}
|
||||
aws_host_address = None
|
||||
if len(sys.argv) > 1:
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
loop_wait: 10
|
||||
aws_use_host_address: "on"
|
||||
healthcheck_port: 8080
|
||||
etcd:
|
||||
scope: batman
|
||||
ttl: 30
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
loop_wait: 10
|
||||
aws_use_host_address: "on"
|
||||
healthcheck_port: 8081
|
||||
etcd:
|
||||
scope: batman
|
||||
ttl: 30
|
||||
|
||||
Reference in New Issue
Block a user