{"id":18802072,"url":"https://github.com/hilli/pg-replication-lag","last_synced_at":"2026-01-05T00:30:16.508Z","repository":{"id":64303869,"uuid":"150979580","full_name":"hilli/pg-replication-lag","owner":"hilli","description":"PostgreSQL replication lag - Tells you the time lag between a PostgreSQL master and slave.","archived":false,"fork":false,"pushed_at":"2018-09-30T20:52:13.000Z","size":8,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-12-29T20:15:35.516Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hilli.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-09-30T15:30:14.000Z","updated_at":"2018-09-30T20:49:32.000Z","dependencies_parsed_at":"2023-01-15T10:00:26.459Z","dependency_job_id":null,"html_url":"https://github.com/hilli/pg-replication-lag","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hilli%2Fpg-replication-lag","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hilli%2Fpg-replication-lag/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hilli%2Fpg-replication-lag/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hilli%2Fpg-replication-lag/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hilli","download_url":"https://codeload.github.com/hilli/pg-replication-lag/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239735263,"owners_count":19688262,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T22:26:20.897Z","updated_at":"2026-01-05T00:30:16.466Z","avatar_url":"https://github.com/hilli.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pg-replication-lag\n\nA command to let you get the _timed_ lag between a PostgreSQL master/slave replica set. PostgreSQL has queries to let you get the bytes difference between the master and the replica - This will let you get the amout of time there is between the masters writes and the replica has save the data to disk.\n\n## Installation\n\n```\ngo get github.com/hilli/pg-replication-lag\n```\n\nOr checkout the source and do a `build` (for your current platform) or optionally `make build-linux` (to get a Linux binary):\n\n```\ngit clone https://github.com/hilli/pg-replication-lag.git\nmake deps\nmake build\n```\n\n## Getting started\nCopy `pg-replication-lag.yaml.sample` to `pg-replication-lag.yaml`. \n\n```\ncurl https://raw.githubusercontent.com/hilli/pg-replication-lag/master/pg-replication-lag.yaml.sample \u003e pg-replication-lag.yaml\n```\n\nFill out `pg-replication-lag.yaml` with some sane values. The values should be self explanatory but it is probably worth noting that, since it is a replica, the username and password is the same. `max_lag_before_exit` is the time to maximal wait before exiting - If your replication is broken, we won't wait forever.\n\n Run `./pg-replication-lag` or use on of the flags as well:\n\n```\n$ ./pg-replication-lag --help\nUsage of ./pg-replication-lag:\n  -config string\n    \tPath to YAML config file (default \"./pg-replication-lag.yaml\")\n  -verbose\n    \tAdd verbosity to the output\n\nDocumentation at https://github.com/hilli/pg-replication-lag\n```\n\nIt will look in the _current_ directory for a config file. If thats not where you keep it, specify it with `-config` flag.\n\n### If all works out nicely\n\n```\n $ ./pg-replication-lag_linux_amd64\n{ \"postgresql-replication-lag\": { \"time\": \"23.346179ms\", \"bytes\": \"0\" } }\n```\n\n## Error cases\n### If replication fails\n\n```\n$ ./pg-replication-lag_linux_amd64\npg-replication-lag: 2018/09/30 16:10:01 BAILING, waited too long (1m0.089542009s, 26716448 bytes behind)\npanic: BAILING, waited too long (1m0.089542009s, 26716448 bytes behind)\n```\n\n### If DB connection fails\n\n```\n$ ./pg-replication-lag_linux_amd64\npg-replication-lag: 2018/09/30 16:23:16 Database error: dial tcp 127.0.0.1:5432: connect: connection refused\npanic: Database error: dial tcp 127.0.0.1:5432: connect: connection refused\n```\n\nexits with code 2 in all cases.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhilli%2Fpg-replication-lag","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhilli%2Fpg-replication-lag","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhilli%2Fpg-replication-lag/lists"}