Skip to content

PostgreSQL with Bi-Directional Replication in a docker. (CentOS7+Supervisor)

License

Notifications You must be signed in to change notification settings

pozgo/docker-postgres-bdr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PostgreSQL with BDR B-Directional Replication in a docker.

CircleCI Build Status GitHub Open Issues GitHub Stars GitHub Forks
Stars on Docker Hub Pulls on Docker Hub

Docker Image with PostgreSQL server with BDR support for database Bi-Directional replication. Based on CentOS with Supervisor.

User can specify if database should work as stand-alone or master/slave mode. Even though BDR is more master/master solution we need to deploy first image which will create BDR setup inside of PostgreSQL. So for this purpose on run we need to specify one image to be so called master.

Environmental Variables

Variable Meaning
POSTGRES_PASSWORD Self explanatory
POSTGRES_USER Self explanatory
POSTGRES_DB Self explanatory
POSTGRES_PORT Self explanatory
MODE Mode in which this image shoudl work. Options: single/master/slave (default=single)
MASTER_ADDRESS Address of master node
MASTER_PORT Master node port
SLAVE_PORT Slave node port

Usage

Stand-Alone mode

docker run \
  -d \
  --name postgres \
  -p 5432:5432 \
  polinux/postgres-bdr

Master + 2 slaves

Use docker-compose.yml exmple.

Deploy all at once from docker-compose-yml file.

docker compose up

All

Deploy master only

docker compose up master

Master

Deploy slave1 only

docker compose up slave1

Master

Deploy slave2 only

docker compose up slave2

Master

Build

docker build -t polinux/postgres-bdr .

Docker troubleshooting

Use docker command to see if all required containers are up and running:

$ docker ps

Check logs of postgres-bdr server container:

$ docker logs postgres-bdr

Sometimes you might just want to review how things are deployed inside a running container, you can do this by executing a bash shell through docker's exec command:

docker exec -ti postgres-bdr /bin/bash

History of an image and size of layers:

docker history --no-trunc=true polinux/postgres-bdr | tr -s ' ' | tail -n+2 | awk -F " ago " '{print $2}'

Author

Przemyslaw Ozgo (linux@ozgo.info)
This work is also inspired by agios's work on their docker images. Many thanks!

About

PostgreSQL with Bi-Directional Replication in a docker. (CentOS7+Supervisor)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages