barman - Backup and Recovery Manager for PostgreSQL
barman [OPTIONS] COMMAND
Barman is an administration tool for disaster recovery of PostgreSQL servers written in Python and maintained by 2ndQuadrant. Barman can perform remote backups of multiple servers in business critical environments and helps DBAs during the recovery phase.
Important: every command has a help option
archive_command and streaming replication, where applicable) and moves them in the WAL archive for that server. If necessary, apply compression when requested by the user.
Perform a backup of SERVER_NAME using parameters specified in the configuration file. Specify all as SERVER_NAME to perform a backup of all the configured servers.
immediate_checkpoint, if present in the configuration file.
immediate_checkpoint, if present in the configuration file.
Overrides reuse_backup option behaviour. Possible values for INCREMENTAL_TYPE are:
link is the default target if --reuse-backup is used and INCREMENTAL_TYPE is not explicit.
basebackup_retry_times, if present in the configuration file.
--retry-times 0
basebackup_retry_sleep, if present in the configuration file.
parallel_jobs, if present in the configuration file.
cron command and at the end of every backup operation.
Show diagnostic information about SERVER_NAME, including: Ssh connection check, PostgreSQL version, configuration and backup directories, archiving process, streaming process, replication slots, etc. Specify all as SERVER_NAME to show diagnostic information about all the configured servers.
Perform maintenance tasks, such as enforcing retention policies or WAL files management.
rsync version, as well as current configuration and status of all servers.
Retrieve a WAL file from the xlog archive of a given server. By default, the requested WAL file, if found, is returned as uncompressed content to STDOUT. The following options allow users to change this behaviour:
get-wal will deposit the requested WAL
SERVER_NAME. This command is useful to retrieve a backup ID. For example:
servername 20111104T102647 - Fri Nov 4 10:26:48 2011 - Size: 17.0 MiB - WAL Size: 100 B
In this case, *20111104T102647* is the backup ID.
List all the files in a particular backup, identified by the server name and the backup ID. See the Backup ID shortcuts section below for available shortcuts.
Possible values for TARGET_TYPE are:
The default value is standalone.
Receive a WAL file from a remote server and securely store it into the SERVER_NAME incoming directory. The WAL file is retrieved from the STDIN, and must be encapsulated in a tar stream together with a MD5SUMS file to validate it. This command is meant to be invoked through SSH from a remote barman-wal-archive utility (part of barman-cli package). Do not use this command directly unless you take full responsibility of the content of files.
SERVER_NAME (or every server, using the all shortcut) guessing it from the disk content. The metadata of the WAL archive is contained in the xlog.db file, and every Barman server has its own copy.
Start the stream of transaction logs for a server. The process relies on pg_receivewal/pg_receivexlog to receive WAL files from the PostgreSQL servers through the streaming protocol.
slot_name configuration parameter
slot_name configuration parameter
Recover a backup in a given directory (local or remote, depending on the --remote-ssh-command option settings). See the Backup ID shortcuts section below for available shortcuts.
Recover to the specified time.
You can use any valid unambiguous representation (e.g: "YYYY-MM-DD HH:MM:SS.mmm").
pg_create_restore_point(name) (for PostgreSQL 9.1 and above users).
pause (PostgreSQL 9.1 and above), shutdown (PostgreSQL 9.5 and above) and promote (ditto). This option requires a target to be defined, with one of the above options.
basebackup_retry_times, if present in the configuration file.
--retry-times 0
basebackup_retry_sleep, if present in the configuration file.
parallel_jobs, if present in the configuration file. Works only for servers configured through rsync/SSH.
get-wal for WAL fetching during recovery. Default is based on recovery_options setting.
network_compression configuration setting.
Shows live information and status of any streaming client attached to the given server (or servers). Default behaviour can be changed through the following options:
Possible values for TARGET_TYPE are:
Backup 20150828T130001:
Server Name : quagmire
Status : DONE
PostgreSQL Version : 90402
PGDATA directory : /srv/postgresql/9.4/main/data
Base backup information:
Disk usage : 12.4 TiB (12.4 TiB with WALs)
Incremental size : 4.9 TiB (-60.02%)
Timeline : 1
Begin WAL : 0000000100000CFD000000AD
End WAL : 0000000100000D0D00000008
WAL number : 3932
WAL compression ratio: 79.51%
Begin time : 2015-08-28 13:00:01.633925+00:00
End time : 2015-08-29 10:27:06.522846+00:00
Begin Offset : 1575048
End Offset : 13853016
Begin XLOG : CFD/AD180888
End XLOG : D0D/8D36158
WAL information:
No of files : 35039
Disk usage : 121.5 GiB
WAL rate : 275.50/hour
Compression ratio : 77.81%
Last available : 0000000100000D95000000E7
Catalog information:
Retention Policy : not enforced
Previous Backup : 20150821T130001
Next Backup : - (this is the latest base backup)
SERVER_NAME, including: conninfo, backup_directory, wals_directory and many more. Specify all as SERVER_NAME to show information about all the configured servers.
archive_command, archive_status and many more. For example:
Server quagmire:
Description: The Giggity database
Passive node: False
PostgreSQL version: 9.3.9
pgespresso extension: Not available
PostgreSQL Data directory: /srv/postgresql/9.3/data
PostgreSQL 'archive_command' setting: rsync -a %p barman@backup:/var/lib/barman/quagmire/incoming
Last archived WAL: 0000000100003103000000AD
Current WAL segment: 0000000100003103000000AE
Retention policies: enforced (mode: auto, retention: REDUNDANCY 2, WAL retention: MAIN)
No. of available backups: 2
First available backup: 20150908T003001
Last available backup: 20150909T003001
Minimum redundancy requirements: satisfied (2/1)
Execute pg_switch_wal() on the target server (from PostgreSQL 10), or pg_switch_xlog (for PostgreSQL 8.3 to 9.6).
BACKUP_ID that is present on SERVER_NAME node. This command is available only for passive nodes, and uses the primary_ssh_command option to establish a secure connection with the primary node.
Collect information regarding the current status of a Barman server, to be used for synchronisation purposes. Returns a JSON output representing SERVER_NAME, that contains: all the successfully finished backup, all the archived WAL files, the configuration, last WAL file been read from the xlog.db and the position in the file.
xlog.db file (incremental synchronisation)
SERVER_NAME node. This command is available only for passive nodes, and uses the primary_ssh_command option to establish a secure connection with the primary node.
Rather than using the timestamp backup ID, you can use any of the following shortcuts/aliases to identity a backup for a given server:
barman (5).
Barman has been extensively tested, and is currently being used in several production environments. However, we cannot exclude the presence of bugs.
Any bug can be reported via the Sourceforge bug tracker. Along the bug submission, users can provide developers with diagnostics information obtained through the barman diagnose command.
In alphabetical order:
Past contributors:
Barman is the property of 2ndQuadrant Limited and its code is distributed under GNU General Public License v3.
Copyright (C) 2011-2020 2ndQuadrant Limited - http://www.2ndQuadrant.com/.