Re: failed to setup barman backup when Posgres is running in Podman Container

From: kaido vaikla <kaido(dot)vaikla(at)gmail(dot)com>
To: duc hiep ha <haduchiep(at)googlemail(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: failed to setup barman backup when Posgres is running in Podman Container
Date: 2024-01-10 15:57:15
Message-ID: CA+427g8-dQtZknRD6kMhfRm0O+RVVA4L2bu5VgJLS4KfyReUJQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

It's a typical error for brand new setup. After new backup setup do
$ barman switch-xlog --force --archive testdb

br
Kaido

On Wed, 10 Jan 2024 at 15:58, duc hiep ha <haduchiep(at)googlemail(dot)com> wrote:

> Dear All,
>
> I am trying to use Barman to back up PostgreSQL, which is running in a
> Podman container. However, I encounter the error "WAL archive: FAILED," as
> shown below:
>
> #barman check testdb
> Server testdb:
> WAL archive: FAILED (please make sure WAL shipping is set up)
> PostgreSQL: OK
> superuser: OK
> PostgreSQL streaming: OK
> wal_level: OK
> replication slot: 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: OK (have 0 backups, expected at least 0)
> pg_basebackup: OK
> pg_basebackup compatible: OK
> pg_basebackup supports tablespaces mapping: OK
> pg_receivexlog: OK
> pg_receivexlog compatible: OK
> receive-wal running: OK
> archiver errors: OK
>
> I have identified that normally, when the PostgreSQL database is installed
> on a regular VM (not in a container), the archive_command parameter under
> postgresql.conf looks like this:
>
> archive_command = 'rsync -a %p barman(at)barman-backup-server-ip
> :/data/barman/main-db-server/incoming/%f'
>
> However, when PostgreSQL is installed on a Podman container, I cannot use
> the above archive_command because within the PostgreSQL container, it
> doesn't understand rsync, ssh, and the barman user. That's why I have to
> use a normal copy command like:
>
> archive_command = 'cp -i %p /srv/archive/%f'
>
> I then mounted this wal-files folder on
> '/data/barman/main-db-server/incoming/%f'. As a result, all these wal_files
> have the PostgreSQL ownership and not the barman ownership. The barman user
> has no privileges to change these wal-files, which is why the WAL archive
> is marked as FAILED.
>
> Do you know how to solve this issue? do I have to install Barman and
> PostgreSQL in the same Pod container in order to backup PostgreSQL
> container? Or is there another solution to this problem?
>
> Thank you for your support in advance.
>
> Best,
> Ha
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2024-01-10 16:06:31 Re: slightly unexpected result
Previous Message Bruce Momjian 2024-01-10 15:45:59 Re: slightly unexpected result