pg_ctl: cannot be run as root
docker restart
docker cp db01:/var/lib/postgresql/data/pg_hba.conf .
cp pg_hba.conf pg_hba.backup.conf
vim pg_hba.conf
host replication replication_user 172.19.0.3/32 md5
docker cp pg_hba.conf db01:/var/lib/postgresql/data/.
docker restart db01
- Create replication slot
- Create
pg_hba.conf
entries for replication_user. Use the IP address from db02 and db03 /32 version (IPv4) - Make sure there is a
standby.signal
file - Restart it (should restart in recovery mode)
- Run
chown
andchmod
on the.pgpass
file - Use the
postgres
user
docker exec --user root -it db02 chown postgres:root /var/lib/postgresql/.pgpass
docker exec --user root -it db02 chmod 0600 /var/lib/postgresql/.pgpass