0

I've got Postgres 11.5-alpine running in kubernetes in a leader-follower setup that has been working well using streaming replication for some time.

I've decided to cover my bases by writing the WAL archive to a shared network drive (Azure blob via blobfuse csi driver). The driver is working fine, things are being written to the blob and can be read - great!

Now I've gone to set up my archive_command in the kubernetes yaml using the args key. Inside the args I have the following:

"-c", "archive_mode=on", "-c", "archive_command=/bin/true/"

This works fine and /bin/true is called - deployment works and pods are humming along well. Good stuff!

Now I go to put in the actual WAL archive copy command like so:

"-c", "archive_mode=on", "-c", "archive_command=cp %p /var/walarchive/%f"

And I get the following back from my deployed pod, in the log:

postgres: invalid argument: "\%p" Try "postgres --help" for more information.

I've tried escaping the %p, tried with single quotes either side of the entire command. All result in the same error message.

I suspect that there is something going a little bit wrong with the arg being passed into the containers entrypoint and this is going to be a stupid simple fix. At least I'm hoping so.

Has anyone ran into this issue before?

Chris Berry
  • 101
  • 1
  • As per [docker](https://hub.docker.com/_/postgres): `The Docker Official PostgreSQL image does not support replication. If you pass any replication environment variable, this would be ignored. The only environment variables supported by the Docker Official image are POSTGRES_USER, POSTGRES_DB, POSTGRES_PASSWORD, POSTGRES_INITDB_ARGS, POSTGRES_INITDB_WALDIR and PGDATA.` In [Postgres](https://www.postgresql.org/docs/11/continuous-archiving.html) docs the actual command- `cp pg_wal/00000001000000A900000065 /mnt/server/archivedir/00000001000000A900000065` – Mark Nov 18 '19 at 14:56
  • Hmm that is interesting. I've definitely got streaming replication working between two seperate deployments. – Chris Berry Nov 18 '19 at 16:12
  • I am not postgresql expert but it looks like your args should be set-up in postgresql.conf. As per docs `%p is replaced by the path name of the file to archive, while %f is replaced by only the file name.` – Mark Nov 19 '19 at 09:01

0 Answers0