All Projects → pozgo → docker-postgres-bdr

pozgo / docker-postgres-bdr

Licence: MIT license
PostgreSQL with Bi-Directional Replication in a docker. (CentOS7+Supervisor)

Programming Languages

shell
77523 projects

Projects that are alternatives of or similar to docker-postgres-bdr

PyFiSync
Python (+ rsync or rclone) based intelligent file sync with automatic backups and file move/delete tracking.
Stars: ✭ 88 (+486.67%)
Mutual labels:  bi-directional

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 ([email protected])
This work is also inspired by agios's work on their docker images. Many thanks!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].