Postgresql – barman & Dockerized PostgreSQL: check timeout: FAILED (barman check command timed out)

backupbarmandockerpostgresqlpsql

I am trying to configure barman to backup a PostgreSQL 11 database running inside a Docker container. barman v2.10 is installed directly in the Ubuntu 18.04.3 host machine.

barman check pgsql gives the error:

check timeout: FAILED (barman check command timed out)

Output of barman check pgsql

$ time barman check pgsql
Server pgsql:
    check timeout: FAILED (barman check command timed out)

real    0m36.978s
user    0m0.336s
sys 0m0.025s

However, there's no problem instantly connecting to the same database using the same credentials with psql:

Output of psql

$ psql -h 172.xxx.xxx.xxx -p 5432 -U postgres --dbname=app_development
Password for user postgres: 
psql (11.7 (Ubuntu 11.7-1.pgdg18.04+1), server 11.6)
Type "help" for help.

app_development=# 

Question: What might be the problem here with barman?


/etc/barman.d/pgsql.conf

[pgsql]
description =  "PostgreSQL server"
conninfo = host=172.xxx.xxx.xxx port=5432 user=postgres password=mypassword dbname=app_development
ssh_command = ssh -p 2222 postgres@127.0.0.1
backup_method = rsync
parallel_jobs = 1
reuse_backup = link
archiver = on

/etc/barman.conf

[barman]
barman_home = /var/lib/barman/pg
barman_user = barman

backup_options = exclusive_backup
compression = gzip
network_compression = true
bandwidth_limit = 0
immediate_checkpoint = true
last_backup_maximum_age = 2 DAYS
retention_policy = RECOVERY WINDOW OF 3 MONTHS
minimum_redundancy = 2
log_file = /var/log/barman/barman.log
log_level = DEBUG

/var/log/barman/barman.log

2020-02-19 02:05:58,241 [21079] barman.config DEBUG: Including configuration file: pgsql.conf
2020-02-19 02:05:58,242 [21079] barman.cli DEBUG: Initialised Barman version 2.10 (config: /etc/barman.conf, args: {'color': 'auto', 'quiet': False, 'debug': False, 'format': 'console', 'server_name': ['pgsql'], 'nagios': False, 'command': 'check'})
2020-02-19 02:05:58,249 [21079] barman.server DEBUG: Retention policy for server pgsql: RECOVERY WINDOW OF 3 MONTHS
2020-02-19 02:05:58,249 [21079] barman.server DEBUG: WAL retention policy for server pgsql: MAIN
2020-02-19 02:05:58,250 [21079] barman.server DEBUG: Starting check: 'WAL archive'
2020-02-19 02:05:58,250 [21079] barman.server DEBUG: Starting check: 'empty incoming directory'
2020-02-19 02:05:58,250 [21079] barman.server DEBUG: Starting check: 'empty streaming directory'
2020-02-19 02:05:58,250 [21079] barman.server DEBUG: Starting check: 'PostgreSQL'
2020-02-19 02:06:01,606 [21088] barman.config DEBUG: Including configuration file: pgsql.conf
2020-02-19 02:06:01,607 [21088] barman.cli DEBUG: Initialised Barman version 2.10 (config: /etc/barman.conf, args: {'color': 'auto', 'quiet': True, 'debug': False, 'format': 'console', 'keep_descriptors': False, 'command': 'cron'})
2020-02-19 02:06:01,613 [21088] barman.server DEBUG: Retention policy for server pgsql: RECOVERY WINDOW OF 3 MONTHS
2020-02-19 02:06:01,613 [21088] barman.server DEBUG: WAL retention policy for server pgsql: MAIN
2020-02-19 02:06:01,613 [21088] barman.command_wrappers DEBUG: BarmanSubProcess: ['/usr/bin/python3', '/usr/bin/barman', '-c', '/etc/barman.conf', '-q', 'archive-wal', 'pgsql']
2020-02-19 02:06:01,615 [21088] barman.command_wrappers DEBUG: BarmanSubProcess: subprocess started. pid: 21089
2020-02-19 02:06:01,915 [21089] barman.config DEBUG: Including configuration file: pgsql.conf
2020-02-19 02:06:01,916 [21089] barman.cli DEBUG: Initialised Barman version 2.10 (config: /etc/barman.conf, args: {'color': 'auto', 'quiet': True, 'debug': False, 'format': 'console', 'config': '/etc/barman.conf', 'server_name': 'pgsql', 'command': 'archive_wal'})
2020-02-19 02:06:01,922 [21089] barman.server DEBUG: Retention policy for server pgsql: RECOVERY WINDOW OF 3 MONTHS
2020-02-19 02:06:01,922 [21089] barman.server DEBUG: WAL retention policy for server pgsql: MAIN
2020-02-19 02:06:01,939 [21089] barman.server DEBUG: Starting archive-wal for server pgsql
2020-02-19 02:06:01,939 [21089] barman.wal_archiver INFO: No xlog segments found from file archival for pgsql.
2020-02-19 02:06:35,308 [21079] barman.server DEBUG: Check command timed out executing 'PostgreSQL' check
2020-02-19 02:06:35,309 [21079] barman.server ERROR: Check 'check timeout' failed for server 'pgsql'

Best Answer

Great,

Increase the check timeout.

in /etc/barman.conf

check_timeout = 60