.TH "BARMAN" "1" "January 5, 2017" "Barman User manuals" "Version 2.1" .SH NAME .PP barman \- Backup and Recovery Manager for PostgreSQL .SH SYNOPSIS .PP barman [\f[I]OPTIONS\f[]] \f[I]COMMAND\f[] .SH DESCRIPTION .PP 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. .SH OPTIONS .TP .B \-v, \-\-version Show program version number and exit. .RS .RE .TP .B \-q, \-\-quiet Do not output anything. Useful for cron scripts. .RS .RE .TP .B \-h, \-\-help Show a help message and exit. .RS .RE .TP .B \-c \f[I]CONFIG\f[], \-\-config \f[I]CONFIG\f[] Use the specified configuration file. .RS .RE .SH COMMANDS .PP Important: every command has a help option .TP .B archive\-wal \f[I]SERVER_NAME\f[] Get any incoming xlog file (both through standard \f[C]archive_command\f[] and streaming replication, where applicable) and moves them in the WAL archive for that server. If necessary, apply compression when requested by the user. .RS .RE .TP .B cron Perform maintenance tasks, such as enforcing retention policies or WAL files management. .RS .RE .TP .B list\-server Show all the configured servers, and their descriptions. .RS .RE .TP .B show\-server \f[I]SERVER_NAME\f[] Show information about \f[C]SERVER_NAME\f[], including: \f[C]conninfo\f[], \f[C]backup_directory\f[], \f[C]wals_directory\f[] and many more. Specify \f[C]all\f[] as \f[C]SERVER_NAME\f[] to show information about all the configured servers. .RS .RE .TP .B status \f[I]SERVER_NAME\f[] Show information about the status of a server, including: number of available backups, \f[C]archive_command\f[], \f[C]archive_status\f[] and many more. For example: .RS .RE .IP .nf \f[C] 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\ \[aq]archive_command\[aq]\ 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) \f[] .fi .TP .B check \f[I]SERVER_NAME\f[] Show diagnostic information about \f[C]SERVER_NAME\f[], including: Ssh connection check, PostgreSQL version, configuration and backup directories, archiving process, streaming process, replication slots, etc. Specify \f[C]all\f[] as \f[C]SERVER_NAME\f[] to show diagnostic information about all the configured servers. .RS .TP .B \-\-nagios Nagios plugin compatible output .RS .RE .RE .TP .B diagnose Collect diagnostic information about the server where barman is installed and all the configured servers, including: global configuration, SSH version, Python version, \f[C]rsync\f[] version, as well as current configuration and status of all servers. .RS .RE .TP .B backup \f[I]SERVER_NAME\f[] Perform a backup of \f[C]SERVER_NAME\f[] using parameters specified in the configuration file. Specify \f[C]all\f[] as \f[C]SERVER_NAME\f[] to perform a backup of all the configured servers. .RS .TP .B \-\-immediate\-checkpoint forces the initial checkpoint to be done as quickly as possible. Overrides value of the parameter \f[C]immediate_checkpoint\f[], if present in the configuration file. .RS .RE .TP .B \-\-no\-immediate\-checkpoint forces to wait for the checkpoint. Overrides value of the parameter \f[C]immediate_checkpoint\f[], if present in the configuration file. .RS .RE .TP .B \-\-reuse\-backup [INCREMENTAL_TYPE] Overrides \f[C]reuse_backup\f[] option behaviour. Possible values for \f[C]INCREMENTAL_TYPE\f[] are: .RS .IP \[bu] 2 \f[I]off\f[]: do not reuse the last available backup; .IP \[bu] 2 \f[I]copy\f[]: reuse the last available backup for a server and create a copy of the unchanged files (reduce backup time); .IP \[bu] 2 \f[I]link\f[]: reuse the last available backup for a server and create a hard link of the unchanged files (reduce backup time and space); .PP \f[C]link\f[] is the default target if \f[C]\-\-reuse\-backup\f[] is used and \f[C]INCREMENTAL_TYPE\f[] is not explicited. .RE .TP .B \-\-retry\-times Number of retries of base backup copy, after an error. Used during both backup and recovery operations. Overrides value of the parameter \f[C]basebackup_retry_times\f[], if present in the configuration file. .RS .RE .TP .B \-\-no\-retry Same as \f[C]\-\-retry\-times\ 0\f[] .RS .RE .TP .B \-\-retry\-sleep Number of seconds of wait after a failed copy, before retrying. Used during both backup and recovery operations. Overrides value of the parameter \f[C]basebackup_retry_sleep\f[], if present in the configuration file. .RS .RE .RE .TP .B list\-backup \f[I]SERVER_NAME\f[] Show available backups for \f[C]SERVER_NAME\f[]. This command is useful to retrieve a backup ID. For example: .RS .RE .IP .nf \f[C] servername\ 20111104T102647\ \-\ Fri\ Nov\ \ 4\ 10:26:48\ 2011\ \-\ Size:\ 17.0\ MiB\ \-\ WAL\ Size:\ 100\ B \f[] .fi .IP .nf \f[C] In\ this\ case,\ *20111104T102647*\ is\ the\ backup\ ID. \f[] .fi .TP .B show\-backup \f[I]SERVER_NAME\f[] \f[I]BACKUP_ID\f[] Show detailed information about a particular backup, identified by the server name and the backup ID. See the Backup ID shortcuts (#shortcuts) section below for available shortcuts. For example: .RS .RE .IP .nf \f[C] 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) \f[] .fi .TP .B list\-files \f[I][OPTIONS]\f[] \f[I]SERVER_NAME\f[] \f[I]BACKUP_ID\f[] List all the files in a particular backup, identified by the server name and the backup ID. See the Backup ID shortcuts (#shortcuts) section below for available shortcuts. .RS .TP .B \-\-target \f[I]TARGET_TYPE\f[] Possible values for TARGET_TYPE are: .RS .IP \[bu] 2 \f[I]data\f[]: lists just the data files; .IP \[bu] 2 \f[I]standalone\f[]: lists the base backup files, including required WAL files; .IP \[bu] 2 \f[I]wal\f[]: lists all the WAL files between the start of the base backup and the end of the log / the start of the following base backup (depending on whether the specified base backup is the most recent one available); .IP \[bu] 2 \f[I]full\f[]: same as data + wal. .PP The default value is \f[C]standalone\f[]. .RE .RE .TP .B rebuild\-xlogdb \f[I]SERVER_NAME\f[] Perform a rebuild of the WAL file metadata for \f[C]SERVER_NAME\f[] (or every server, using the \f[C]all\f[] shortcut) guessing it from the disk content. The metadata of the WAL archive is contained in the \f[C]xlog.db\f[] file, and every Barman server has its own copy. .RS .RE .TP .B recover \f[I][OPTIONS]\f[] \f[I]SERVER_NAME\f[] \f[I]BACKUP_ID\f[] \f[I]DESTINATION_DIRECTORY\f[] Recover a backup in a given directory (local or remote, depending on the \f[C]\-\-remote\-ssh\-command\f[] option settings). See the Backup ID shortcuts (#shortcuts) section below for available shortcuts. .RS .TP .B \-\-target\-tli \f[I]TARGET_TLI\f[] Recover the specified timeline. .RS .RE .TP .B \-\-target\-time \f[I]TARGET_TIME\f[] Recover to the specified time. .RS .PP You can use any valid unambiguous representation (e.g: "YYYY\-MM\-DD HH:MM:SS.mmm"). .RE .TP .B \-\-target\-xid \f[I]TARGET_XID\f[] Recover to the specified transaction ID. .RS .RE .TP .B \-\-target\-name \f[I]TARGET_NAME\f[] Recover to the named restore point previously created with the \f[C]pg_create_restore_point(name)\f[] (for PostgreSQL 9.1 and above users). .RS .RE .TP .B \-\-exclusive Set target xid to be non inclusive. .RS .RE .TP .B \-\-tablespace \f[I]NAME:LOCATION\f[] Specify tablespace relocation rule. .RS .RE .TP .B \-\-remote\-ssh\-command \f[I]SSH_COMMAND\f[] This options activates remote recovery, by specifying the secure shell command to be launched on a remote host. This is the equivalent of the "ssh_command" server option in the configuration file for remote recovery. Example: \[aq]ssh postgres\@db2\[aq]. .RS .RE .TP .B \-\-retry\-times \f[I]RETRY_TIMES\f[] Number of retries of data copy during base backup after an error. Overrides value of the parameter \f[C]basebackup_retry_times\f[], if present in the configuration file. .RS .RE .TP .B \-\-no\-retry Same as \f[C]\-\-retry\-times\ 0\f[] .RS .RE .TP .B \-\-retry\-sleep Number of seconds of wait after a failed copy, before retrying. Overrides value of the parameter \f[C]basebackup_retry_sleep\f[], if present in the configuration file. .RS .RE .RE .TP .B get\-wal \f[I][OPTIONS]\f[] \f[I]SERVER_NAME\f[] \f[I]WAL_ID\f[] Retrieve a WAL file from the \f[C]xlog\f[] archive of a given server. By default, the requested WAL file, if found, is returned as uncompressed content to \f[C]STDOUT\f[]. The following options allow users to change this behaviour: .RS .TP .B \-o \f[I]OUTPUT_DIRECTORY\f[] destination directory where the \f[C]get\-wal\f[] will deposit the requested WAL .RS .RE .TP .B \-z output will be compressed using gzip .RS .RE .TP .B \-j output will be compressed using bzip2 .RS .RE .TP .B \-p \f[I]SIZE\f[] peek from the WAL archive up to \f[I]SIZE\f[] WAL files, starting from the requested one. \[aq]SIZE\[aq] must be an integer >= 1. When invoked with this option, get\-wal returns a list of zero to \[aq]SIZE\[aq] WAL segment names, one per row. .RS .RE .RE .TP .B switch\-xlog \f[I]SERVER_NAME\f[] Execute pg_switch_xlog() on the target server .RS .TP .B \-\-force Forces the switch by executing CHECKPOINT before pg_switch_xlog(). \f[I]IMPORTANT:\f[] executing a CHECKPOINT might increase I/O load on a PostgreSQL server. Use this option with care. .RS .RE .TP .B \-\-archive Wait for one xlog file to be archived. If after a defined amount of time (default: 30 seconds) no xlog file is archived, Barman will teminate with failure exit code. .RS .RE .TP .B \-\-archive\-timeout \f[I]TIMEOUT\f[] Specifies the amount of time in seconds (default: 30 seconds) the archiver will wait for a new xlog file to be archived before timing out. .RS .RE .RE .TP .B receive\-wal \f[I]SERVER_NAME\f[] Start the stream of transaction logs for a server. The process relies on \f[C]pg_receivexlog\f[] to receive WAL files from the PostgreSQL servers through the streaming protocol. .RS .TP .B \-\-stop stop the receive\-wal process for the server .RS .RE .TP .B \-\-reset reset the status of receive\-wal, restarting the streaming from the current WAL file of the server .RS .RE .TP .B \-\-create\-slot create the physical replication slot configured with the \f[C]slot_name\f[] configuration parameter .RS .RE .TP .B \-\-drop\-slot drop the physical replication slot configured with the \f[C]slot_name\f[] configuration parameter .RS .RE .RE .TP .B delete \f[I]SERVER_NAME\f[] \f[I]BACKUP_ID\f[] Delete the specified backup. Backup ID shortcuts (#shortcuts) section below for available shortcuts. .RS .RE .TP .B replication\-status \f[I][OPTIONS]\f[] \f[I]SERVER_NAME\f[] 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: .RS .TP .B \-\-minimal machine readable output (default: False) .RS .RE .TP .B \-\-target \f[I]TARGET_TYPE\f[] Possible values for TARGET_TYPE are: .RS .IP \[bu] 2 \f[I]hot\-standby\f[]: lists only hot standby servers .IP \[bu] 2 \f[I]wal\-streamer\f[]: lists only WAL streaming clients, such as pg_receivexlog .IP \[bu] 2 \f[I]all\f[]: any streaming client (default) .RE .RE .SH BACKUP ID SHORTCUTS .PP Rather than using the timestamp backup ID, you can use any of the following shortcuts/aliases to identity a backup for a given server: .TP .B first Oldest available backup for that server, in chronological order. .RS .RE .TP .B last Latest available backup for that server, in chronological order. .RS .RE .TP .B latest same ast \f[I]last\f[]. .RS .RE .TP .B oldest same ast \f[I]first\f[]. .RS .RE .SH EXIT STATUS .TP .B 0 Success .RS .RE .TP .B Not zero Failure .RS .RE .SH SEE ALSO .PP \f[C]barman\f[] (5). .SH BUGS .PP Barman has been extensively tested, and is currently being used in several production environments. However, we cannot exclude the presence of bugs. .PP Any bug can be reported via the Sourceforge bug tracker. Along the bug submission, users can provide developers with diagnostics information obtained through the \f[C]barman\ diagnose\f[] command. .SH AUTHORS .PP In alphabetical order: .IP \[bu] 2 Gabriele Bartolini (project leader) .IP \[bu] 2 Jonathan Battiato (QA/testing) .IP \[bu] 2 Stefano Bianucci (developer, intern from University of Florence) .IP \[bu] 2 Giuseppe Broccolo (QA/testing) .IP \[bu] 2 Giulio Calacoci (developer) .IP \[bu] 2 Francesco Canovai (QA/testing) .IP \[bu] 2 Leonardo Cecchi (developer) .IP \[bu] 2 Gianni Ciolli (QA/testing) .IP \[bu] 2 Britt Cole (documentation) .IP \[bu] 2 Marco Nenciarini (lead developer) .IP \[bu] 2 Rubens Souza (QA/testing) .PP Past contributors: .IP \[bu] 2 Carlo Ascani .SH RESOURCES .IP \[bu] 2 Homepage: .IP \[bu] 2 Documentation: .IP \[bu] 2 Professional support: .SH COPYING .PP Barman is the property of 2ndQuadrant Italia and its code is distributed under GNU General Public License v3. .PP Copyright (C) 2011\-2016 2ndQuadrant Italia Srl \- . .SH AUTHORS 2ndQuadrant Italy .