skip to content

Barman

EnterpriseDB's Barman centralises base backups and WAL archiving for many PostgreSQL servers over rsync or pg_basebackup, with barman-cloud for object storage. Interviewers compare it with pgBackRest.

on this pageshow

explore

questions

6

In Barman, how do backup_method = rsync and backup_method = postgres differ, and how would you choose between them for a server?

level: middleimportance: must knowfreq 52%

answer

  1. low-level API versus pg_basebackup
  2. SSH versus a replication connection
  3. hard links versus WAL summaries
  4. parallel_jobs on one side only
  5. which one is still the default

basics

~20 s

backup_method = rsync, still the default, starts a backup through PostgreSQL's low-level API and copies files with rsync over SSH, offering parallel_jobs and hard-link incrementals. backup_method = postgres runs pg_basebackup over a replication connection, needs no SSH, and supports PostgreSQL 17+ block-level incrementals.

solid answer

~40 s

With `rsync`, still Barman's default, Barman starts a non-exclusive backup through the low-level API over `conninfo` and copies `PGDATA` and tablespaces with rsync over `ssh_command`. That buys `parallel_jobs`, per-tablespace bandwidth limits and `reuse_backup = link`, a file-level incremental where unchanged files are hard links and every backup stays self-contained. With `postgres`, Barman runs `pg_basebackup` over `streaming_conninfo`: paired with `streaming_archiver` it needs no SSH at all, it offers `backup_compression`, and `barman backup --incremental` gives block-level incrementals on PostgreSQL 17 or later with `summarize_wal = on`, at the price of a backup chain. The docs recommend `postgres` for most servers; choose `rsync` when parallel copy and independent backups matter on a very large cluster. Either way, keep one method per Barman server and create a new server section to switch.

code

ini · 15 lines
ini
[telemetry-pg]
backup_method = rsync
ssh_command = ssh postgres@telemetry-db
conninfo = host=telemetry-db user=barman dbname=postgres
reuse_backup = link
parallel_jobs = 4
archiver = on

[ticketing-pg]
backup_method = postgres
conninfo = host=ticketing-db user=barman dbname=postgres
streaming_conninfo = host=ticketing-db user=streaming_barman dbname=postgres
streaming_archiver = on
slot_name = barman_ticketing
create_slot = auto

go deeper

for a junior

Remember the two values, which tool each uses to copy files, and that rsync is still the default.

for a middle

Explain the transport, the incremental model and the extra options of each method, including what summarize_wal and reuse_backup do.

for a senior

Argue a choice per server from size, backup window, network rules and how a backup chain changes deletion and retention.

for a principal

Weigh standardising one method across an estate against per-server tuning, including the cost of migrating servers between methods.

