Name: pg-replication-tester
Owner: Stark & Wayne
Description: Testing Postgres Replication Health
Created: 2016-03-23 21:32:24.0
Updated: 2016-10-20 17:14:09.0
Pushed: 2016-03-31 02:09:18.0
Homepage: null
Size: 17
Language: Go
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
This repository houses pgrt
, a small utility that will connect
to all of the nodes in a PostgreSQL streaming replication cluster
and verify the health and well-being of each node.
A healthy cluster, with some leeway on the replication lag (`-l)
rt -M 10.244.232.2 -S 10.244.232.3 -S 10.244.232.4 -l 31768
44.232.2: 0/B30BA98
44.232.3: 0/B30BA98 (0) to 0/B30BC28 (-400)
44.232.4: 0/B30BDC0 (-808) to 0/B30BDC0 (0)
The same cluster, reporting as unhealthy because we only tolerate 800 bytes of replication lag (admittedly, fairly unrealistic):
rt -M 10.244.232.2 -S 10.244.232.3 -S 10.244.232.4 -l 800
44.232.2: 0/B17F098
44.232.3: 0/B17F230 (-408) to 0/B17F230 (0)
44.232.4: 0/B17F558 (-1216) to 0/B17F6E8 (-400) !! too far behind write master
ED
pgrt
exits 0 if it can contact all nodes, each node is playing
the part specified (i.e. write master is a write master, and read
slaves are actually read slaves), and the replication lag (first
parenthetical figure) is below the acceptable lag (per -l
)
It exists non-zero on failure, with the following meanings:
Check your flags.
terribly broken...)
behind the master (based on `-l`)
--master Replication master host. May only be specified once
--slave Replication slave host(s). May be specified more than once
--port TCP port that Postgres listens on (default: 6432)
--user User to connect as
--password Password to connect with
--debug Enable debugging output (to standard error)
--lag Maximum acceptable lag behind the master xlog position (bytes) (default: 8192)