I have two docker containers running on two different docker hosts.

docker host1:

docker host2:

Container 1 is running on host1 and container 2 is running on host2. Port 5432 is published on both the nodes. wal_log_hints is on on both the container running PostgreSQL.

Now when i try pg_rewind first time, from container2:

su - postgres -c "/usr/pgsql-14/bin/pg_rewind -D /var/lib/pgsql/14/data --source-server=\"port=5432 user=cysql dbname=test host=container1.myorg.com\" --dry-run"

It fails with below error:

pg_rewind: source and target cluster are on the same timeline
pg_rewind: no rewind required

If i run same things on plain machine RockyLinux 8.6, i get below error for pg_rewind:

pg_rewind: fatal: source and target clusters are from different systems

I know pg_rewind is supposed to use when you sync back to cluster again, but my case is different, i want to first check if pg_rewind can do diff sync, if yes, then go for it, else use pg_basebackup. Not sure why pg_rewind behave different in case of containers and normal machine. Any help please?

1 Answer 1


The error means that the second database was not created from a file system level backup of the first one. You can only use pg_rewind on two clusters that started out as clones of each other, not on clusters created with separate initdb invocations.

  • We ship PostgreSQL image and spin two containers. Please note that initdb is already ran and its part of docker image. We do not run initdb while spinning up container. How i can change the system identifier on already ran initdb? Mar 2, 2023 at 7:36
  • Whatever you are spinning, the two database clusters were created by different initdb runs. You cannot change the system identifier. I cannot tell you where you went wrong, because I don't know what exactly you did. Mar 2, 2023 at 8:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.