Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

postgresql docker replications

I'm relatively new to dockers, but I'm kind of wondering whether is it possible for me to create two master-slave postgres containers. I can do it on virtual machines, but I'm a bit confused on the one in docker.

If it's possible can someone please point me to right directions? I have tried to docker exec -it, but all the files are all missing and I cannot edit the files inside.

like image 357
fredi tansari Avatar asked Jun 23 '26 18:06

fredi tansari


1 Answers

Since you are new to Docker, and you wish to get up and running quickly, you can try using Bitnami's images, which allow you to specify a POSTGRESQL_REPLICATION_MODE environment variable, which will allow you to designate a container as a standby/slave.

Just save their docker-compose-replication.yml as docker-compose.yml in the director of your choice, run docker-compose up -d, and it will pull the necessary image and set everything up for you quickly.

However, I would highly encourage you to tinker on your own to learn how Docker works. Specifically, you could just use the community Postgres image, and then write your own entrypoint.sh file (along with any additional helper files as necessary), and customize the setup to your requirements.

Disclosure: I work for EnterpriseDB (EDB)

like image 150
richyen Avatar answered Jun 28 '26 04:06

richyen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!