{"id":76887,"date":"2019-05-06T08:30:24","date_gmt":"2019-05-06T15:30:24","guid":{"rendered":""},"modified":"2025-06-27T08:08:57","modified_gmt":"2025-06-27T15:08:57","slug":"introducing-pg_auto_failover-postgresql-open-source-extension-automated-failover-high-availability","status":"publish","type":"post","link":"https:\/\/opensource.microsoft.com\/blog\/2019\/05\/06\/introducing-pg_auto_failover-postgresql-open-source-extension-automated-failover-high-availability\/","title":{"rendered":"Introducing pg_auto_failover: Open source extension for automated failover and high-availability in PostgreSQL"},"content":{"rendered":"\n<p>When you\u2019re building a new app, there is a lot you need to focus on. Behind the scenes, there is data stored somewhere, often in a Postgres database. Data is essential, and it needs to be accessible and available. Most of us don\u2019t want to become a database expert early on, and instead focus on what gets customers to engage with the product.<\/p>\n\n\n\n<p>At Microsoft we care about enhancing developers\u2019 day-to-day productivity. Earlier this year we released our&nbsp;<a href=\"https:\/\/azure.microsoft.com\/en-us\/blog\/azure-data-studio-an-open-source-gui-editor-for-postgres\/\">support for PostgreSQL in Azure Data Studio<\/a>&nbsp;to provide a modern open source GUI for working with Postgres.<\/p>\n\n\n\n<p>Today, we are excited to introduce&nbsp;<a href=\"https:\/\/github.com\/citusdata\/pg_auto_failover\">pg_auto_failover<\/a>, an extension for automated failover in Postgres. It takes care of keeping your Postgres database available, so you don\u2019t have to.<\/p>\n\n\n\n<p>pg_auto_failover is focused on simple, automated failover built on&nbsp;<a href=\"https:\/\/www.postgresql.org\/docs\/11\/warm-standby.html\">Postgres streaming replication<\/a>, without any external third-party dependencies. Here is how it works:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/opensource.microsoft.com\/blog\/wp-content\/uploads\/2019\/05\/image-1-1024x381.png\" alt=\"Diagram of how pg-auto-failover works\" \/><\/figure>\n\n\n\n<p>As you can see we have three major components: the&nbsp;<strong>primary<\/strong>, the&nbsp;<strong>secondary<\/strong>&nbsp;and the&nbsp;<strong>monitor<\/strong>. Each of the components runs a Postgres server, as well as a&nbsp;<strong>keeper<\/strong>&nbsp;process for orchestration. The application runs SQL queries directly against the primary, with the secondary specified as a fallback connection in the client.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"let-s-try-it-out\">Let\u2019s try it out<\/h3>\n\n\n\n<p>To keep it simple, we\u2019ll install all three components on the same Linux VM. We\u2019ll setup the primary and secondary Postgres servers and use pg_auto_failover to replicate data between them. We\u2019ll simulate failure in the primary and see how the system switches (fails over) to the secondary.<\/p>\n\n\n\n<p>This release is focused on Linux, and we provide packages for both RPM and Debian based distributions. We support Postgres 10 and Postgres 11. In this example, we install the pg_auto_failover package for Postgres 11 on an RPM-based Linux distribution:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# Enable the package repository that distributes pg_auto_failover\ncurl https:\/\/install.citusdata.com\/community\/rpm.sh | sudo bash\n\n# Install the pg_auto_failover version 1.0 for Postgres 11\nsudo yum install -y pg-auto-failover10_11\n<\/pre><\/div>\n\n\n<p>Let\u2019s start by setting up the<strong>&nbsp;monitor.&nbsp;<\/strong>It is the first component to run. It periodically attempts to contact the other nodes and watches their health. It also maintains global state that&nbsp;<strong>keepers<\/strong>&nbsp;on each node consult to determine their own roles in the system.<\/p>\n\n\n\n<p>We use the \u201cpg_autoctl\u201d command to control pg_auto_failover:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nsudo su - postgres\nexport PATH=\"$PATH:\/usr\/pgsql-11\/bin\"\n\npg_autoctl create monitor   \\\n  --pgdata .\/monitor     \\\n  --pgport 6000          \\\n  --nodename `hostname --fqdn`\n<\/pre><\/div>\n\n\n<p>Next, we\u2019ll create the primary database. But, to simulate what happens if a node runs out of disk space, we\u2019ll store the primary node\u2019s data files in a small temporary filesystem.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# Create intentionally small disk for node A\nsudo mkdir \/mnt\/node_a\nsudo mount -t tmpfs -o size=400m tmpfs \/mnt\/node_a\nsudo mkdir \/mnt\/node_a\/data\nsudo chown postgres -R \/mnt\/node_a\n\n# Initialize Postgres on that disk\npg_autoctl create postgres     \\\n  --pgdata \/mnt\/node_a\/data \\\n  --pgport 6010             \\\n  --nodename 127.0.0.1      \\\n  --pgctl `which pg_ctl` \\\n  --monitor postgres:\/\/autoctl_node@127.0.0.1:6000\/pg_auto_failover\n<\/pre><\/div>\n\n\n<p>In the example above, the keeper creates a primary database. It chooses to set up node A as primary because the monitor reports there is no primary registered yet. This is one example of how the keeper is state based: it makes observations and then adjusts its state, in this case from \u201cinit\u201d to \u201csingle.\u201d<\/p>\n\n\n\n<p>At this point the monitor and primary nodes are running. Now we need to run the keeper. It\u2019s an independent process so that it can continue operating even if the Postgres primary goes down:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\npg_autoctl run --pgdata \/mnt\/node_a\/data\n<\/pre><\/div>\n\n\n<p>This will remain running in the terminal, outputting logs. We can open another terminal and start a secondary database the same way we created the primary:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\npg_autoctl create postgres \\\n  --pgdata .\/node_b      \\\n  --pgport 6011          \\\n  --nodename 127.0.0.1   \\\n  --pgctl `which pg_ctl` \\\n  --monitor postgres:\/\/autoctl_node@127.0.0.1:6000\/pg_auto_failover\npg_autoctl run --pgdata .\/node_b\n<\/pre><\/div>\n\n\n<p>All that differs here is that we\u2019re running it on another port and pointing at another data directory. It discovers from the monitor that a primary exists and then starts utilizing streaming replication to catch up.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"watch-the-replication\">Watch the replication<\/h3>\n\n\n\n<p>First, let\u2019s verify that the monitor knows about our nodes, and see what states it has assigned them:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\npg_autoctl show state --pgdata .\/monitor\n\n     Name |   Port | Group |  Node |   Current State |  Assigned State\n----------+--------+-------+-------+-----------------+----------------\n127.0.0.1 |   6010 |     0 |     1 |         primary |         primary\n127.0.0.1 |   6011 |     0 |     2 |       secondary |       secondary\n<\/pre><\/div>\n\n\n<p>This looks good. We can add data to the primary and watch it be reflected in the secondary.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# Add data to primary\npsql -p 6010 -c 'create table foo as select generate_series(1,1000000) bar;'\n\n# Query secondary\npsql -p 6011 -c 'select count(*) from foo;'\n\n  count\n---------\n 1000000\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\" id=\"cause-a-failover\">Cause a failover<\/h3>\n\n\n\n<p>Let\u2019s make it interesting and introduce a problem. We\u2019ll run the primary out of disk space and watch the secondary get promoted. In one terminal let\u2019s keep an eye on events:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nwatch pg_autoctl show events --pgdata .\/monitor\n<\/pre><\/div>\n\n\n<p>In another terminal we\u2019ll consume node A\u2019s disk space and try to restart the database. It will refuse to start up.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\npg_ctl -D \/mnt\/node_a\/data stop &&\n   dd if=\/dev\/zero of=\/mnt\/node_a\/bigfile bs=300MB count=1\n\n# Confirm there is no free disk space\ndf \/mnt\/node_a\nFilesystem     1K-blocks   Used Available Use% Mounted on\ntmpfs             409600 409600         0 100% \/mnt\/node_a\n<\/pre><\/div>\n\n\n<p>After a few failed attempts to restart node A, its keeper signals that the node is unhealthy and the node is put into the \u201cdemoted\u201d state. The monitor promotes node B to be the new primary.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\npg_autoctl show state --pgdata .\/monitor\n\n     Name |   Port | Group |  Node |   Current State |  Assigned State\n----------+--------+-------+-------+-----------------+----------------\n127.0.0.1 |   6010 |     0 |     1 |         demoted |      catchingup\n127.0.0.1 |   6011 |     0 |     2 |    wait_primary |    wait_primary\n<\/pre><\/div>\n\n\n<p>Node B is not considered in full \u201cprimary\u201d state since there is no secondary present. It is marked as \u201cwait_primary\u201d until a secondary appears.<\/p>\n\n\n\n<p>Let\u2019s say we want to connect to this cluster. We could use a proxy, but that is complex to setup. What if we could get a client to do this?<\/p>\n\n\n\n<p><a href=\"https:\/\/paquier.xyz\/postgresql-2\/postgres-10-libpq-read-write\/\">Starting with Postgres 10<\/a>, clients like psql, and application frameworks based on libpq, can attempt connections to more than one database server. This works by listing all known servers and adding the \u201ctarget_session_attrs\u201d parameter. pg_autoctl provides a helper to get us the correct connection URL:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\npg_autoctl show uri --formation default --pgdata .\/monitor\n\npsql 'postgres:\/\/127.0.0.1:6010,127.0.0.1:6011\/?target_session_attrs=read-write'\n<\/pre><\/div>\n\n\n<p>When nodes A and B were both running, psql connected to node A because B was read-only. Now that A is offline and B is writeable, it will connect to B. If we free the disk space on node A, it will become available again as a secondary.<\/p>\n\n\n\n<p>That\u2019s it! You now have a simple Postgres setup that stays available automatically.<\/p>\n\n\n\n<p>You can start using pg_auto_failover today. Microsoft is releasing the source code under the Postgres license. You can find the source and documentation on&nbsp;<a href=\"https:\/\/github.com\/citusdata\/pg_auto_failover\">GitHub<\/a>.<\/p>\n\n\n\n<p>If you are looking for a managed offering or would like to scale out using the Citus extension, we recommend&nbsp;<a href=\"https:\/\/azure.microsoft.com\/en-us\/services\/postgresql\/\">Azure Database for PostgreSQL<\/a>. We take care of high-availability, disaster recovery and more on your behalf.<\/p>\n\n\n\n<p>Questions or feedback? Please let us know in the comments below.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When you\u2019re building a new app, there is a lot you need to focus on. Behind the scenes, there is data stored somewhere, often in a Postgres database. Data is essential, and it needs to be accessible and available.<\/p>\n","protected":false},"author":5562,"featured_media":76896,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"msxcm_post_with_no_image":false,"ep_exclude_from_search":false,"_classifai_error":"","_classifai_text_to_speech_error":"","footnotes":""},"post_tag":[2272,166],"content-type":[346],"topic":[2241,2243],"programming-languages":[2263],"coauthors":[588],"class_list":["post-76887","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","tag-microsoft","tag-azure","content-type-news","topic-cloud","topic-databases","programming-languages-postgresql","review-flag-1593580428-734","review-flag-1593580415-931","review-flag-1593580419-521","review-flag-1593580771-946","review-flag-1-1593580432-963","review-flag-2-1593580437-411","review-flag-free-1593619513-693","review-flag-new-1593580248-669","review-flag-vm-1593580807-312"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Introducing pg_auto_failover: Open source extension for automated failover and high-availability in PostgreSQL<\/title>\n<meta name=\"description\" content=\"You can start using pg_auto_failover today! Microsoft is releasing the source code under the Postgres license and you can find the source and documentation on GitHub.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/opensource.microsoft.com\/blog\/2019\/05\/06\/introducing-pg_auto_failover-postgresql-open-source-extension-automated-failover-high-availability\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Introducing pg_auto_failover: Open source extension for automated failover and high-availability in PostgreSQL\" \/>\n<meta property=\"og:description\" content=\"You can start using pg_auto_failover today! Microsoft is releasing the source code under the Postgres license and you can find the source and documentation on GitHub.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/opensource.microsoft.com\/blog\/2019\/05\/06\/introducing-pg_auto_failover-postgresql-open-source-extension-automated-failover-high-availability\/\" \/>\n<meta property=\"og:site_name\" content=\"Microsoft Open Source Blog\" \/>\n<meta property=\"article:published_time\" content=\"2019-05-06T15:30:24+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-27T15:08:57+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/opensource.microsoft.com\/blog\/wp-content\/uploads\/2019\/05\/image-1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1431\" \/>\n\t<meta property=\"og:image:height\" content=\"533\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Lukas Fittl\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@OpenAtMicrosoft\" \/>\n<meta name=\"twitter:site\" content=\"@OpenAtMicrosoft\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Lukas Fittl\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 min read\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/opensource.microsoft.com\/blog\/2019\/05\/06\/introducing-pg_auto_failover-postgresql-open-source-extension-automated-failover-high-availability\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/opensource.microsoft.com\/blog\/2019\/05\/06\/introducing-pg_auto_failover-postgresql-open-source-extension-automated-failover-high-availability\/\"},\"author\":[{\"@id\":\"https:\/\/opensource.microsoft.com\/blog\/author\/lukas-fittl\/\",\"@type\":\"Person\",\"@name\":\"Lukas Fittl\"}],\"headline\":\"Introducing pg_auto_failover: Open source extension for automated failover and high-availability in PostgreSQL\",\"datePublished\":\"2019-05-06T15:30:24+00:00\",\"dateModified\":\"2025-06-27T15:08:57+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/opensource.microsoft.com\/blog\/2019\/05\/06\/introducing-pg_auto_failover-postgresql-open-source-extension-automated-failover-high-availability\/\"},\"wordCount\":950,\"commentCount\":11,\"publisher\":{\"@id\":\"https:\/\/opensource.microsoft.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/opensource.microsoft.com\/blog\/2019\/05\/06\/introducing-pg_auto_failover-postgresql-open-source-extension-automated-failover-high-availability\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/opensource.microsoft.com\/blog\/wp-content\/uploads\/2019\/05\/image-1.png\",\"keywords\":[\"Microsoft\",\"Microsoft Azure\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/opensource.microsoft.com\/blog\/2019\/05\/06\/introducing-pg_auto_failover-postgresql-open-source-extension-automated-failover-high-availability\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/opensource.microsoft.com\/blog\/2019\/05\/06\/introducing-pg_auto_failover-postgresql-open-source-extension-automated-failover-high-availability\/\",\"url\":\"https:\/\/opensource.microsoft.com\/blog\/2019\/05\/06\/introducing-pg_auto_failover-postgresql-open-source-extension-automated-failover-high-availability\/\",\"name\":\"Introducing pg_auto_failover: Open source extension for automated failover and high-availability in PostgreSQL\",\"isPartOf\":{\"@id\":\"https:\/\/opensource.microsoft.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/opensource.microsoft.com\/blog\/2019\/05\/06\/introducing-pg_auto_failover-postgresql-open-source-extension-automated-failover-high-availability\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/opensource.microsoft.com\/blog\/2019\/05\/06\/introducing-pg_auto_failover-postgresql-open-source-extension-automated-failover-high-availability\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/opensource.microsoft.com\/blog\/wp-content\/uploads\/2019\/05\/image-1.png\",\"datePublished\":\"2019-05-06T15:30:24+00:00\",\"dateModified\":\"2025-06-27T15:08:57+00:00\",\"description\":\"You can start using pg_auto_failover today! Microsoft is releasing the source code under the Postgres license and you can find the source and documentation on GitHub.\",\"breadcrumb\":{\"@id\":\"https:\/\/opensource.microsoft.com\/blog\/2019\/05\/06\/introducing-pg_auto_failover-postgresql-open-source-extension-automated-failover-high-availability\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/opensource.microsoft.com\/blog\/2019\/05\/06\/introducing-pg_auto_failover-postgresql-open-source-extension-automated-failover-high-availability\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/opensource.microsoft.com\/blog\/2019\/05\/06\/introducing-pg_auto_failover-postgresql-open-source-extension-automated-failover-high-availability\/#primaryimage\",\"url\":\"https:\/\/opensource.microsoft.com\/blog\/wp-content\/uploads\/2019\/05\/image-1.png\",\"contentUrl\":\"https:\/\/opensource.microsoft.com\/blog\/wp-content\/uploads\/2019\/05\/image-1.png\",\"width\":1431,\"height\":533,\"caption\":\"Diagram of how pg-auto-failover works\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/opensource.microsoft.com\/blog\/2019\/05\/06\/introducing-pg_auto_failover-postgresql-open-source-extension-automated-failover-high-availability\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/opensource.microsoft.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Introducing pg_auto_failover: Open source extension for automated failover and high-availability in PostgreSQL\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/opensource.microsoft.com\/blog\/#website\",\"url\":\"https:\/\/opensource.microsoft.com\/blog\/\",\"name\":\"Microsoft Open Source Blog\",\"description\":\"Open dialogue about openness at Microsoft \u2013 open source, standards, interoperability\",\"publisher\":{\"@id\":\"https:\/\/opensource.microsoft.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/opensource.microsoft.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/opensource.microsoft.com\/blog\/#organization\",\"name\":\"Microsoft Open Source Blog\",\"url\":\"https:\/\/opensource.microsoft.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/opensource.microsoft.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/opensource.microsoft.com\/blog\/wp-content\/uploads\/2019\/08\/Microsoft-Logo.png\",\"contentUrl\":\"https:\/\/opensource.microsoft.com\/blog\/wp-content\/uploads\/2019\/08\/Microsoft-Logo.png\",\"width\":259,\"height\":194,\"caption\":\"Microsoft Open Source Blog\"},\"image\":{\"@id\":\"https:\/\/opensource.microsoft.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/OpenAtMicrosoft\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Introducing pg_auto_failover: Open source extension for automated failover and high-availability in PostgreSQL","description":"You can start using pg_auto_failover today! Microsoft is releasing the source code under the Postgres license and you can find the source and documentation on GitHub.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/opensource.microsoft.com\/blog\/2019\/05\/06\/introducing-pg_auto_failover-postgresql-open-source-extension-automated-failover-high-availability\/","og_locale":"en_US","og_type":"article","og_title":"Introducing pg_auto_failover: Open source extension for automated failover and high-availability in PostgreSQL","og_description":"You can start using pg_auto_failover today! Microsoft is releasing the source code under the Postgres license and you can find the source and documentation on GitHub.","og_url":"https:\/\/opensource.microsoft.com\/blog\/2019\/05\/06\/introducing-pg_auto_failover-postgresql-open-source-extension-automated-failover-high-availability\/","og_site_name":"Microsoft Open Source Blog","article_published_time":"2019-05-06T15:30:24+00:00","article_modified_time":"2025-06-27T15:08:57+00:00","og_image":[{"width":1431,"height":533,"url":"https:\/\/opensource.microsoft.com\/blog\/wp-content\/uploads\/2019\/05\/image-1.png","type":"image\/png"}],"author":"Lukas Fittl","twitter_card":"summary_large_image","twitter_creator":"@OpenAtMicrosoft","twitter_site":"@OpenAtMicrosoft","twitter_misc":{"Written by":"Lukas Fittl","Est. reading time":"5 min read"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/opensource.microsoft.com\/blog\/2019\/05\/06\/introducing-pg_auto_failover-postgresql-open-source-extension-automated-failover-high-availability\/#article","isPartOf":{"@id":"https:\/\/opensource.microsoft.com\/blog\/2019\/05\/06\/introducing-pg_auto_failover-postgresql-open-source-extension-automated-failover-high-availability\/"},"author":[{"@id":"https:\/\/opensource.microsoft.com\/blog\/author\/lukas-fittl\/","@type":"Person","@name":"Lukas Fittl"}],"headline":"Introducing pg_auto_failover: Open source extension for automated failover and high-availability in PostgreSQL","datePublished":"2019-05-06T15:30:24+00:00","dateModified":"2025-06-27T15:08:57+00:00","mainEntityOfPage":{"@id":"https:\/\/opensource.microsoft.com\/blog\/2019\/05\/06\/introducing-pg_auto_failover-postgresql-open-source-extension-automated-failover-high-availability\/"},"wordCount":950,"commentCount":11,"publisher":{"@id":"https:\/\/opensource.microsoft.com\/blog\/#organization"},"image":{"@id":"https:\/\/opensource.microsoft.com\/blog\/2019\/05\/06\/introducing-pg_auto_failover-postgresql-open-source-extension-automated-failover-high-availability\/#primaryimage"},"thumbnailUrl":"https:\/\/opensource.microsoft.com\/blog\/wp-content\/uploads\/2019\/05\/image-1.png","keywords":["Microsoft","Microsoft Azure"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/opensource.microsoft.com\/blog\/2019\/05\/06\/introducing-pg_auto_failover-postgresql-open-source-extension-automated-failover-high-availability\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/opensource.microsoft.com\/blog\/2019\/05\/06\/introducing-pg_auto_failover-postgresql-open-source-extension-automated-failover-high-availability\/","url":"https:\/\/opensource.microsoft.com\/blog\/2019\/05\/06\/introducing-pg_auto_failover-postgresql-open-source-extension-automated-failover-high-availability\/","name":"Introducing pg_auto_failover: Open source extension for automated failover and high-availability in PostgreSQL","isPartOf":{"@id":"https:\/\/opensource.microsoft.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/opensource.microsoft.com\/blog\/2019\/05\/06\/introducing-pg_auto_failover-postgresql-open-source-extension-automated-failover-high-availability\/#primaryimage"},"image":{"@id":"https:\/\/opensource.microsoft.com\/blog\/2019\/05\/06\/introducing-pg_auto_failover-postgresql-open-source-extension-automated-failover-high-availability\/#primaryimage"},"thumbnailUrl":"https:\/\/opensource.microsoft.com\/blog\/wp-content\/uploads\/2019\/05\/image-1.png","datePublished":"2019-05-06T15:30:24+00:00","dateModified":"2025-06-27T15:08:57+00:00","description":"You can start using pg_auto_failover today! Microsoft is releasing the source code under the Postgres license and you can find the source and documentation on GitHub.","breadcrumb":{"@id":"https:\/\/opensource.microsoft.com\/blog\/2019\/05\/06\/introducing-pg_auto_failover-postgresql-open-source-extension-automated-failover-high-availability\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/opensource.microsoft.com\/blog\/2019\/05\/06\/introducing-pg_auto_failover-postgresql-open-source-extension-automated-failover-high-availability\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/opensource.microsoft.com\/blog\/2019\/05\/06\/introducing-pg_auto_failover-postgresql-open-source-extension-automated-failover-high-availability\/#primaryimage","url":"https:\/\/opensource.microsoft.com\/blog\/wp-content\/uploads\/2019\/05\/image-1.png","contentUrl":"https:\/\/opensource.microsoft.com\/blog\/wp-content\/uploads\/2019\/05\/image-1.png","width":1431,"height":533,"caption":"Diagram of how pg-auto-failover works"},{"@type":"BreadcrumbList","@id":"https:\/\/opensource.microsoft.com\/blog\/2019\/05\/06\/introducing-pg_auto_failover-postgresql-open-source-extension-automated-failover-high-availability\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/opensource.microsoft.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Introducing pg_auto_failover: Open source extension for automated failover and high-availability in PostgreSQL"}]},{"@type":"WebSite","@id":"https:\/\/opensource.microsoft.com\/blog\/#website","url":"https:\/\/opensource.microsoft.com\/blog\/","name":"Microsoft Open Source Blog","description":"Open dialogue about openness at Microsoft \u2013 open source, standards, interoperability","publisher":{"@id":"https:\/\/opensource.microsoft.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/opensource.microsoft.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/opensource.microsoft.com\/blog\/#organization","name":"Microsoft Open Source Blog","url":"https:\/\/opensource.microsoft.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/opensource.microsoft.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/opensource.microsoft.com\/blog\/wp-content\/uploads\/2019\/08\/Microsoft-Logo.png","contentUrl":"https:\/\/opensource.microsoft.com\/blog\/wp-content\/uploads\/2019\/08\/Microsoft-Logo.png","width":259,"height":194,"caption":"Microsoft Open Source Blog"},"image":{"@id":"https:\/\/opensource.microsoft.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/OpenAtMicrosoft"]}]}},"msxcm_display_generated_audio":false,"msxcm_animated_featured_image":null,"distributor_meta":false,"distributor_terms":false,"distributor_media":false,"distributor_original_site_name":"Microsoft Open Source Blog","distributor_original_site_url":"https:\/\/opensource.microsoft.com\/blog","push-errors":false,"_links":{"self":[{"href":"https:\/\/opensource.microsoft.com\/blog\/wp-json\/wp\/v2\/posts\/76887","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/opensource.microsoft.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/opensource.microsoft.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/opensource.microsoft.com\/blog\/wp-json\/wp\/v2\/users\/5562"}],"replies":[{"embeddable":true,"href":"https:\/\/opensource.microsoft.com\/blog\/wp-json\/wp\/v2\/comments?post=76887"}],"version-history":[{"count":2,"href":"https:\/\/opensource.microsoft.com\/blog\/wp-json\/wp\/v2\/posts\/76887\/revisions"}],"predecessor-version":[{"id":97765,"href":"https:\/\/opensource.microsoft.com\/blog\/wp-json\/wp\/v2\/posts\/76887\/revisions\/97765"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/opensource.microsoft.com\/blog\/wp-json\/wp\/v2\/media\/76896"}],"wp:attachment":[{"href":"https:\/\/opensource.microsoft.com\/blog\/wp-json\/wp\/v2\/media?parent=76887"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/opensource.microsoft.com\/blog\/wp-json\/wp\/v2\/post_tag?post=76887"},{"taxonomy":"content-type","embeddable":true,"href":"https:\/\/opensource.microsoft.com\/blog\/wp-json\/wp\/v2\/content-type?post=76887"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/opensource.microsoft.com\/blog\/wp-json\/wp\/v2\/topic?post=76887"},{"taxonomy":"programming-languages","embeddable":true,"href":"https:\/\/opensource.microsoft.com\/blog\/wp-json\/wp\/v2\/programming-languages?post=76887"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/opensource.microsoft.com\/blog\/wp-json\/wp\/v2\/coauthors?post=76887"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}