{"id":19038359,"url":"https://github.com/fredex42/pgismaster","last_synced_at":"2026-04-29T14:01:48.473Z","repository":{"id":74520534,"uuid":"215079014","full_name":"fredex42/pgismaster","owner":"fredex42","description":"Indicate if a postgres server is a master or slave","archived":false,"fork":false,"pushed_at":"2019-11-16T12:15:00.000Z","size":5,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-30T07:48:16.117Z","etag":null,"topics":["failover","high-availability","keepalived","postgres","postgresql"],"latest_commit_sha":null,"homepage":"","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/fredex42.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-10-14T15:28:06.000Z","updated_at":"2024-10-03T02:28:39.000Z","dependencies_parsed_at":"2023-02-26T04:17:57.491Z","dependency_job_id":null,"html_url":"https://github.com/fredex42/pgismaster","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fredex42/pgismaster","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fredex42%2Fpgismaster","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fredex42%2Fpgismaster/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fredex42%2Fpgismaster/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fredex42%2Fpgismaster/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fredex42","download_url":"https://codeload.github.com/fredex42/pgismaster/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fredex42%2Fpgismaster/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32428622,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T13:34:34.882Z","status":"ssl_error","status_checked_at":"2026-04-29T13:34:29.830Z","response_time":110,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["failover","high-availability","keepalived","postgres","postgresql"],"created_at":"2024-11-08T22:02:50.421Z","updated_at":"2026-04-29T14:01:48.425Z","avatar_url":"https://github.com/fredex42.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pgismaster\n\n## What is it?\n\npgismaster is a very simple little program designed to indicate to a process like keepalived whether\na given postgres server is a master or a standby.\n\nThis is done by checking the internal flag \"pg_is_in_recovery();\"; an active slave is permanently in a recovery\nstate and a master is not.\n\n- If run on a slave, then a message is printed to indicate that it is a slave and an exit status of 1 is returned.\n- If run on a master, then a message is printed to indicate that it is a master and an exit status of 0 is returned.\n\nThis allows it to be run in the \"script\" parameter of keepalived to allow only a master to assert a VIP.\n\n## How do I run it?\n\nSimply grab the compiled executable and copy it to your server.  Then, call it in your script or config file.\n\nFor example, in `keepalived.conf`:\n\n```\nglobal_defs {\n\tenable_script_security\n\tscript_user postgres    ###server is configured to allow local access here\n}\n\nvrrp_script chk_postgres {               # Requires keepalived-1.1.13\n        script \"/usr/local/bin/pgismaster\"\n        interval 10                      # check every 10 seconds\n        fall 2       # require 2 failures for KO\n        rise 2       # require 2 successes for OK\n}\n\nvrrp_instance VI_1 {\n        interface ens192\n        virtual_router_id 42\n        priority 150\n        state MASTER\n        virtual_ipaddress {\n            1.2.3.4\n        }\n        track_script {\n            chk_postgres\n        }\n}\n```\n\nOr just run from the commandline:\n```\n$ /usr/local/bin/pgismaster\n2019/10/14 16:45:31 pgismaster, Andy Gallagher 2019. See https://github.com/fredex42/pgismaster for details.\n2019/10/14 16:45:31 Server is a standby\n$ echo $?\n1\n```\n\n## How do I compile it?\n\nYou'll need Go 1.11 or later available to compile (but not to run).\nYou can either head over to https://golang.org/doc/install#install or use docker (e.g. `docker run --rm golang:1.12-alpine3.9`)\n\nCheck out the sources: `git clone https://github.com/fredex42/pgismaster`\n\nCompile it for Linux: `GOOS=linux go build`\n\nOr for Windows: `GOOS=windows go build`\n\nOr for Mac: `GOOS=darwin go build`\n\netc.\n\nDependencies are managed via go modules, so any required libraries should be automatically downloaded and compiled in the `build` command.\n\nSee the official Go documentation for cross-compilation options.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffredex42%2Fpgismaster","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffredex42%2Fpgismaster","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffredex42%2Fpgismaster/lists"}