Barman & REPMGR standby clone fails from PGSQL Server

24 views
Skip to first unread message

Domagoj Batinic

unread,
Jan 26, 2023, 4:55:55 AM1/26/23
to Barman, Backup and Recovery Manager for PostgreSQL
Hello Barman team,

Barman & REPMGR are great toos, WELL DONE!!

I have a PGSQL cluster - PRIMARY, BACKUP AND WITNESS
I am using WITNNES as BARMAN server and WALL storage.

I did integration REPMGR and BARMAN, this is repmgr.conf on my STANDBY:

 # Barman options
#------------------------------------------------------------------------------

barman_server='ZX-PGSQL-DB2'                   
barman_host='bar...@10.7.70.114'                             
barman_config='/etc/barman.conf'                      


Passwordless ssh is working in both ways:

SSH to BARMAN/WITNESS from standby:

-bash-4.2$ ssh 'bar...@10.7.70.114'
Last login: Wed Jan 25 20:22:08 2023 from 10.7.70.111
-bash-4.2$ hostname
ZX-PGSQL-WITNESS


SSH to STANDBY from BARMAN/WITNESS:

-bash-4.2$ ssh 'post...@10.7.70.112'
Last login: Thu Jan 26 10:46:35 2023
-bash-4.2$ hostname
ZX-PGSQL-DB2


Barman can DO backups of servers , here is output for STANDBY

[root@ZX-PGSQL-WITNESS 14]# barman check ZX-PGSQL-DB2
Server ZX-PGSQL-DB2:
        PostgreSQL: OK
        superuser or standard user with backup privileges: OK
        wal_level: OK
        directories: OK
        retention policy settings: OK
        backup maximum age: OK (no last_backup_maximum_age provided)
        backup minimum size: OK (494.0 MiB)
        wal maximum age: OK (no last_wal_maximum_age provided)
        wal size: OK (529.7 MiB)
        compression settings: OK
        failed backups: OK (there are 0 failed backups)
        minimum redundancy requirements: OK (have 2 backups, expected at least 0)
        ssh: OK (PostgreSQL server)
        systemid coherence: OK
        archive_mode: OK
        archive_command: OK
        continuous archiving: OK
        archiver errors: OK


But when I try to standby clone from STANDBY using BARMAN I get this error on STANDBY:

-bash-4.2$ repmgr -h 10.7.70.101 -U repmgr -d repmgr -f /etc/repmgr/14/repmgr.conf standby clone --dry-run
NOTICE: destination directory "/db-storage/pgsql/data" provided
INFO: connecting to Barman server to verify backup for "ZX-PGSQL-DB2"
INFO: valid backup for server "ZX-PGSQL-DB2" found in the Barman catalogue
INFO: connecting to Barman server to fetch server parameters
ERROR: unable to fetch server parameters from Barman server
DETAIL: command executed was:
  ssh bar...@10.7.70.114 barman --config=/etc/barman.conf show-server ZX-PGSQL-DB2 > /dev/null
-bash-4.2$

This is error from BARMAN when I try to standby clone from STANDBY server:

