Skip to content

amjadjibon/raftd

Repository files navigation

raftd

A distributed key-value store built with HashiCorp Raft consensus algorithm.

Features

  • Distributed consensus using HashiCorp Raft
  • gRPC API for client-server communication
  • Persistent log storage with BoltDB
  • CLI for server management and KV operations

Quick Start

Build

go build -o raftd .

Start a Single Node

./raftd start --raft-addr localhost:7000 --raft-node-id node1 --grpc-addr :8080

KV Operations

# Set a value
./raftd set --grpc-addr localhost:8080 --key foo --value bar

# Get a value
./raftd get --grpc-addr localhost:8080 --key foo

# Delete a value
./raftd delete --grpc-addr localhost:8080 --key foo

Cluster Operations

# Check cluster status
./raftd status --grpc-addr localhost:8080

# Join another node to the cluster
./raftd join --grpc-addr localhost:8080 --join-addr localhost:7001 --join-id node2

Development

Generate Protobuf Code

make gen

Run Tests

go test ./...

Architecture

  • cmd/: CLI commands (Cobra)
  • server/: Raft server and FSM implementation
  • store/: In-memory key-value store
  • proto/: Protobuf definitions
  • gen/: Generated gRPC code

About

Toy implementation of a distributed key-value storage using hashicorp raft

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published