## Two ways to copy a cluster Barman's `backup_method` option decides how a **base backup** (a full physical copy of the data directory) gets from the PostgreSQL host to the Barman host. The two remote methods are `rsync` and `postgres`; `local-rsync`, `snapshot` and, since Barman 3.18, `local-to-cloud` cover special cases. **`rsync` is still the default** when the option is not set, even though the documentation calls the streaming method the usual recommendation. Answers here assume Barman 3.20 protecting PostgreSQL 18. ## `backup_method = rsync` 1. Barman connects with `conninfo` and starts a **concurrent** (non-exclusive) backup through PostgreSQL's low-level API, `pg_backup_start()` on PostgreSQL 15 and later. 2. It copies `PGDATA` and every tablespace with rsync, over the SSH connection in `ssh_command` (the `barman` user logging in as `postgres`). 3. It stops the backup, forces a WAL switch so the last needed segment is archived, and runs integrity checks. What it offers: - **`parallel_jobs`**: several rsync workers copy at once (rsync method only). - **`tablespace_bandwidth_limit`**: throttling per tablespace (rsync method only). - **`reuse_backup = link`**: a **file-level incremental**. Barman hard-links every file unchanged since the previous backup and copies only changed files, so disk and time shrink while each backup remains complete on its own. Deleting an old backup never breaks a newer one; shared files stay until the last backup using them goes. WAL still has to reach Barman separately, usually through `archive_command` with `barman-wal-archive`, which is why classic rsync setups need SSH in both directions. ## `backup_method = postgres` Barman runs `pg_basebackup` over `streaming_conninfo`, a replication-protocol connection (a `replication` line in `pg_hba.conf`, a role with `REPLICATION`). `pg_basebackup` must be installed on the Barman host, ideally the newest version since it is backward compatible; `path_prefix` can point at a specific PostgreSQL `bin` directory. Paired with `streaming_archiver = on` this is the **streaming-only** setup: no SSH for backups or WAL. What it offers: - **`backup_compression`** (`gzip`, `lz4`, `zstd`; the last two need PostgreSQL 15 or later), postgres method only. - **Block-level incrementals** since Barman 3.11: `barman backup --incremental latest-full ticketing-pg` uses PostgreSQL 17's incremental `pg_basebackup`. The server must run 17 or later with `summarize_wal = on` **before** the first full backup, and the parent must itself be a `postgres`-method backup. At restore time Barman rebuilds a full copy with `pg_combinebackup` (`combine_mode` picks copy, link, clone or copy-file-range). - Streaming straight to S3-compatible storage by pointing `basebackups_directory` and `wals_directory` at a cloud URL (documented as experimental). The cost of block-level incrementals is a **chain**: an incremental is useless without its parent, so deleting a parent deletes the whole tree, retention judges the chain by its root, and `barman keep` refuses incrementals. ## Side by side | | `rsync` | `postgres` | |---|---|---| | Copy tool | rsync over SSH | `pg_basebackup` over the replication protocol | | PostgreSQL side | low-level backup API via `conninfo` | replication connection via `streaming_conninfo` | | SSH | required | none, if WAL also streams | | Parallel copy | `parallel_jobs` | one `pg_basebackup` stream | | Incremental | file-level, `reuse_backup = link` | block-level, `--incremental`, PostgreSQL 17+ | | Backup independence | every backup self-contained | incrementals depend on their chain | | Compression | no `backup_compression` | `backup_compression` | ## Choosing - **Default to `postgres` plus `streaming_archiver`** for most servers: no SSH keys to manage, convenient in containers and tightly regulated networks, and block-level deduplication on 17 and later. - **Choose `rsync`** for a very large cluster where parallel copy and per-tablespace throttling cut the backup window, or where you want every backup independent of the others, for example a telemetry database with large, mostly read-only history. - A **hybrid** is allowed: `backup_method = rsync` with `streaming_archiver = on` keeps rsync's features and streams WAL. - **Network rules matter.** `rsync` needs SSH from the Barman host to the database host, and back again if WAL ships through `archive_command`; `postgres` needs only a PostgreSQL replication connection, which is often the easier firewall rule to get approved. - **Restores differ too.** An rsync backup is copied back as plain files, while a block-level incremental is first combined with `pg_combinebackup` into a synthetic full backup, which costs staging disk and time during the restore. - **One method per server.** The docs advise against switching methods in place; add a new server section with the new method, take a full backup there, and retire the old section when its backups expire.

  • What happens in Barman if you delete the full backup that a chain of block-level incrementals depends on?
    `barman delete` warns that the backup has dependent incrementals and deletes the whole tree, because an incremental cannot be restored without its root. Retention likewise judges a chain by its root backup. With rsync and `reuse_backup = link` there is no such dependency: hard-linked files survive until the last backup that uses them is removed.
  • What must be installed on the Barman host for backup_method = postgres?
    The PostgreSQL client binaries Barman calls: `pg_basebackup` for backups and `pg_receivewal` if WAL streams. Use the newest version, since it is backward compatible with older servers, and set `path_prefix` to a specific `bin` directory if several are installed. `barman check` reports `pg_basebackup compatible` when the version is wrong.

  • backup_method = postgres is what Barman uses when nothing is set
  • Barman's rsync method copies a live data directory without telling PostgreSQL
  • reuse_backup = link gives incrementals with backup_method = postgres
  • Barman block-level incrementals work on PostgreSQL 16
  • parallel_jobs speeds up pg_basebackup-based Barman backups

Assumes Barman 3.20 backing up PostgreSQL 18; block-level incrementals need Barman 3.11+ and PostgreSQL 17+, and rsync remains Barman's default backup_method.

open as a page

With Barman, how do you restore the timetable server onto a new host to 09:39, just before a bad import ran at 09:40, and what does barman restore set up?

level: seniorimportance: must knowfreq 48%

basics

~20 s

Run barman restore with --remote-ssh-command to the new host, a backup that ended before 09:39 (or auto), --target-time with an explicit zone and usually --get-wal. Barman copies the files, writes restore_command and the target, creates recovery.signal and disables archive_command; you start PostgreSQL.

open as a page

What is Barman in a PostgreSQL backup setup, and what does running barman check against a newly configured server tell you?

level: juniorimportance: should knowfreq 45%

basics

~20 s

Barman is a backup manager whose one host keeps physical base backups and archived WAL for many PostgreSQL servers. barman check SERVER tests a server's connections, WAL shipping, directories and settings, printing OK or FAILED per line and exiting non-zero on failure.

open as a page

In Barman, how do retention_policy = REDUNDANCY 3 and RECOVERY WINDOW OF 7 DAYS differ, and what actually enforces them?

level: middleimportance: should knowfreq 38%

basics

~20 s

REDUNDANCY 3 keeps the three newest full backups. RECOVERY WINDOW OF 7 DAYS keeps the backups and WAL needed to recover to any moment of the last seven days, including the newest backup before the window. barman cron enforces both; unset means nothing is deleted.

open as a page

In Barman, what is the difference between collecting WAL with archiver = on and with streaming_archiver = on, and when would you enable both?

level: seniorimportance: should knowfreq 40%

basics

~20 s

archiver = on takes completed WAL segments pushed by archive_command, ideally barman-wal-archive, into the incoming directory. streaming_archiver = on runs pg_receivewal through a replication slot, receiving WAL as it is written for a lower RPO. Enabling both adds a fallback; Barman stores each segment once.

open as a page

Using Barman's barman-cloud-* scripts without a Barman server, how do you back up a PostgreSQL server to object storage, and what do you give up?

level: seniorimportance: should knowfreq 30%

basics

~20 s

Install barman-cli-cloud on the PostgreSQL host, set archive_command to barman-cloud-wal-archive, and schedule barman-cloud-backup plus barman-cloud-backup-delete -r for retention. You give up the Barman server: no cron, no barman check, no incrementals, and barman-cloud-restore leaves recovery configuration to you.

open as a page