{"id":13513464,"url":"https://github.com/hapostgres/pg_auto_failover","last_synced_at":"2025-05-14T16:02:32.307Z","repository":{"id":37413225,"uuid":"184734634","full_name":"hapostgres/pg_auto_failover","owner":"hapostgres","description":"Postgres extension and service for automated failover and high-availability","archived":false,"fork":false,"pushed_at":"2025-04-11T11:33:45.000Z","size":7180,"stargazers_count":1201,"open_issues_count":100,"forks_count":122,"subscribers_count":55,"default_branch":"main","last_synced_at":"2025-05-07T21:43:32.949Z","etag":null,"topics":["auto-failover","high-availability","postgres","postgresql","postgresql-extension"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hapostgres.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"docs/security.rst","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-05-03T10:03:21.000Z","updated_at":"2025-05-07T03:16:18.000Z","dependencies_parsed_at":"2023-10-01T17:01:03.414Z","dependency_job_id":"c1d5f407-2e40-4cb9-8827-fe42d0cf231b","html_url":"https://github.com/hapostgres/pg_auto_failover","commit_stats":{"total_commits":566,"total_committers":42,"mean_commits":"13.476190476190476","dds":0.4028268551236749,"last_synced_commit":"2fda3e0a04d6cdd0436f7c4a283b051d2d6f07ce"},"previous_names":["citusdata/pg_auto_failover"],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hapostgres%2Fpg_auto_failover","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hapostgres%2Fpg_auto_failover/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hapostgres%2Fpg_auto_failover/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hapostgres%2Fpg_auto_failover/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hapostgres","download_url":"https://codeload.github.com/hapostgres/pg_auto_failover/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254179903,"owners_count":22027884,"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":["auto-failover","high-availability","postgres","postgresql","postgresql-extension"],"created_at":"2024-08-01T05:00:26.951Z","updated_at":"2025-05-14T16:02:32.255Z","avatar_url":"https://github.com/hapostgres.png","language":"C","funding_links":[],"categories":["C"],"sub_categories":[],"readme":"# pg_auto_failover\n\n[![Documentation Status](https://readthedocs.org/projects/pg-auto-failover/badge/?version=main)](https://pg-auto-failover.readthedocs.io/en/main/?badge=main)\n\npg_auto_failover is an extension and service for PostgreSQL that monitors\nand manages automated failover for a Postgres cluster. It is optimized for\nsimplicity and correctness and supports Postgres 13 to 17.\n\npg_auto_failover supports several Postgres architectures and implements a\nsafe automated failover for your Postgres service. It is possible to get\nstarted with only two data nodes which will be given the roles of primary\nand secondary by the monitor.\n\n![pg_auto_failover Architecture with 2 nodes](docs/tikz/arch-single-standby.svg?raw=true \"pg_auto_failover Architecture with 2 nodes\")\n\nThe pg_auto_failover Monitor implements a state machine and relies on\nin-core PostgreSQL facilities to deliver HA. For example, when the\n**secondary** node is detected to be unavailable, or when its lag is too\nmuch, then the Monitor removes it from the `synchronous_standby_names`\nsetting on the **primary** node. Until the **secondary** is back to being\nmonitored healthy, failover and switchover operations are not allowed,\npreventing data loss.\n\npg_auto_failover consists of the following parts:\n\n  - a PostgreSQL extension named `pgautofailover`\n  - a PostgreSQL service to operate the pg_auto_failover monitor\n  - a pg_auto_failover keeper to operate your PostgreSQL instances, see `pg_autoctl run`\n\n## Multiple Standbys\n\nIt is possible to implement a production architecture with any number of\nPostgres nodes, for better data availability guarantees.\n\n![pg_auto_failover Architecture with 3 nodes](docs/tikz/arch-multi-standby.svg?raw=true \"pg_auto_failover Architecture with 3 nodes\")\n\nBy default, pg_auto_failover uses synchronous replication and every node\nthat reaches the secondary state is added to synchronous_standby_names on\nthe primary. With pg_auto_failover 1.4 it is possible to remove a node from\nthe _replication quorum_ of Postgres.\n\n## Citus HA\n\nStarting with pg_auto_failover 2.0 it's now possible to also implement High\nAvailability for a Citus cluster.\n\n![pg_auto_failover Architecture with Citus](docs/tikz/arch-citus.svg?raw=true \"pg_auto_failover Architecture with Citus\")\n\n## Documentation\n\nPlease check out project\n[documentation](https://pg-auto-failover.readthedocs.io/en/main/) for\ntutorial, manual pages, detailed design coverage, and troubleshooting\ninformation.\n\n## Installing pg_auto_failover from packages\n\nNote that pg_auto_failover packages are also found in Postgres PGDG package\nrepositories. If you're using those repositories already, you can install\nthe packages from there.\n\n### Ubuntu or Debian:\n\nBinary packages for debian and derivatives (ubuntu) are available from\n[apt.postgresql.org](https://wiki.postgresql.org/wiki/Apt) repository,\ninstall by following the linked documentation and then::\n\n```bash\n$ sudo apt-get install pg-auto-failover-cli\n$ sudo apt-get install postgresql-17-auto-failover\n```\n\nWhen using debian, two packages are provided for pg_auto_failover: the\nmonitor Postgres extension is packaged separately and depends on the\nPostgres version you want to run for the monitor itself. The monitor's\nextension package is named `postgresql-17-auto-failover` when targeting\nPostgres 17.\n\nThen another package is prepared that contains the `pg_autoctl` command, and\nthe name of the package is `pg-auto-failover-cli`. That's the package that\nis needed for the Postgres nodes.\n\nTo avoid debian creating a default Postgres data directory and service,\nfollow these steps before installing the previous packages.\n\n```bash\n$ curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -\n$ echo \"deb http://apt.postgresql.org/pub/repos/apt bookworm-pgdg main\" \u003e /etc/apt/sources.list.d/pgdg.list\n\n# bypass initdb of a \"main\" cluster\n$ echo 'create_main_cluster = false' | sudo tee -a /etc/postgresql-common/createcluster.conf\n$ apt-get update\n$ apt-get install -y --no-install-recommends postgresql-17\n```\n\n### Other installation methods\n\nPlease see our extended documentation chapter [Installing\npg_auto_failover](https://pg-auto-failover.readthedocs.io/en/main/install.html)\nfor details.\n\n## Trying pg_auto_failover on your local computer\n\nThe main documentation for pg_auto_failover includes the following 3 tutorial:\n\n  - The main [pg_auto_failover\n    Tutorial](https://pg-auto-failover.readthedocs.io/en/main/tutorial.html)\n    uses docker compose on your local computer to start multiple Postgres\n    nodes and implement your first failover.\n\n  - The complete [pg_auto_failover Azure VM\n    Tutorial](https://pg-auto-failover.readthedocs.io/en/main/azure-tutorial.html)\n    guides you into creating an Azure network and then Azure VMs in that\n    network, to then provisioning those VMs, and then running Postgres nodes\n    with pg_auto_failover and then introducing hard failures and witnessing\n    an automated failover.\n\n  - The [Citus Cluster Quick\n    Start](https://pg-auto-failover.readthedocs.io/en/main/citus-quickstart.html)\n    tutorial uses docker compose to create a full Citus cluster and guide\n    you to a worker failover and then a coordinator failover.\n\n## Reporting Security Issues\n\nSecurity issues and bugs should be reported privately, via email, to the Microsoft Security\nResponse Center (MSRC) at [secure@microsoft.com](mailto:secure@microsoft.com). You should\nreceive a response within 24 hours. If for some reason you do not, please follow up via\nemail to ensure we received your original message. Further information, including the\n[MSRC PGP](https://technet.microsoft.com/en-us/security/dn606155) key, can be found in\nthe [Security TechCenter](https://technet.microsoft.com/en-us/security/default).\n\n## Authors\n\n* [Dimitri Fontaine](https://github.com/dimitri)\n* [Nils Dijk](https://github.com/thanodnl)\n* [Marco Slot](https://github.com/marcoslot)\n* [Louise Grandjonc](https://github.com/louiseGrandjonc)\n* [Joe Nelson](https://github.com/begriffs)\n* [Hadi Moshayedi](https://github.com/pykello)\n* [Lukas Fittl](https://github.com/lfittl)\n* [Murat Tuncer](https://github.com/mtuncer)\n* [Jelte Fennema](https://github.com/JelteF)\n\n## License\n\nCopyright (c) Microsoft Corporation. All rights reserved.\n\nThis project is licensed under the PostgreSQL License, see LICENSE file for details.\n\nThis project includes bundled third-party dependencies, see NOTICE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhapostgres%2Fpg_auto_failover","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhapostgres%2Fpg_auto_failover","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhapostgres%2Fpg_auto_failover/lists"}