| BARMAN(1) | Barman | BARMAN(1) |
barman - Barman Commands
Barman has a command-line interface named barman, which is used basically to interact with Barman's backend.
Before jumping into each of the sub-commands of barman, be aware that barman has global options available for all of the sub-commands. These options can modify the behavior of the sub-commands and can be used as follows:
barman
[ { -c | --config } CONFIG ]
[ { --color | --colour } { never | always | auto } ]
[ { -d | --debug } ]
[ { -f | --format } { json | console } ]
[ { -h | --help } ]
[ --log-level { NOTSET | DEBUG | INFO | WARNING | ERROR | CRITICAL } ]
[ { -q | --quiet } ]
[ { -v | --version } ]
[ SUBCOMMAND ]
NOTE:
We will use this same syntax when describing barman sub-commands in the following sections.
Also, when describing sub-commands in the following sections, the commands' synopsis should be seen as a replacement for the SUBCOMMAND.
For some commands, you can use the following shortcuts or aliases to identify a backup for a given server. Specifically, the all shortcut can be used to identify all servers:
| Shortcut | Description |
| all | All available servers |
| first/oldest | Oldest available backup for the server, in chronological order. |
| last/latest | Most recent available backup for the server, in chronological order. |
| last-full/latest-full | Most recent full backup taken with methods rsync or postgres. |
| last-failed | Most recent backup that failed, in chronological order. |
Status code 0 means success, while status code Non-Zero means failure.
barman exposes several handy operations. This section is intended to describe each of them.
In the following sections you can find a description of each command implemented by barman. Some of these commands may have more detailed information in another main section in this documentation. If that is the case, a reference is provided to help you quickly navigate to it.
archive-wal
[ { -h | --help } ]
SERVER_NAME
Fetch WAL files received from either the standard archive_command or streaming replication with pg_receivewal and store them in the server's WAL archive. If you have enabled compression in the configuration file, the WAL files will be compressed before they are archived.
backup
[ --bwlimit KBPS ]
[ { -h | --help } ]
[ --incremental BACKUP_ID ]
[ --immediate-checkpoint ]
[ { -j | --jobs } PARALLEL_WORKERS ]
[ --jobs-start-batch-period PERIOD ]
[ --jobs-start-batch-size SIZE ]
[ --keepalive-interval SECONDS ]
[ --manifest ]
[ --name NAME ]
[ --no-immediate-checkpoint ]
[ --no-manifest ]
[ --no-retry ]
[ --retry-sleep SECONDS ]
[ --retry-times NUMBER ]
[ --reuse-backup { off | copy | link } ]
[ { --wait | -w } ]
[ --wait-timeout SECONDS ]
SERVER_NAME [ SERVER_NAME ... ]
Execute a PostreSQL server backup. Barman will use the parameters specified in the Global and Server configuration files. Specify all shortcut instead of the server name to execute backups from all servers configured in the Barman node. You can also specify multiple server names in sequence to execute backups for specific servers.
NOTE:
NOTE:
Use shortcuts instead of SERVER_NAME.
| Shortcut | Description |
| all | All available servers |
check-backup
[ { -h | --help } ]
SERVER_NAME BACKUP_ID
Check that all necessary WAL files for verifying the consistency of a physical backup are properly archived. This command is automatically executed by the cron job and at the end of each backup operation. You can use a shortcut instead of BACKUP_ID.
Use shortcuts instead of BACKUP_ID.
| Shortcut | Description |
| first/oldest | Oldest available backup for the server, in chronological order. |
| last/latest | Most recent available backup for the server, in chronological order. |
| last-full/latest-full | Most recent full backup taken with methods rsync or postgres. |
| last-failed | Most recent backup that failed, in chronological order. |
check
[ { -h | --help } ]
[ --nagios ]
SERVER_NAME [ SERVER_NAME ... ]
Display status information about a server, such as SSH connection, Postgres version, configuration and backup directories, archiving and streaming processes, replication slots, and more. Use all as shortcut to show diagnostic information for all configured servers.
Use shortcuts instead of SERVER_NAME.
| Shortcut | Description |
| all | All available servers |
config-switch
[ { -h | --help } ]
SERVER_NAME { --reset | MODEL_NAME }
Apply a set of configuration overrides from the model to a server in Barman. The final configuration will combine or override the server's existing settings with the ones specified in the model. You can reset the server configurations with the --reset argument.
NOTE:
config-update
[ { -h | --help } ]
STRING
Create or update the configurations for servers and/or models in Barman. The parameter should be a JSON string containing an array of documents. Each document must include a scope key, which can be either server or model, and either a server_name or model_name key, depending on the scope value. Additionally, the document should include other keys representing Barman configuration options and their desired values.
NOTE:
JSON_STRING='[{“scope”: “server”, “server_name”: “my_server”, “archiver”: “on”, “streaming_archiver”: “off”}]'
cron
[ { -h | --help } ]
[ --keep-descriptors ]
Carry out maintenance tasks, such as enforcing retention policies or managing WAL files.
delete
[ { -h | --help } ]
SERVER_NAME BACKUP_ID
Delete the specified backup. You can use a shortcut instead of BACKUP_ID.
Use shortcuts instead of BACKUP_ID.
| Shortcut | Description |
| first/oldest | Oldest available backup for the server, in chronological order. |
| last/latest | Most recent available backup for the server, in chronological order. |
| last-full/latest-full | Most recent full backup taken with methods rsync or postgres. |
| last-failed | Most recent backup that failed, in chronological order. |
diagnose
[ { -h | --help } ]
[ --show-config-source ]
Display diagnostic information about the Barman node, which is the server where Barman is installed, as well as all configured Postgres servers. This includes details such as global configuration, SSH version, Python version, rsync version, the current configuration and status of all servers, and many more.
generate-manifest
[ { -h | --help } ]
SERVER_NAME BACKUP_ID
Generates a backup_manifest file for a backup. You can use a shortcut instead of BACKUP_ID.
Use shortcuts instead of BACKUP_ID.
| Shortcut | Description |
| first/oldest | Oldest available backup for the server, in chronological order. |
| last/latest | Most recent available backup for the server, in chronological order. |
| last-full/latest-full | Most recent full backup taken with methods rsync or postgres. |
| last-failed | Most recent backup that failed, in chronological order. |
get-wal
[ { --bzip | -j } ]
[ { --gzip | -z | -x } ]
[ { -h | --help } ]
[ --keep-compression ]
[ { --output-directory | -o } OUTPUT_DIRECTORY ]
[ { --peek | -p } VALUE ]
[ { -P | --partial } ]
[ { -t | --test } ]
SERVER_NAME WAL_NAME
Retrieve a WAL file from the xlog archive of a specified server. By default, if the requested WAL file is found, it is returned as uncompressed content to STDOUT.
WARNING:
keep
[ { -h | --help } ]
{ { -r | --release } | { -s | --status } | --target { full | standalone } }
SERVER_NAME BACKUP_ID
Mark the specified backup with a target as an archival backup to be retained indefinitely, overriding any active retention policies. You can also check the keep status of a backup and release the keep mark from a backup. You can use a shortcut instead of BACKUP_ID.
Use shortcuts instead of BACKUP_ID.
| Shortcut | Description |
| first/oldest | Oldest available backup for the server, in chronological order. |
| last/latest | Most recent available backup for the server, in chronological order. |
| last-full/latest-full | Most recent full backup taken with methods rsync or postgres. |
| last-failed | Most recent backup that failed, in chronological order. |
list-backups
[ { -h | --help } ]
[ --minimal ]
SERVER_NAME
Display the available backups for a server. This command is useful for retrieving both the backup ID and the backup type. You can find details about this command in Catalog usage.
Use shortcuts instead of SERVER_NAME.
| Shortcut | Description |
| all | All available servers |
list-files
[ { -h | --help } ]
[ --target { data | full | standalone | wal } ]
SERVER_NAME BACKUP_ID
List all files in a specific backup. You can use a shortcut instead of BACKUP_ID.
Use shortcuts instead of BACKUP_ID.
| Shortcut | Description |
| first/oldest | Oldest available backup for the server, in chronological order. |
| last/latest | Most recent available backup for the server, in chronological order. |
| last-full/latest-full | Most recent full backup taken with methods rsync or postgres. |
| last-failed | Most recent backup that failed, in chronological order. |
list-servers
[ { -h | --help } ]
[ --minimal ]
Display all configured servers along with their descriptions.
lock-directory-cleanup
[ { -h | --help } ]
Automatically removes unused lock files from the barman_lock_directory.
put-wal
[ { -h | --help } ]
[ { -t | --test } ]
SERVER_NAME
Receive a WAL file from a remote server and securely save it into the server incoming directory. The WAL file should be provided via STDIN, encapsulated in a tar stream along with a SHA256SUMS or MD5SUMS file for validation (sha256 is the default hash algorithm, but the user can choose md5 when setting the archive-command via barman-wal-archive). This command is intended to be executed via SSH from a remote barman-wal-archive utility (included in the barman-cli package). Avoid using this command directly unless you fully manage the content of the files.
rebuild-xlogdb
[ { -h | --help } ]
SERVER_NAME [ SERVER_NAME ... ]
Rebuild the WAL file metadata for a server (or for all servers using the all shortcut) based on the disk content. The WAL archive metadata is stored in the xlog.db file, with each Barman server maintaining its own copy.
Use shortcuts instead of SERVER_NAME.
| Shortcut | Description |
| all | All available servers |
NOTE:
receive-wal
[ --create-slot ]
[ --drop-slot ]
[ { -h | --help } ]
[ --reset ]
[ --stop ]
SERVER_NAME
Initiate the streaming of transaction logs for a server. This process uses pg_receivewal or pg_receivexlog to receive WAL files from Postgres servers via the streaming protocol.
restore
[ --aws-region AWS_REGION } ]
[ --azure-resource-group AZURE_RESOURCE_GRP ]
[ --bwlimit KBPS ]
[ --exclusive ]
[ --gcp-zone GCP_ZONE ]
[ { --get-wal | --no-get-wal } ]
[ { -h | --help } ]
[ { -j | --jobs } PARALLEL_WORKERS ]
[ --jobs-start-batch-period SECONDS ]
[ --jobs-start-batch-size NUMBER ]
[ --local-staging-path PATH ]
[ { --network-compression | --no-network-compression } ]
[ --no-retry ]
[ --recovery-conf-filename FILENAME ]
[ --recovery-staging-path PATH ]
[ --remote-ssh-command STRING ]
[ --retry-sleep SECONDS ]
[ --retry-times NUMBER ]
[ --snapshot-recovery-instance INSTANCE_NAME ]
[ --snapshot-recovery-zone GCP_ZONE ]
[ --standby-mode ]
[ --tablespace NAME:LOCATION [ --tablespace NAME:LOCATION ... ] ]
[ --target-action { pause | shutdown | promote } ]
[ --target-immediate ]
[ --target-lsn LSN ]
[ --target-name RESTORE_POINT_NAME ]
[ --target-time TIMESTAMP ]
[ --target-tli TLI ]
[ --target-xid XID ]
[ --staging-wal-directory ]
SERVER_NAME BACKUP_ID DESTINATION_DIR
Execute a PostreSQL server restore operation. Barman will restore the backup from a server in the destination directory. The restoration can be performed locally (on the barman node itself) or remotely (on another machine accessible via SSH). The location is determined by whether or not the --remote-ssh-command option is used. More information on this command can be found in the Recovery section. You can use a shortcut instead of BACKUP_ID.
Use shortcuts instead of BACKUP_ID.
| Shortcut | Description |
| first/oldest | Oldest available backup for the server, in chronological order. |
| last/latest | Most recent available backup for the server, in chronological order. |
| last-full/latest-full | Most recent full backup taken with methods rsync or postgres. |
| last-failed | Most recent backup that failed, in chronological order. |
replication-status
[ { -h | --help } ]
[ --minimal ]
[ --source { backup-host | wal-host } ]
[ --target { hot-standby | wal-streamer | all } ]
SERVER_NAME [ SERVER_NAME ... ]
Display real-time information and status of any streaming clients connected to the specified server. Specify all shortcut to diplay information for all configured servers.
Use shortcuts instead of SERVER_NAME.
| Shortcut | Description |
| all | All available servers |
show-backup
[ { -h | --help } ]
SERVER_NAME BACKUP_ID
Display detailed information about a specific backup. You can find details about this command in Catalog usage. You can use a shortcut instead of BACKUP_ID.
Use shortcuts instead of BACKUP_ID.
| Shortcut | Description |
| first/oldest | Oldest available backup for the server, in chronological order. |
| last/latest | Most recent available backup for the server, in chronological order. |
| last-full/latest-full | Most recent full backup taken with methods rsync or postgres. |
| last-failed | Most recent backup that failed, in chronological order. |
show-servers
[ { -h | --help } ]
SERVER_NAME [ SERVER_NAME ... ]
Display detailed information about a server, including conninfo, backup_directory, wals_directory, archive_command, and many more. To view information about all configured servers, specify the all shortcut instead of the server name.
| Shortcut | Description |
| all | All available servers |
status
[ { -h | --help } ]
SERVER_NAME [ SERVER_NAME ... ]
Display information about a server's status, including details such as the state, Postgres version, WAL information, available backups and more.
| Shortcut | Description |
| all | All available servers |
switch-wal
[ --archive ]
[ --archive-timeout ]
[ --force ]
[ { -h | --help } ]
SERVER_NAME [ SERVER_NAME ... ]
Execute pg_switch_wal() on the target server (Postgres versions 10 and later) or pg_switch_xlog() (for Postgres versions 8.3 to 9.6).
NOTE:
Alias for the switch-wal command.
sync-backup
[ { -h | --help } ]
SERVER_NAME BACKUP_ID
This command synchronizes a passive node with its primary by copying all files from a backup present on the server node. It is available only for passive nodes and uses the primary_ssh_command option to establish a secure connection with the primary node. You can use a shortcut instead of BACKUP_ID.
For some commands, instead of using the timestamp backup ID, you can use the following shortcuts or aliases to identify a backup for a given server:
| Shortcut | Description |
| first/oldest | Oldest available backup for the server, in chronological order. |
| last/latest | Most recent available backup for the server, in chronological order. |
| last-full/latest-full | Most recent full backup taken with methods rsync or postgres. |
| last-failed | Most recent backup that failed, in chronological order. |
sync-info
[ { -h | --help } ]
[ --primary ]
SERVER_NAME [ LAST_WAL [ LAST_POS ] ]
Gather information about the current status of a Barman server for synchronization purposes.
This command returns a JSON output for a server that includes: all successfully completed backups, all archived WAL files, the configuration, the last WAL file read from xlog.db, and its position within the file.
sync-wals
[ { -h | --help } ]
SERVER_NAME
This command synchronizes a passive node with its primary by copying all archived WAL files from the server node. It is available only for passive nodes and utilizes the primary_ssh_command option to establish a secure connection with the primary node.
verify-backup
[ { -h | --help } ]
SERVER_NAME BACKUP_ID
Runs pg_verifybackup on a backup manifest file (available since Postgres version 13). For rsync backups, it can be used after creating a manifest file using the generate-manifest command. Requires pg_verifybackup to be installed on the backup server. You can use a shortcut instead of BACKUP_ID.
For some commands, instead of using the timestamp backup ID, you can use the following shortcuts or aliases to identify a backup for a given server:
| Shortcut | Description |
| first/oldest | Oldest available backup for the server, in chronological order. |
| last/latest | Most recent available backup for the server, in chronological order. |
| last-full/latest-full | Most recent full backup taken with methods rsync or postgres. |
| last-failed | Most recent backup that failed, in chronological order. |
Alias for verify-backup command.
The barman-cli package includes a collection of recommended client utilities that should be installed alongside the Postgres server. Here are the command references for both utilities.
barman-wal-archive
[ { -h | --help } ]
[ { -V | --version } ]
[ { -U | --user } USER ]
[ --port PORT ]
[ { -c | --config } CONFIG ]
[ { -t | --test } ]
[ --md5 ]
BARMAN_HOST SERVER_NAME WAL_PATH
This script can be utilized in the archive_command of a Postgres server to transfer WAL files to a Barman host using the put-wal command (introduced in Barman 2.6). It establishes an SSH connection to the Barman host, enabling seamless integration of Barman within Postgres clusters for improved business continuity.
Exit Statuses are:
barman-wal-restore
[ { -h | --help } ]
[ { -V | --version } ]
[ { -U | --user } USER ]
[ --port PORT ]
[ { -s | --sleep } SECONDS ]
[ { -p | --parallel } JOBS ]
[ --spool-dir SPOOL_DIR ]
[ { -P | --partial } ]
[ { { -z | --gzip } | { -j | --bzip2 } | --keep-compression } ]
[ { -c | --config } CONFIG ]
[ { -t | --test } ]
BARMAN_HOST SERVER_NAME WAL_NAME WAL_DEST
This script serves as a restore_command for Postgres servers, enabling the retrieval of WAL files through Barman's get-wal feature. It establishes an SSH connection to the Barman host and facilitates the integration of Barman within Postgres clusters, enhancing business continuity.
Exit Statuses are:
WARNING:
EnterpriseDB
© Copyright EnterpriseDB UK Limited 2011-2025
| April 24, 2025 | 3.13 |