PatrickKoss / patrick-db

PatrickDB is a simplified Rust-based database designed to demonstrate distributed database principles. This distributed key-value store employs Zookeeper for replication and partitioning. Data is stored in a row-based format using a file-based system.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PatrickDB

Build Status License Issues PRs Forks Stars

PatrickDB is a simplified Rust-based database designed to demonstrate distributed database principles. This distributed key-value store employs Zookeeper for replication and partitioning. Data is stored in a row-based format using a file-based system.

The database is accessible through gRPC or REST, facilitated by Envoy for converting REST to gRPC. Additionally, patrick-db's storage and index engines can be integrated into other projects.

Architecture

Architecture

Clients compatible with gRPC or REST can connect to patrick-db, such as the cli tool located in the server directory.

Envoy, which serves multiple purposes, is used here to interchange REST and gRPC.

Zookeeper plays a role in service discovery and managing leader elections.

The router, a gRPC server akin to the database server, interacts with Zookeeper. It identifies all partitions and their respective leaders and followers, directing traffic to the appropriate partition through hash-based partitioning. For write or read operations, it selects the leader, and for read-only operations, a follower is chosen.

The database itself is a gRPC server that implements a file-based storage system. In its role as a leader, it replicates data to followers using statement replication.

Getting Started

Start all components (Zookeeper, Envoy, Router, and two Partitions with one Leader and Replica) inside docker containers:

make run-all-docker

Lint all components:

make lint

Run all tests:

make test

About

PatrickDB is a simplified Rust-based database designed to demonstrate distributed database principles. This distributed key-value store employs Zookeeper for replication and partitioning. Data is stored in a row-based format using a file-based system.

License:MIT License


Languages

Language:Rust 96.0%Language:Makefile 2.6%Language:Dockerfile 1.4%