{"id":20145,"date":"2022-10-27T18:30:00","date_gmt":"2022-10-27T16:30:00","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/?p=20145"},"modified":"2025-04-04T09:56:06","modified_gmt":"2025-04-04T07:56:06","slug":"bootstrap-patroni-cluster-from-pgbackrest-backup","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/bootstrap-patroni-cluster-from-pgbackrest-backup\/","title":{"rendered":"Bootstrap Patroni Cluster from pgBackRest Backup"},"content":{"rendered":"\n<p>While preparing myself for the pgconf.eu in Berlin this week I made a lot of research regarding Patroni and pgBackRest. I was aware that it&#8217;s possible to recreate a replica from a pgBackRest backup. But I was also wondering, what happens if the complete Patroni Cluster is gone. I know this is not the most common case, but never say never. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-starting-point\">Starting point<\/h2>\n\n\n\n<p>Let&#8217;s assume we have\/had a running Patroni Cluster on three nodes, using etcd as Key Value Store. Everything was working fine.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>postgres@hero3:\/home\/postgres\/ &#091;PG1] patronictl list\n+--------+----------------+---------+---------+----+-----------+\n| Member | Host | Role | State | TL | Lag in MB |\nCluster: PG1 (7157976722952275157) ---------+----+-----------+\n| hero1 | 192.168.22.251 | Replica | running | 6 | 0 |\n| hero2 | 192.168.22.252 | Leader | running | 6 | |\n| hero3 | 192.168.22.253 | Replica | running | 6 | 0 |\n+--------+----------------+---------+---------+----+-----------+<\/code><\/pre>\n\n\n\n<p>The cluster is using pgBackRest to create backups and there are also backups available for this cluster.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>postgres@backup_hero:\/home\/postgres\/ &#091;pg14] pgbackrest --stanza=hero2hero info\nstanza: hero2hero\n    status: ok\n    cipher: none\n\n    db (current)\n        wal archive min\/max (14): 000000010000000000000001\/00000007000000000000001D\n\n        full backup: 20221024-094106F\n            timestamp start\/stop: 2022-10-24 09:41:06 \/ 2022-10-24 09:42:15\n            wal start\/stop: 00000001000000000000000B \/ 00000001000000000000000D\n            database size: 105MB, database backup size: 105MB\n            repo1: backup set size: 30.8MB, backup size: 30.8MB\n\n        full backup: 20221024-094900F\n            timestamp start\/stop: 2022-10-24 09:49:00 \/ 2022-10-24 09:49:11\n            wal start\/stop: 000000010000000000000011 \/ 000000010000000000000011\n            database size: 105MB, database backup size: 105MB\n            repo1: backup set size: 30.8MB, backup size: 30.8MB\n\n        full backup: 20221024-145020F\n            timestamp start\/stop: 2022-10-24 14:50:20 \/ 2022-10-24 14:50:34\n            wal start\/stop: 000000050000000000000018 \/ 000000050000000000000018\n            database size: 105.2MB, database backup size: 105.2MB\n            repo1: backup set size: 30.8MB, backup size: 30.8MB\n<\/code><\/pre>\n\n\n\n<p>Due to a mistake the PGDATA directory was deleted on all three nodes. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>postgres@hero1:\/u02\/pgdata\/14\/PG1\/ &#091;PG1] ls -al\ntotal 0\ndrwx------. 2 postgres postgres 6 Oct 24 15:28 .\ndrwxr-x---. 3 postgres postgres 17 Sep 5 10:20 ..\n<\/code><\/pre>\n\n\n\n<p>To have a clear cut, we stop the Patroni Service on all three nodes.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>postgres@hero3:\/u02\/pgdata\/14\/PG1\/ &#091;PG1] sudo systemctl stop patroni\npostgres@hero3:\/u02\/pgdata\/14\/PG1\/ &#091;PG1] sudo systemctl status patroni\n\u25cf patroni.service - dbi services patroni service\nLoaded: loaded (\/etc\/systemd\/system\/patroni.service; disabled; vendor preset: disabled)\nActive: inactive (dead)\nOct 24 15:29:08 hero3 patroni&#091;2014]: 2022-10-24 15:29:08,144 INFO: waiting for leader to bootstrap\nOct 24 15:29:18 hero3 patroni&#091;2014]: 2022-10-24 15:29:18,138 INFO: Lock owner: None; I am hero3\nOct 24 15:29:47 hero3 systemd&#091;1]: Stopping dbi services patroni service\u2026\nOct 24 15:29:47 hero3 systemd&#091;1]: patroni.service: Succeeded.\nOct 24 15:29:47 hero3 systemd&#091;1]: Stopped dbi services patroni service.<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-custom-bootstrap-method\">Custom Bootstrap Method<\/h2>\n\n\n\n<p>As a next step we need to create a custom bootstrap method to bootstrap from the latest pgBackRest Backup. According to the <a href=\"https:\/\/patroni.readthedocs.io\/en\/latest\/replica_bootstrap.html?highlight=custom%20bootstrap%20method\">Patroni documentation <\/a>this is quite easy.<\/p>\n\n\n\n<p>First of all let&#8217;s create a custom bootstrap file in the postgres user home called bootstrap_pgbackrest.sh. This file includes the restore command to restore from the pgBackRest backup.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>postgres@hero2:\/home\/postgres\/ &#091;PG1] cat bootstrap_pgbackrest.sh\n#!\/bin\/bash\npgbackrest --stanza=hero2hero --log-level-console=info restore\npostgres@hero2:\/home\/postgres\/ &#091;PG1] chmod +x bootstrap_pgbackrest.sh<\/code><\/pre>\n\n\n\n<p>In the next step we need to adjust the patroni.yml on one host to use the new custom bootstrap method. <\/p>\n\n\n\n<p>Add the following section in the bootstrap section that points to the custom bootstrap file we created.  <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>bootstrap:\n  # this section will be written into Etcd:\/\/\/config after initializing new cluster\n  # and all other cluster members will use it as a global configuration\n  method: pgbackrest\n  pgbackrest:\n    command: \/home\/postgres\/bootstrap_pgbackrest.sh\n    keep_existing_recovery_conf: False\n    no_paramas: False\n    recovery_conf:\n        recovery_target_action: promote\n        recovery_target_timeline: latest\n        restore_command: pgbackrest --stanza=hero2hero archive-get %f %p<\/code><\/pre>\n\n\n\n<p>Let&#8217;s try to start the patroni service again and see if it really bootstraps from the pgBackRest.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>postgres@hero3:\/u01\/app\/postgres\/local\/dmk\/etc\/ &#091;PG1] sudo systemctl status patroni\n\u25cf patroni.service - dbi services patroni service\n   Loaded: loaded (\/etc\/systemd\/system\/patroni.service; disabled; vendor preset: disabled)\n   Active: active (running) since Mon 2022-10-24 16:10:33 CEST; 1s ago\n  Process: 3020 ExecStartPre=\/usr\/bin\/sudo \/bin\/chown postgres \/dev\/watchdog (code=exited, status=0\/SUCCESS)\n  Process: 3017 ExecStartPre=\/usr\/bin\/sudo \/sbin\/modprobe softdog (code=exited, status=0\/SUCCESS)\n Main PID: 3024 (patroni)\n    Tasks: 5 (limit: 11364)\n   Memory: 19.8M\n   CGroup: \/system.slice\/patroni.service\n           \u2514\u25003024 \/usr\/bin\/python3.9 \/u01\/app\/postgres\/local\/dmk\/bin\/patroni \/u01\/app\/postgres\/local\/dmk\/etc\/patroni.yml\n\nOct 24 16:10:33 hero3 systemd&#091;1]: Starting dbi services patroni service...\nOct 24 16:10:33 hero3 sudo&#091;3017]: postgres : TTY=unknown ; PWD=\/ ; USER=root ; COMMAND=\/sbin\/modprobe softdog\nOct 24 16:10:33 hero3 sudo&#091;3020]: postgres : TTY=unknown ; PWD=\/ ; USER=root ; COMMAND=\/bin\/chown postgres \/dev\/watchdog\nOct 24 16:10:33 hero3 systemd&#091;1]: Started dbi services patroni service.\nOct 24 16:10:34 hero3 patroni&#091;3024]: 2022-10-24 16:10:34,395 INFO: Selected new etcd server http:\/\/192.168.22.251:2379\nOct 24 16:10:34 hero3 patroni&#091;3024]: 2022-10-24 16:10:34,404 INFO: No PostgreSQL configuration items changed, nothing to reload.\nOct 24 16:10:34 hero3 patroni&#091;3024]: 2022-10-24 16:10:34,433 INFO: Lock owner: None; I am hero3\nOct 24 16:10:34 hero3 patroni&#091;3024]: 2022-10-24 16:10:34,438 INFO: waiting for leader to bootstrap\n<\/code><\/pre>\n\n\n\n<p>Hm&#8230;.that&#8217;s not what I expected. Unfortunately it is waiting for a primary. So seems like there is something missing \/ wrong. And the key to this is really simple. When we list the Patroni members we can see that all nodes are in &#8220;stopped&#8221; state. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> postgres@hero3:\/u01\/app\/postgres\/local\/dmk\/etc\/ &#091;PG1] patronictl list PG1\n+--------+----------------+---------+---------+----+-----------+\n| Member | Host           | Role    | State   | TL | Lag in MB |\n+ Cluster: PG1 (7157976722952275157) ---------+----+-----------+\n| hero1  | 192.168.22.251 | Replica | stopped |    |   unknown |\n| hero2  | 192.168.22.252 | Replica | stopped |    |   unknown |\n| hero3  | 192.168.22.253 | Replica | stopped |    |   unknown |\n+--------+----------------+---------+---------+----+-----------+<\/code><\/pre>\n\n\n\n<p>Of course this is the missing step. Etcd is still aware that the cluster is already initialized. So we need to delete the old cluster before we can bootstrap a new one. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> postgres@hero3:\/u02\/pgdata\/etcd\/member\/ &#091;PG1] patronictl remove PG1\n+--------+----------------+---------+---------+----+-----------+\n| Member | Host           | Role    | State   | TL | Lag in MB |\n+ Cluster: PG1 (7157976722952275157) ---------+----+-----------+\n| hero1  | 192.168.22.251 | Replica | stopped |    |   unknown |\n| hero2  | 192.168.22.252 | Replica | stopped |    |   unknown |\n| hero3  | 192.168.22.253 | Replica | stopped |    |   unknown |\n+--------+----------------+---------+---------+----+-----------+\nPlease confirm the cluster name to remove: PG1\nYou are about to remove all information in DCS for PG1, please type: \"Yes I am aware\": Yes I am aware\n16:23:06 postgres@hero3:\/u02\/pgdata\/etcd\/member\/ &#091;PG1] patronictl list PG1\n+--------+------+------+-------+----+-----------+\n| Member | Host | Role | State | TL | Lag in MB |\n+ Cluster: PG1 (uninitialized) +----+-----------+\n+--------+------+------+-------+----+-----------+\n<\/code><\/pre>\n\n\n\n<p>We are gonna retry it once again to start the patroni service.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> postgres@hero2:\/u01\/app\/postgres\/local\/dmk\/etc\/ &#091;PG1] sudo systemctl start patroni\n15:39:06 postgres@hero2:\/u01\/app\/postgres\/local\/dmk\/etc\/ &#091;PG1] sudo systemctl status patroni\n\u25cf patroni.service - dbi services patroni service\n   Loaded: loaded (\/etc\/systemd\/system\/patroni.service; disabled; vendor preset: disabled)\n   Active: active (running) since Mon 2022-10-24 15:39:06 CEST; 4s ago\n  Process: 38620 ExecStartPre=\/usr\/bin\/sudo \/bin\/chown postgres \/dev\/watchdog (code=exited, status=0\/SUCCESS)\n  Process: 38616 ExecStartPre=\/usr\/bin\/sudo \/sbin\/modprobe softdog (code=exited, status=0\/SUCCESS)\n Main PID: 38626 (patroni)\n    Tasks: 10 (limit: 11364)\n   Memory: 136.6M\n   CGroup: \/system.slice\/patroni.service\n           \u251c\u250038626 \/usr\/bin\/python3.9 \/u01\/app\/postgres\/local\/dmk\/bin\/patroni \/u01\/app\/postgres\/local\/dmk\/etc\/patroni.yml\n           \u251c\u250038633 bin\/bash \/home\/postgres\/bootstrap_pgbackrest.sh --scope=PG1 --datadir=\/u02\/pgdata\/14\/PG1\/\n           \u251c\u250038634 pgbackrest --stanza=hero2hero --log-level-console=info --delta restore\n           \u251c\u250038639 pgbackrest --exec-id=38634-e965e985 --log-level-console=off --log-level-file=off --log-level-stderr=error --process=1 --remote-type=repo --stanza=hero2hero restore:local\n           \u2514\u250038640 ssh -o LogLevel=error -o Compression=no -o PasswordAuthentication=no postgres@192.168.22.250 pgbackrest --exec-id=38634-e965e985 --log-level-console=off --log-level-file=off --log-level-stderr=error --pg1-path=\/u02\/pgdata\/14\/PG1\/ --process=1 --remote-type=repo --repo=1 --repo1-path=&gt;\n\nOct 24 15:39:06 hero2 sudo&#091;38620]: postgres : TTY=unknown ; PWD=\/ ; USER=root ; COMMAND=\/bin\/chown postgres \/dev\/watchdog\nOct 24 15:39:06 hero2 systemd&#091;1]: Started dbi services patroni service.\nOct 24 15:39:06 hero2 patroni&#091;38626]: 2022-10-24 15:39:06,924 INFO: Selected new etcd server http:\/\/192.168.22.251:2379\nOct 24 15:39:06 hero2 patroni&#091;38626]: 2022-10-24 15:39:06,933 INFO: No PostgreSQL configuration items changed, nothing to reload.\nOct 24 15:39:06 hero2 patroni&#091;38626]: 2022-10-24 15:39:06,961 INFO: Lock owner: None; I am hero2\nOct 24 15:39:06 hero2 patroni&#091;38626]: 2022-10-24 15:39:06,971 INFO: trying to bootstrap a new cluster\nOct 24 15:39:06 hero2 patroni&#091;38626]: 2022-10-24 15:39:06,972 INFO: Running custom bootstrap script: \/home\/postgres\/bootstrap_pgbackrest.sh\nOct 24 15:39:06 hero2 patroni&#091;38634]: 2022-10-24 15:39:06.985 P00   INFO: restore command begin 2.41: --exec-id=38634-e965e985 --log-level-console=info --pg1-path=\/u02\/pgdata\/14\/PG1\/ --repo1-host=192.168.22.250 --repo1-host-user=postgres --repo1-path=\/u99\/backups --stanza=hero2hero\nOct 24 15:39:07 hero2 patroni&#091;38634]: 2022-10-24 15:39:07.568 P00   INFO: repo1: restore backup set 20221024-145020F, recovery will start at 2022-10-24 14:50:20\n\npostgres@hero2:\/u02\/pgdata\/14\/PG1\/ &#091;PG1] patronictl list\n+--------+----------------+--------+---------+----+-----------+\n| Member | Host           | Role   | State   | TL | Lag in MB |\n+ Cluster: PG1 (7157976722952275157) --------+----+-----------+\n| hero2  | 192.168.22.252 | Leader | running |  8 |           |\n+--------+----------------+--------+---------+----+-----------+\n\n<\/code><\/pre>\n\n\n\n<p>As you can see, it successfully boostraped using the custom bootstrap file. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-recreate-the-replicas\">Recreate the replicas<\/h2>\n\n\n\n<p>As the primary is finally back online we can add the replicas again.  <\/p>\n\n\n\n<p>This is pretty easy as we can bootstrap directly from the primary again.  Which works pretty well for both hosts.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>postgres@hero1:\/home\/postgres\/ &#091;PG1] sudo systemctl status patroni\n\u25cf patroni.service - dbi services patroni service\n   Loaded: loaded (\/etc\/systemd\/system\/patroni.service; enabled; vendor preset: disabled)\n   Active: active (running) since Mon 2022-10-24 18:25:33 CEST; 2s ago\n  Process: 8656 ExecReload=\/bin\/kill -s HUP $MAINPID (code=exited, status=0\/SUCCESS)\n  Process: 8708 ExecStartPre=\/usr\/bin\/sudo \/bin\/chown postgres \/dev\/watchdog (code=exited, status=0\/SUCCESS)\n  Process: 8705 ExecStartPre=\/usr\/bin\/sudo \/sbin\/modprobe softdog (code=exited, status=0\/SUCCESS)\n Main PID: 8713 (patroni)\n    Tasks: 9 (limit: 11364)\n   Memory: 128.9M\n   CGroup: \/system.slice\/patroni.service\n           \u251c\u25008713 \/usr\/bin\/python3.9 \/u01\/app\/postgres\/local\/dmk\/bin\/patroni \/u01\/app\/postgres\/local\/dmk\/etc\/patroni.yml\n           \u251c\u25008720 pgbackrest --stanza=hero2hero restore\n           \u251c\u25008725 pgbackrest --exec-id=8720-f8ab7b63 --log-level-console=off --log-level-file=off --log-level-stderr=error --process=1 --remote-type=repo --stanza=hero2hero restore:local\n           \u2514\u25008726 ssh -o LogLevel=error -o Compression=no -o PasswordAuthentication=no postgres@192.168.22.250 pgbackrest --exec-id=8720-f8ab7b63 --log-level-console=off --log-level-file=off --log-level-stderr=error --pg1-path=\/u02\/pgdata\/14\/PG1\/ --process=1 --remote-type=repo --repo=1 --repo1-path=\/u&gt;\n\nOct 24 18:25:33 hero1 systemd&#091;1]: Starting dbi services patroni service...\nOct 24 18:25:33 hero1 sudo&#091;8705]: postgres : TTY=unknown ; PWD=\/ ; USER=root ; COMMAND=\/sbin\/modprobe softdog\nOct 24 18:25:33 hero1 sudo&#091;8708]: postgres : TTY=unknown ; PWD=\/ ; USER=root ; COMMAND=\/bin\/chown postgres \/dev\/watchdog\nOct 24 18:25:33 hero1 systemd&#091;1]: Started dbi services patroni service.\nOct 24 18:25:33 hero1 patroni&#091;8713]: 2022-10-24 18:25:33,542 INFO: Selected new etcd server http:\/\/192.168.22.253:2379\nOct 24 18:25:33 hero1 patroni&#091;8713]: 2022-10-24 18:25:33,550 INFO: No PostgreSQL configuration items changed, nothing to reload.\nOct 24 18:25:33 hero1 patroni&#091;8713]: 2022-10-24 18:25:33,573 INFO: Lock owner: hero3; I am hero1\nOct 24 18:25:33 hero1 patroni&#091;8713]: 2022-10-24 18:25:33,577 INFO: trying to bootstrap from leader 'hero3'\n\n\npostgres@hero1:\/u02\/pgdata\/14\/PG1\/ &#091;PG1] patronictl list\n+--------+----------------+---------+---------+----+-----------+\n| Member | Host           | Role    | State   | TL | Lag in MB |\n+ Cluster: PG1 (7157976722952275157) ---------+----+-----------+\n| hero1  | 192.168.22.251 | Replica | running |  8 |         0 |\n| hero2  | 192.168.22.252 | Leader  | running |  8 |           |\n| hero3  | 192.168.22.253 | Replica | running |  8 |         0 |\n+--------+----------------+---------+---------+----+-----------+\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-conclusion\">Conclusion<\/h2>\n\n\n\n<p>Always have a detailed look on your patroni.yml file. Small mistakes can really cost you a lot of time (especially blanks at the wrong place). In case of a mistake while restoring the primary from the backup, don&#8217;t forget to run &#8220;patronictl remove &lt;CLUSTERNAME&gt;&#8221; once again. <\/p>\n\n\n\n<p>In case you want to recreate your Replicas from pgBackRest Backup again, just create a new Backup before you reinit the Replica.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>While preparing myself for the pgconf.eu in Berlin this week I made a lot of research regarding Patroni and pgBackRest. I was aware that it&#8217;s possible to recreate a replica from a pgBackRest backup. But I was also wondering, what happens if the complete Patroni Cluster is gone. I know this is not the most [&hellip;]<\/p>\n","protected":false},"author":28,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[229],"tags":[1543,1293,2602],"type_dbi":[],"class_list":["post-20145","post","type-post","status-publish","format-standard","hentry","category-database-administration-monitoring","tag-patroni","tag-pgbackrest","tag-postgresql-2"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.2 (Yoast SEO v27.5) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Bootstrap Patroni Cluster from pgBackRest Backup - dbi Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.dbi-services.com\/blog\/bootstrap-patroni-cluster-from-pgbackrest-backup\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Bootstrap Patroni Cluster from pgBackRest Backup\" \/>\n<meta property=\"og:description\" content=\"While preparing myself for the pgconf.eu in Berlin this week I made a lot of research regarding Patroni and pgBackRest. I was aware that it&#8217;s possible to recreate a replica from a pgBackRest backup. But I was also wondering, what happens if the complete Patroni Cluster is gone. I know this is not the most [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/bootstrap-patroni-cluster-from-pgbackrest-backup\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi Blog\" \/>\n<meta property=\"article:published_time\" content=\"2022-10-27T16:30:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-04-04T07:56:06+00:00\" \/>\n<meta name=\"author\" content=\"Open source Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Open source Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/bootstrap-patroni-cluster-from-pgbackrest-backup\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/bootstrap-patroni-cluster-from-pgbackrest-backup\\\/\"},\"author\":{\"name\":\"Open source Team\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/59554f0d99383431eb6ed427e338952b\"},\"headline\":\"Bootstrap Patroni Cluster from pgBackRest Backup\",\"datePublished\":\"2022-10-27T16:30:00+00:00\",\"dateModified\":\"2025-04-04T07:56:06+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/bootstrap-patroni-cluster-from-pgbackrest-backup\\\/\"},\"wordCount\":467,\"commentCount\":2,\"keywords\":[\"Patroni\",\"pgbackrest\",\"postgresql\"],\"articleSection\":[\"Database Administration &amp; Monitoring\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/bootstrap-patroni-cluster-from-pgbackrest-backup\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/bootstrap-patroni-cluster-from-pgbackrest-backup\\\/\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/bootstrap-patroni-cluster-from-pgbackrest-backup\\\/\",\"name\":\"Bootstrap Patroni Cluster from pgBackRest Backup - dbi Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#website\"},\"datePublished\":\"2022-10-27T16:30:00+00:00\",\"dateModified\":\"2025-04-04T07:56:06+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/59554f0d99383431eb6ed427e338952b\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/bootstrap-patroni-cluster-from-pgbackrest-backup\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/bootstrap-patroni-cluster-from-pgbackrest-backup\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/bootstrap-patroni-cluster-from-pgbackrest-backup\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Bootstrap Patroni Cluster from pgBackRest Backup\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/\",\"name\":\"dbi Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/59554f0d99383431eb6ed427e338952b\",\"name\":\"Open source Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/eb4fb12e386e8c41fdef0733e8114594cf2653e4f55e9fa2161442b8eaf3f657?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/eb4fb12e386e8c41fdef0733e8114594cf2653e4f55e9fa2161442b8eaf3f657?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/eb4fb12e386e8c41fdef0733e8114594cf2653e4f55e9fa2161442b8eaf3f657?s=96&d=mm&r=g\",\"caption\":\"Open source Team\"},\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/author\\\/open-source-team\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Bootstrap Patroni Cluster from pgBackRest Backup - dbi Blog","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:\/\/www.dbi-services.com\/blog\/bootstrap-patroni-cluster-from-pgbackrest-backup\/","og_locale":"en_US","og_type":"article","og_title":"Bootstrap Patroni Cluster from pgBackRest Backup","og_description":"While preparing myself for the pgconf.eu in Berlin this week I made a lot of research regarding Patroni and pgBackRest. I was aware that it&#8217;s possible to recreate a replica from a pgBackRest backup. But I was also wondering, what happens if the complete Patroni Cluster is gone. I know this is not the most [&hellip;]","og_url":"https:\/\/www.dbi-services.com\/blog\/bootstrap-patroni-cluster-from-pgbackrest-backup\/","og_site_name":"dbi Blog","article_published_time":"2022-10-27T16:30:00+00:00","article_modified_time":"2025-04-04T07:56:06+00:00","author":"Open source Team","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Open source Team","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/bootstrap-patroni-cluster-from-pgbackrest-backup\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/bootstrap-patroni-cluster-from-pgbackrest-backup\/"},"author":{"name":"Open source Team","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/59554f0d99383431eb6ed427e338952b"},"headline":"Bootstrap Patroni Cluster from pgBackRest Backup","datePublished":"2022-10-27T16:30:00+00:00","dateModified":"2025-04-04T07:56:06+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/bootstrap-patroni-cluster-from-pgbackrest-backup\/"},"wordCount":467,"commentCount":2,"keywords":["Patroni","pgbackrest","postgresql"],"articleSection":["Database Administration &amp; Monitoring"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbi-services.com\/blog\/bootstrap-patroni-cluster-from-pgbackrest-backup\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/bootstrap-patroni-cluster-from-pgbackrest-backup\/","url":"https:\/\/www.dbi-services.com\/blog\/bootstrap-patroni-cluster-from-pgbackrest-backup\/","name":"Bootstrap Patroni Cluster from pgBackRest Backup - dbi Blog","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"datePublished":"2022-10-27T16:30:00+00:00","dateModified":"2025-04-04T07:56:06+00:00","author":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/59554f0d99383431eb6ed427e338952b"},"breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/bootstrap-patroni-cluster-from-pgbackrest-backup\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/bootstrap-patroni-cluster-from-pgbackrest-backup\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/bootstrap-patroni-cluster-from-pgbackrest-backup\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Bootstrap Patroni Cluster from pgBackRest Backup"}]},{"@type":"WebSite","@id":"https:\/\/www.dbi-services.com\/blog\/#website","url":"https:\/\/www.dbi-services.com\/blog\/","name":"dbi Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/59554f0d99383431eb6ed427e338952b","name":"Open source Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/eb4fb12e386e8c41fdef0733e8114594cf2653e4f55e9fa2161442b8eaf3f657?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/eb4fb12e386e8c41fdef0733e8114594cf2653e4f55e9fa2161442b8eaf3f657?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/eb4fb12e386e8c41fdef0733e8114594cf2653e4f55e9fa2161442b8eaf3f657?s=96&d=mm&r=g","caption":"Open source Team"},"url":"https:\/\/www.dbi-services.com\/blog\/author\/open-source-team\/"}]}},"_links":{"self":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/20145","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/users\/28"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/comments?post=20145"}],"version-history":[{"count":7,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/20145\/revisions"}],"predecessor-version":[{"id":37896,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/20145\/revisions\/37896"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=20145"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=20145"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=20145"},{"taxonomy":"type","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/type_dbi?post=20145"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}