0

I am using the Alpine docker image for Postgres 16 for this experiment. I have one container which is running and has some tables. I create a second container which is also running but has no tables. I take a basebackup with pg_basebackup of container 1 from inside container 2 (host = container 1). I successfully get the backup in container 2 and pg_verifybackup says it is verified. Then I rename the pgdata directory to pgdata_ini and basebackup directory to pgdata. Then I restart container 2.

The steps followed are as follows:

  1. pg_basebackup -h <postgresdb1_ip> -U postgres -D basebackup
  2. mv pgdata pgdata2
  3. mv basebackup pgdata
  4. chown -R postgres pgdata // to make postgres user of container be owner of backup dir
  5. exit // come out of container
  6. docker restart postgresdb2

All of this so far had worked multiple times without issues but suddenly it has started failing with the following error: WAL file is from different database system (the system identifiers don't match apparently). I have created fresh containers for the entire experiment but to no avail.

Just to clarify, this is not with recovery from archived WALs or PITR, its a simple base backup. Any help would be greatly appreciated!

UPDATES:

If I skip the chown step (step 4), then it works fine. On hindsight, I realised I was not doing this when it was working but considering postgres is the owning user of the current data directory, I don't understand why so any insight on that would be helpful too!

0

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.