Skip to content

gsoosk/ReplicatedPostgres

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Replicated Postgres

This project provide a multi-node replication system for postgres db. It will replicate data from a leader into two other replications, and it can tolerate leader failure for transactions. To maintain serializability of transactions, optimistic validation approach has been used.

This project is written with JAVA using SpringBoot Framework. All dependencies are listed and managed with Maven.

Intellij IDEA is recommended to run the project. MAVEN and JDK can be easily set up with it.

Requirements

Docker
Maven
JAVA > version 17

How to run

You can either use bellow steps or use the saved intellij configuration in the project (from EditConfiguration run the APPLICATION configuration).

Step 1:

running postgres nodes:

docker-compose up -d

Even if you stop services, databases will be saved into a volume. In case you wanted to remove them run docker volume prune after stopping services.

Step 2:

build the code:

mvn clean install

Start each of the three replication nodes:

mvn spring-boot:run -Dspring-boot.run.profiles=<leader/node1/node2>

Start the client:

mvn spring-boot:run -Dspring-boot.run.profiles=client

Client

We provide command line interface in client

  • Start new transaction with "normal" for readwrite transactions or "readonly" for readonly transaction
  • Read value of x with "read x"
  • Write value of x with "write x, y"
  • Commit transaction with "commit" Follow the client log to see how to interact with it.

About

A Replicated version of postgres

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages