Skip to content

barucho/PG_Docker_replication

Repository files navigation

PG_Docker_replication

to build :

docker build -t postrep .

to clean:

docker rmi $(docker images | grep "^<none>" | awk '{print $3}')

to run :

docker run -d --name master  postrep
docker run -d --name slave -e SLAVE=<master_ip> postrep

run failover:

docker exec -it -u postgres slave  bash -c 'pg_ctl promote'

show log:

docker logs slave

show replication status:

docker exec -it -u postgres master  bash -c 'echo "select * from pg_stat_replication;" |psql' 
docker exec -it -u postgres slave  bash -c 'echo "select now()-pg_last_xact_replay_timestamp();" |psql'

About

docker replication

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages