event-driven-io / Pongo

Pongo - Mongo but on Postgres and with strong consistency benefits
https://event-driven-io.github.io/Pongo/
MIT License
1.21k stars 30 forks source link

YugabyteDB as a distributed alternative to PostgreSQL #24

Closed FranckPachot closed 4 months ago

FranckPachot commented 4 months ago

This PR adds a docker compose in simple-ts to start YugabyteDB instead of PostgreSQL. YugabyteDB is an Open Source PostgreSQL-compatible Distributed SQL. It can scale horizontally by simply adding new nodes.

Example, here is a 6 nodes YugabyteDB cluster with Replication Factor 3 (resilient to one node failure):

docker-compose -f docker-compose-yugabytedb.yml up -d --scale dist=0
docker-compose -f docker-compose-yugabytedb.yml up -d --scale dist=1
docker-compose -f docker-compose-yugabytedb.yml up -d --scale dist=2
docker-compose -f docker-compose-yugabytedb.yml up -d --scale dist=3
docker-compose -f docker-compose-yugabytedb.yml up -d --scale dist=4
docker-compose -f docker-compose-yugabytedb.yml up -d --scale dist=5

The application connects to any node with the same driver as PostgreSQL

npm install
npm run start

The YugabyteDB UI is on port 15433: image The "users" table is distributed to 6 tablets with Raft leaders on all nodes: image