Managing the backup of several PostgreSQL servers with Barman

2 minute read

One of the key aspects of Barman is the possibility to remotely backup multiple PostgreSQL servers from one single backup host. The upcoming version 1.1.2 of Barman will make this much easier from a system administrator’s point of view. Let’s see why.

With Barman you can use the backup host as a simple backup server, and simply store backup data regarding different PostgreSQL version servers. Or plan to use it for recovery as well (local recovery). In this case you need to install every PostgreSQL version for which you need to perform local recovery.

In these first 5 months of Barman’s life, we have received a few requests from users (mainly system administrators) around the world asking to simplify the management of backups for several databases. My personal opinion is that this use case is typical of hosting companies or big organisations.

The upcoming 1.1.2 release of Barman will include the so called configuration files directory setting, which allows system administrators and DBAs to specify a directory that will contain server directives. For example, you can define in Barman’s global configuration section the following option:

configuration_files_directory = /etc/barman.d

This option will make Barman look for *.conf files in that directory and evaluate them on the fly. Suppose you have to manage the backup of 6 or more PostgreSQL instances, you can specify a different file for each of those instances and name it in a meaningful way:

|- /etc
  |- barman.d
    |- 01-angus.conf
    |- 02-malcolm.conf
    |- 03-bon.conf.disabled
    |- 04-brian.conf
    |- 05-phil.conf
    |- 06-chris.conf
    |- ...

Then specify a server configuration in /etc/barman.d/01-angus.conf:

description = Angus Rocks
ssh_command = ssh angus
conninfo = host=angus port=5432 user=postgres dbname=postgres

Adding a new server or disabling/removing a server becomes as trivial as adding a new file or renaming it.

If you type “barman list-server” you get:

angus - Angus Rocks
brian - Brian screams
chris - Chris on the bass

This behaviour is quite spread on Linux applications and allows to improve the integration of Barman with configuration managers such as Puppet.

More information on this feature is available in the online documentation of Barman, in the basic configuration section.

Another interesting feature added in version 1.1.2 is the shortcut ID for backups. Barman now manages shortcut aliases for backup identifiers such as latest/last or oldest/first.

This means that you can now type “barman delete SERVER_ID oldest” and easily delete the oldest backup available for that server, or type “barman show-backup SERVER_ID latest” to get information about the latest backup available for that server. Cool, isn’t it? 😉

So, stay tuned for version 1.1.2! Ciao!