I am using barman 2.11 and postgres 9.5 in my setup. I specified "create_slot = auto" in the server config for automatic replication slot creation as mentioned in the docs but it unfortunately appears to have no effect & the barman check reports the issue as below,
My server config:
[postgres-source-db]
; Configuration options for the server named 'postgres-source-db'
description = "Config for PostgreSQL Database Backup via rsync/SSH with WAL streaming"
ssh_command = ssh -q postgres@postgres-source-db
conninfo = host=postgres-source-db user=barman dbname=dcmdb
backup_method = rsync
parallel_jobs = 1
reuse_backup = link
archiver = on
backup_options = exclusive_backup
streaming_conninfo = host=postgres-source-db user=barman
streaming_archiver = on
slot_name = barman
create_slot = auto
===
Barman check output:
barman@4f5c93878899:~$ barman check postgres-source-db
Server postgres-source-db:
WAL archive: FAILED (please make sure WAL shipping is setup)
PostgreSQL: OK
superuser or standard user with backup privileges: OK
PostgreSQL streaming: OK
wal_level: OK
replication slot: FAILED (replication slot 'barman' doesn't exist. Please execute 'barman receive-wal --create-slot postgres-source-db')
directories: OK
retention policy settings: OK
backup maximum age: FAILED (interval provided: 1 day, latest backup age: No available backups)
compression settings: OK
failed backups: OK (there are 0 failed backups)
minimum redundancy requirements: FAILED (have 0 backups, expected at least 1)
ssh: OK (PostgreSQL server)
not in recovery: OK
systemid coherence: OK (no system Id stored on disk)
pg_receivexlog: OK
pg_receivexlog compatible: OK
receive-wal running: FAILED (See the Barman log file for more details)
archive_mode: OK
archive_command: OK
archiver errors: OK
barman@4f5c93878899:~$
I should note that the test check succeeds as shown below,
barman@4f5c93878899:~$ psql -U barman -h postgres-source-db -c "IDENTIFY_SYSTEM" replication=1
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
systemid | timeline | xlogpos | dbname
---------------------+----------+-----------+--------
6854705426793291833 | 1 | 0/3000AE0 |
(1 row)
barman@4f5c93878899:~$
Am i missing something?
UPDATE (made partial headway, but still not out of the woods):
One more update & info to add. I am setting this up on docker containers & notice that the cron setup was missing despite my installing this from the PostgreSQL apt-repository. Once i logged into the container & ran
'/usr/bin/barman -q cron'
to start the WAL receiver i see that the status has changed to success. Not sure why it did not run automatically, any clue?
Doesn't look like a permission issue but the syntax of the content in '/etc/cron.d/barman'
seems strange to me,
barman@bef22f0beec3:~$ cat /etc/cron.d/barman
# /etc/cron.d/barman: crontab entries for the barman package
MAILTO=root
* * * * * barman [ -x /usr/bin/barman ] && /usr/bin/barman -q cron
barman@bef22f0beec3:~$
Below are the terminal outputs,
barman@4f5c93878899:~$ crontab -l
no crontab for barman
barman@4f5c93878899:~$ su root
Password:
root@4f5c93878899:/var/lib/barman# crontab -l
no crontab for root
root@4f5c93878899:/var/lib/barman# exit
exit
barman@4f5c93878899:~$ id
uid=102(barman) gid=103(barman) groups=103(barman)
barman@4f5c93878899:~$ pwd
/var/lib/barman
barman@4f5c93878899:~$ cat /etc/cron.d/barman
# /etc/cron.d/barman: crontab entries for the barman package
MAILTO=root
* * * * * barman [ -x /usr/bin/barman ] && /usr/bin/barman -q cron
barman@4f5c93878899:~$ ls -ltr /etc/cron.d/barman
-rw-r--r-- 1 root root 140 Jul 9 11:18 /etc/cron.d/barman
barman@4f5c93878899:~$ /usr/bin/barman -q cron
barman@4f5c93878899:~$ ps -aef
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 05:00 ? 00:00:00 /bin/bash /docker-entrypoint.sh barman
root 24 1 0 05:00 ? 00:00:00 /usr/sbin/sshd -D
root 27 24 0 05:03 ? 00:00:00 sshd: barman [priv]
barman 33 27 0 05:03 ? 00:00:00 sshd: barman@pts/0
barman 34 33 0 05:03 pts/0 00:00:00 -bash
barman 107 1 4 05:18 ? 00:00:00 /usr/bin/python3 /usr/bin/barman -c /etc/barman.conf -q receive-wal postgres-source-db
barman 111 107 1 05:18 ? 00:00:00 /usr/lib/postgresql/12/bin/pg_receivewal --dbname=dbname=replication host=postgres-source-db options=-cdatestyle=iso replication=true user=barman application_name
barman 114 34 0 05:18 pts/0 00:00:00 ps -aef
barman@4f5c93878899:~$
barman@4f5c93878899:~$ barman check postgres-source-db
Server postgres-source-db:
PostgreSQL: OK
superuser or standard user with backup privileges: OK
PostgreSQL streaming: OK
wal_level: OK
replication slot: OK
directories: OK
retention policy settings: OK
backup maximum age: FAILED (interval provided: 1 day, latest backup age: No available backups)
compression settings: OK
failed backups: OK (there are 0 failed backups)
minimum redundancy requirements: FAILED (have 0 backups, expected at least 1)
ssh: OK (PostgreSQL server)
not in recovery: OK
systemid coherence: OK (no system Id stored on disk)
pg_receivexlog: OK
pg_receivexlog compatible: OK
receive-wal running: OK
archive_mode: OK
archive_command: OK
continuous archiving: OK
archiver errors: OK
barman@4f5c93878899:~$
Thanks
Just for others that might be facing the same issue, i resolved it.
The problem appears to be due to two bugs in barman (i see it on Debian, not sure of others),
With the above two fixed it works like a charm.