Barman on OSX - barman-wal-archive fails with exit code 127

397 views
Skip to first unread message

Marc

unread,
Aug 3, 2023, 4:32:21 AM8/3/23
to Barman, Backup and Recovery Manager for PostgreSQL
Hello,

I have set up a Barman server on a macOS Ventura (13.5) with MacPorts.
The primary PostgreSQL server is running on a different machine with macOS Monterey (12.6).

On the Barman machine, I see WAL files being added to the "streaming" directory, but the PostgreSQL server keeps logging the following error:

2023-08-03 10:20:42.049 CEST [36006] FATAL:  archive command failed with exit code 127
2023-08-03 10:20:42.049 CEST [36006] DETAIL:  The failed archive command was: barman-wal-archive 192.163.1.38 192.163.1.31 pg_wal/0000000100000017000000DD.00000028.backup


The PostgreSQL server (ip .31) has these settings in the PG config:

wal_level = replica
max_wal_senders = 10
max_replication_slots = 10
archive_mode = on
archive_command = 'barman-wal-archive 192.163.1.38 192.163.1.31 %p'


And on the Barman server (ip .38), the barman.d config is:

[pg]
description = "Postgres 31 Server"
conninfo = host=192.163.1.31 user=barman dbname=postgres port=49165 password=xxxx
streaming_conninfo = host=192.163.1.31 user=streaming_barman dbname=postgres port=49165 password=xxxx
backup_method = postgres
streaming_archiver = on
slot_name = barman
archiver = on


Any idea what is causing the error in the Postgres log?
This is my first time setting up WAL archiving, so Barman is all new to me.

Luca Ferrari

unread,
Aug 3, 2023, 8:48:45 AM8/3/23
to pgba...@googlegroups.com
On Thu, Aug 3, 2023 at 10:32 AM 'Marc' via Barman, Backup and Recovery
Manager for PostgreSQL <pgba...@googlegroups.com> wrote:
>
> Hello,
>
> I have set up a Barman server on a macOS Ventura (13.5) with MacPorts.
> The primary PostgreSQL server is running on a different machine with macOS Monterey (12.6).
>
> On the Barman machine, I see WAL files being added to the "streaming" directory, but the PostgreSQL server keeps logging the following error:
>
> 2023-08-03 10:20:42.049 CEST [36006] FATAL: archive command failed with exit code 127
> 2023-08-03 10:20:42.049 CEST [36006] DETAIL: The failed archive command was: barman-wal-archive 192.163.1.38 192.163.1.31 pg_wal/0000000100000017000000DD.00000028.backup

executing the very same command from an interactive shell could give
you some hints: barman-wal-archive 192.163.1.38 192.163.1.31
pg_wal/0000000100000017000000DD.00000028.backup
Of course, the command has to be executed as the barman operating system user.
Could it be a connection problem?


Luca

Marc

unread,
Aug 3, 2023, 9:24:42 AM8/3/23
to Barman, Backup and Recovery Manager for PostgreSQL
When I execute the command on the Barman server (ip .38), I get the following:

% sudo -u barman barman-wal-archive 192.163.1.38 192.163.1.31 pg_wal/0000000100000017000000DD.00000028.backup 

ERROR: Error executing ssh: [Errno 2] No such file or directory: 'pg_wal/0000000100000017000000DD.00000028.backup'


On the Postgres server (ip .31), the file is present in the data/pg_wal directory.

Am I doing this correctly? The barman-wal-archive should be executed on the Barman server, right?

Luca Ferrari

unread,
Aug 3, 2023, 10:24:58 AM8/3/23
to pgba...@googlegroups.com
On Thu, Aug 3, 2023 at 3:24 PM 'Marc' via Barman, Backup and Recovery
Manager for PostgreSQL <pgba...@googlegroups.com> wrote:
>
> When I execute the command on the Barman server (ip .38), I get the following:
>
> % sudo -u barman barman-wal-archive 192.163.1.38 192.163.1.31 pg_wal/0000000100000017000000DD.00000028.backup
>

You need to execute the command from the PostgreSQL machine, within
the PGDATA directory. The archive command is execute from PostgreSQL
to the backup machine, not viceversa.

Luca

Marc

unread,
Aug 4, 2023, 3:14:58 AM8/4/23
to Barman, Backup and Recovery Manager for PostgreSQL
On Thursday, August 3, 2023 at 4:24:58 PM UTC+2 Luca Ferrari wrote:

You need to execute the command from the PostgreSQL machine, within
the PGDATA directory. The archive command is execute from PostgreSQL
to the backup machine, not viceversa.

Luca

The PostgreSQL machine does not have barman installed.
According to the Barman FAQ: "... barman does not necessarily require to be on the same host where PostgreSQL is running. It is your choice to install it locally or on another server  ..."

Is it possible to use the barman-wal-archive feature without installing barman on the host? I would like to keep the primary PostgreSQL server as clean as possible, and not have to install MacPorts or any developer tools.

Luca Ferrari

unread,
Aug 4, 2023, 4:07:42 AM8/4/23
to pgba...@googlegroups.com
On Fri, Aug 4, 2023 at 9:15 AM 'Marc' via Barman, Backup and Recovery
Manager for PostgreSQL <pgba...@googlegroups.com> wrote:
>
> The PostgreSQL machine does not have barman installed.
> According to the Barman FAQ: "... barman does not necessarily require to be on the same host where PostgreSQL is running. It is your choice to install it locally or on another server ..."
>
> Is it possible to use the barman-wal-archive feature without installing barman on the host? I would like to keep the primary PostgreSQL server as clean as possible, and not have to install MacPorts or any developer tools.
>

I'm not sure that you can use barman to archive wals from a remote machine.
Barman could not be installed on the PostgreSQL machine, in which case
you need to use a custom archive_command like for instance scp or
something like that. If you want to use barman-wal-archive you need to
install it on the PostgreSQL machine, because that command will send
the wals to the remote barman repository. If I remember correctly,
there is a separate package called barman-cli or something like that
that installs only those commands that are required on the PostgreSQL
side.

Hope this helps.

Luca
Reply all
Reply to author
Forward
0 new messages