diff --git a/doc/cloning-standbys.xml b/doc/cloning-standbys.xml index fc5a18ab..4f4d4b00 100644 --- a/doc/cloning-standbys.xml +++ b/doc/cloning-standbys.xml @@ -225,6 +225,109 @@ description = "Main cluster" + + + Using Barman through its API (pg-backup-api) + + cloning + pg-backup-api + + + + You can find information on how to install and setup pg-backup-api in + the pg-backup-api + documentation. + + + + This mode (`pg-backupapi`) was introduced in v5.4.0 as a way to further integrate with Barman letting Barman + handle the restore. This also reduces the ssh keys that need to share between the backup and postgres nodes. + As long as you have access to the API service by HTTP calls, you could perform recoveries right away. + You just need to instruct Barman through the API which backup you need and on which node the backup needs to + to be restored on. + + + + In order to enable pg_backupapi mode support for repmgr standby clone, + you need the following lines in repmgr.conf: + + pg_backupapi_host: Where pg-backup-api is hosted + pg_backupapi_node_name: Name of the server as understood by Barman + pg_backupapi_remote_ssh_command: How Barman will be connecting as to the node + pg_backupapi_backup_id: ID of the existing backup you need to restore + + + This is an example of how repmgr.conf would look like: + + + pg_backupapi_host = '192.168.122.154' + pg_backupapi_node_name = 'burrito' + pg_backupapi_remote_ssh_command = 'ssh john_doe@192.168.122.1' + pg_backupapi_backup_id = '20230223T093201' + + + + + pg_backupapi_host is the variable name that enables this mode, and when you set it, + all the rest of the above variables are required. Also, remember that this service is just an interface + between Barman and repmgr, hence if something fails during a recovery, you should check Barman's logs upon + why the process couldn't finish properly. + + + + + Despite in Barman you can define shortcuts like "lastest" or "oldest", they are not supported for the + time being in pg-backup-api. These shortcuts will be supported in a future release. + + + + + This is a real example of repmgr's output cloning with the API. Note that during this operation, we stopped + the service for a little while and repmgr had to retry but that doesn't affect the final outcome. The primary + is listening on localhost's port 6001: + + +$ repmgr -f ~/nodes/node_3/repmgr.conf standby clone -U repmgr -p 6001 -h localhost +NOTICE: destination directory "/home/mario/nodes/node_3/data" provided +INFO: Attempting to use `pg_backupapi` new restore mode +INFO: connecting to source node +DETAIL: connection string is: user=repmgr port=6001 host=localhost +DETAIL: current installation size is 8541 MB +DEBUG: 1 node records returned by source node +DEBUG: connecting to: "user=repmgr dbname=repmgr host=localhost port=6001 connect_timeout=2 fallback_application_name=repmgr options=-csearch_path=" +DEBUG: upstream_node_id determined as 1 +INFO: Attempting to use `pg_backupapi` new restore mode +INFO: replication slot usage not requested; no replication slot will be set up for this standby +NOTICE: starting backup (using pg_backupapi)... +INFO: Success creating the task: operation id '20230309T150647' +INFO: status IN_PROGRESS +INFO: status IN_PROGRESS +Incorrect reply received for that operation ID. +INFO: Retrying... +INFO: status IN_PROGRESS +INFO: status IN_PROGRESS +INFO: status IN_PROGRESS +INFO: status IN_PROGRESS +INFO: status IN_PROGRESS +INFO: status IN_PROGRESS +INFO: status IN_PROGRESS +INFO: status IN_PROGRESS +INFO: status IN_PROGRESS +INFO: status IN_PROGRESS +INFO: status IN_PROGRESS +INFO: status IN_PROGRESS +INFO: status IN_PROGRESS +INFO: status IN_PROGRESS +INFO: status IN_PROGRESS +INFO: status DONE +NOTICE: standby clone (from pg_backupapi) complete +NOTICE: you can now start your PostgreSQL server +HINT: for example: pg_ctl -D /home/mario/nodes/node_3/data start +HINT: after starting the server, you need to register this standby with "repmgr standby register" + + + +