https://github.com/raphadam/dkv
🕸️ Distributed Key-Value store using Raft for consensus and Serf for peer discovery.
https://github.com/raphadam/dkv
consensus distributed-systems golang keyvalue raft
Last synced: 9 months ago
JSON representation
🕸️ Distributed Key-Value store using Raft for consensus and Serf for peer discovery.
- Host: GitHub
- URL: https://github.com/raphadam/dkv
- Owner: raphadam
- Created: 2024-08-01T11:08:24.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-08-18T07:48:25.000Z (over 1 year ago)
- Last Synced: 2025-01-01T01:45:43.942Z (over 1 year ago)
- Topics: consensus, distributed-systems, golang, keyvalue, raft
- Language: Go
- Homepage:
- Size: 97.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README

## Introduction
Simple yet powerful distributed key-value store written in Go. It uses the Raft consensus algorithm to ensure data consistency across nodes, Serf for node discovery and Prometheus for logging and monitoring. Exposes a RESTful JSON API for client interactions.
## Features
- **Distributed Consensus:** Utilizes the Raft algorithm to ensure consistency and reliability across nodes.
- **Dynamic Node Discovery:** Implements Serf for efficient peer-to-peer node discovery and communication.
- **Concurrency:** Nodes handle operations concurrently, ensuring scalability and performance.
- **RESTful API:** Exposes a simple and intuitive REST/JSON API for client interactions.
- **Monitoring and Logging:** Integrated with Prometheus for real-time monitoring and logging of metrics.
## Usage
### Dynamic Node Management
The cluster can dynamically scale, meaning nodes can join or leave at any time. This flexibility allows for easy scaling and fault tolerance.
- **Read Requests:** Clients can send GET requests to any node in the cluster, and it will respond with the correct value, even if it’s not the leader.
- **Write Requests:** Write operations must be directed to the leader node. If a client attempts to write to a follower node, it will be receive the address of the current leader.
### API Reference
- **Endpoint:** /
- **Method:** POST
**Request Body:**
```json
{
"cmd": "set|get|delete",
"key": "your key",
"val": "your val"
}
```
**Response:**
```json
{
"val": "val corresponding to the key",
}
```
## Future Work
This project is still under development with several features planned for future releases:
- **Sharding:** Implementing sharding to distribute data across multiple nodes, enhancing scalability and performance.
- **Consistent Hashing:** Introducing consistent hashing to ensure an even distribution of data and reduce the impact of node changes.
- **Improved Load Balancing:** Developing strategies to balance read and write loads more effectively across the cluster.
## Installation
### Prerequisites
- Go 1.22+
- Git
### Steps
Clone the repo:
git cline https://github.com/raphadam/dkv.git
cd dkv
Run the command:
go run ./cmd