2023-01-26 10:41:37,863 [14840] barman.output ERROR: The ConsoleOutputWriter writer does not support the "show_server" command
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/barman/output.py", line 329, in result
    _dispatch(_writer, "result", command, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/barman/output.py", line 198, in _dispatch
    return handler(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/barman/output.py", line 1082, in result_show_server
    self.info("\t%s: %s", status, message)
  File "/usr/lib/python2.7/site-packages/barman/output.py", line 465, in info
    self._out(message, args)
  File "/usr/lib/python2.7/site-packages/barman/output.py", line 429, in _out
    self._print(message, args, sys.stdout)
  File "/usr/lib/python2.7/site-packages/barman/output.py", line 416, in _print
    encoded_msg = redact_passwords(_format_message(message, args)).encode("utf-8")
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 14: ordinal not in range(128)


When I try to execute ssh with show-server command from STANDBY server i get this:

-bash-4.2$ ssh bar...@10.7.70.114 barman --config=/etc/barman.conf show-server ZX-PGSQL-DB2
Server ZX-PGSQL-DB2:
        active: True
        archive_command: /usr/bin/barman-wal-archive -U barman 10.7.70.114 ZX-PGSQL-DB2 %p
        archive_mode: on
        archive_timeout: 0
        archived_count: 0
        archiver: True
        archiver_batch_size: 0
        backup_compression: None
        backup_compression_format: None
        backup_compression_level: None
        backup_compression_location: None
        backup_compression_workers: None
        backup_directory: /db-storage/barman-backups/ZX-PGSQL-DB2
        backup_method: rsync
        backup_options: BackupOptions(['concurrent_backup'])
        bandwidth_limit: None
        barman_home: /db-storage/barman-backups
        barman_lock_directory: /db-storage/barman-backups
        basebackup_retry_sleep: 30
        basebackup_retry_times: 0
        basebackups_directory: /db-storage/barman-backups/ZX-PGSQL-DB2/base
        check_timeout: 30
        checkpoint_timeout: 300
        compression: gzip
        config_file: /db-storage/pgsql/data/postgresql.conf
        conninfo: host=10.7.70.112 user=postgres port=5432 password=*REDACTED*  create_slot: manual
        current_archived_wals_per_second: 0E-20
        current_lsn: 2/6066FD40
        current_size: 852175727
        current_xlog: None
        custom_compression_filter: None
        custom_compression_magic: None
        custom_decompression_filter: None
        data_checksums: off
        data_directory: /db-storage/pgsql/data
EXCEPTION: The ConsoleOutputWriter writer does not support the "show_server" command
-bash-4.2$

I looks like this EXCEPTION: The ConsoleOutputWriter writer does not support the "show_server" is stopping Barman to finish process.

Can you please help or advise.

Thank you and regards

Domagoj

Domagoj Batinic

unread,
Jan 26, 2023, 8:44:31 AM1/26/23
to Barman, Backup and Recovery Manager for PostgreSQL
P.S

REPMGR version is

-bash-4.2$ repmgr -V
repmgr 5.3.2


BARMAN version is
[root@ZX-PGSQL-WITNESS barman.d]# barman -v
3.3.0 Barman by EnterpriseDB (www.enterprisedb.com)

Regards

Domagoj

Mike Wallace

unread,
Jan 26, 2023, 3:53:53 PM1/26/23
to pgba...@googlegroups.com
Hi Domagoj,

Thanks for the detailed report - the fact that Barman logs `EXCEPTION:
The ConsoleOutputWriter writer does not support the "show_server"
command` is due to some buggy exception handling [1] where any
ValueError is taken to mean "the output writer does not support the
command", the issue being that UnicodeDecodeError is a subclass of
ValueError.

The underlying error here is: `UnicodeDecodeError: 'ascii' codec can't
decode byte 0xe2 in position 14: ordinal not in range(128)`. I suspect
there's a Barman bug here since it should be using utf-8 rather than
ascii, however you can work around it for now by removing any
non-ascii characters. Going by the last field which was successfully
printed I'd guess that the `description` field contains the 0xe2
character.

I have filed https://github.com/EnterpriseDB/barman/issues/739 for the
ascii decoding issue.

Hope this helps,

Michael

[1]: https://github.com/EnterpriseDB/barman/blob/master/barman/output.py#L330-L335
> --
> --
> You received this message because you are subscribed to the "Barman for PostgreSQL" group.
> To post to this group, send email to pgba...@googlegroups.com
> To unsubscribe from this group, send email to
> pgbarman+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/pgbarman?hl=en?hl=en-GB
>
> ---
> You received this message because you are subscribed to the Google Groups "Barman, Backup and Recovery Manager for PostgreSQL" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pgbarman+u...@googlegroups.com.
> To view this discussion on the web, visit https://groups.google.com/d/msgid/pgbarman/7923af5c-5f44-4421-8190-2a7cdc707e07n%40googlegroups.com.

Domagoj Batinic

unread,
Feb 10, 2023, 3:15:45 AM2/10/23
to Barman, Backup and Recovery Manager for PostgreSQL
Thank you, and yes it was  non-ascii in barman conf server Description field:

[ZXPGSQLDB1]
description = 'ZXPGSQLDB1'
ssh_command = ssh postgres@

changed to:

[ZXPGSQLDB1]
description = ZXPGSQLDB1
ssh_command = ssh postgres@


And now it is working.

Regards.

Domagoj
Reply all
Reply to author
Forward
0 new messages