OS: Debian 9
Docker Version: 18.09.0
I installed bitnami-postgresql:latest docker images in two independent servers. Configured everything as the bitnami documentation. Ran the docker compose file. You can find the config of the docker compose file below.
When the master(1) is down, the slave(2) works as master after running the command
docker exec postgresql-slave touch /tmp/postgresql.trigger.5432
My question is when the master(1) server is up how does the master(1) server know that it should work as a slave or act as master (turning the master(previous slave) to slave)?
Because if both of the servers act as master at the same time, various conflicts can occur.
Or should the old master be setup completely as a new slave from scratch?(If so, It is not feasible for larger databases)
Another question, since the environment variable
POSTGRESQL_REPLICATION_MODE=slave for the original slave container, what will happen to it if the container restarts after it becomes the master?
- POSTGRESQL_PASSWORD= **********
- POSTGRESQL_REPLICATION_MODE=master/slave(for slave)
- POSTGRESQL_REPLICATION_PASSWORD= **********