moving issue from https://github.com/docker-library/official-images/issues/1020
I'd love to be able to use docker exec to initiate a pg_basebackup that would save a tar.gz backup in a directory on the exposed volume so that I can offsite backups from the container.
I added the following to pg_hba.conf:
local replication all md5
host replication all 0.0.0.0/0 md5
But then it needed more configuration with max_wal_senders, and wal_level in postgresql.conf:
-#wal_level = minimal
+wal_level = archive
...
-#max_wal_senders = 0
+max_wal_senders = 2
And then this will work:
$ docker exec some-postgres sh -c 'PGPASSWORD="$POSTGRES_PASSWORD" exec pg_basebackup -h "$POSTGRES_PORT_5432_TCP_ADDR" -p "$POSTGRES_PORT_5432_TCP_PORT" -U postgres -D /dir/to/save/ -X s'
Is there any reason this isn't fixed yet? Seems straight forward.
Related #55.
It's not fixed because it's not really a bug -- using "pg_basebackup" with
this image requires some configuration tweaks, just like a normal install
(as @yosifkit has noted above).
I didn't want to imply it's a bug, fix as in something to close this 'issue'. :)
Fair enough, but IMO allowing replication by default shouldn't harm and make configuration tweaks easier? That's why I actually came here. Basically just adding this line host replication replication all md5
Closing, given that this is working as intended -- as documented by upstream, pg_basebackup requires configuration changes in order to work.
Most helpful comment
I added the following to
pg_hba.conf:But then it needed more configuration with
max_wal_senders, andwal_levelinpostgresql.conf:And then this will work: