酒保无法连接:fe_sendauth:未提供密码

Tom*_*art 2 postgresql backup barman

我正在尝试设置到酒保服务器的流复制。

酒保配置非常基本,我正在使用backup_method = postgres.

[barman]
barman_home = /var/lib/barman
barman_user = barman
log_file = /var/log/barman/barman.log
log_level = DEBUG
archiver = true
backup_method = postgres
backup_options = concurrent_backup
compression = gzip
minimum_redundancy = 1
retention_policy = RECOVERY WINDOW OF 7 DAYS
retention_policy_mode = auto
streaming_archiver = true
wal_retention_policy = main
configuration_files_directory = /etc/barman.conf.d
Run Code Online (Sandbox Code Playgroud)

我会调用数据库服务器pg

[pg]
description = "pg"
ssh_command = ssh postgres@pg.example.com
conninfo = user=barman dbname=postgres host=pg.example.com port=5432
Run Code Online (Sandbox Code Playgroud)

我已经配置了 hba 规则并在's home中设置了一个.pgpass文件。barman/var/lib/barman/.pgpass

与服务器的测试连接pg工作正常:

barman@b01:~$ psql -c 'SELECT version()' -U barman -h pg.example.com postgres
                                                             version                                                              
----------------------------------------------------------------------------------------------------------------------------------
 PostgreSQL 10.7 (Debian 10.7-1.pgdg90+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516, 64-bit
(1 row)
Run Code Online (Sandbox Code Playgroud)

然而barman check pg惨败,我不知道为什么:

$ barman check pg
Server pg:
        WAL archive: FAILED (please make sure WAL shipping is setup)
        PostgreSQL: OK
        is_superuser: OK
        PostgreSQL streaming: FAILED (fe_sendauth: no password supplied)
        wal_level: OK
        directories: OK
        retention policy settings: OK
        backup maximum age: OK (no last_backup_maximum_age provided)
        compression settings: OK
        failed backups: OK (there are 0 failed backups)
        minimum redundancy requirements: FAILED (have 0 backups, expected at least 1)
        pg_basebackup: OK
        pg_basebackup compatible: FAILED (PostgreSQL version: None, pg_basebackup version: 11.2-1.pgdg90+1))
        pg_basebackup supports tablespaces mapping: OK
        archive_mode: OK
        archive_command: FAILED (please set it accordingly to documentation)
        pg_receivexlog: OK
        pg_receivexlog compatible: FAILED (PostgreSQL version: None, pg_receivexlog version: 11.2-1.pgdg90+1))
        receive-wal running: FAILED (See the Barman log file for more details)
        archiver errors: OK
Run Code Online (Sandbox Code Playgroud)

有没有更好的方法来调试身份验证问题?.pgpass偶数加载到下面了吗barman check

pg.example.com:5432:postgres:barman:s3cr3tP2ssw0rd
Run Code Online (Sandbox Code Playgroud)

Tom*_*art 6

检查酒吧服务员的源代码后,我意识到酒吧服务员实际上覆盖了该conninfo字符串:

    # Override 'dbname' parameter. This operation is required to mimic
    # the behaviour of pg_receivexlog and pg_basebackup
    self.conn_parameters['dbname'] = 'replication' 
Run Code Online (Sandbox Code Playgroud)

这不是很直观,因此dbnamein.pgpass应该包含replicationdb:

pg.example.com:5432:replication:barman:s3cr3tP2ssw0rd
Run Code Online (Sandbox Code Playgroud)