A simple distributed key-value store by using hashicorp/raft

raftkv

This repository holds a simple distributed key-value store by using hashicorp/raft. raftkv provides gRPC and HTTP APIs. Please take a look API Reference.

Usage

Run containers

docker compose up

Validation

Set a key-value to a leader.

curl -XPOST 'localhost:50002/v1/set' \
--data-raw '{
    "key": "programming_language",
    "value": "golang"
}'

Get a value from a follower. You will get "golang" from followers. It means a leader propagates the value to followers.

curl -XGET 'localhost:50102/v1/get/programming_language'
curl -XGET 'localhost:50202/v1/get/programming_language'

Delete a key-value. You will get "not found" errors from followers.

curl -XDELETE 'localhost:50002/v1/delete/programming_language'
curl -XGET 'localhost:50102/v1/get/programming_language'
curl -XGET 'localhost:50202/v1/get/programming_language'
{"code":5, "message":"not found", "details":[]}
{"code":5, "message":"not found", "details":[]}

If you try to set or delete a key-value to a follower, you will get an error. localhost:50102 is an address for a follower at this time and you can replace it with localhost:50201 too.

See the docker-compose.yaml in detail.

curl -XPOST 'localhost:50102/v1/set' \
--data-raw '{
    "key": "programming_language",
    "value": "golang"
}'
curl -XDELETE 'localhost:50102/v1/delete/programming_language'
{"code":13, "message":"non-leader can't set key=programming_language, value=golang", "details":[]}
{"code":13, "message":"non-leader can't delete a value associated to programming_language", "details":[]}
Owner
Similar Resources

A distributed Layer 2 Direct Server Return (L2DSR) load balancer for Linux using XDP/eBPF

VC5 A distributed Layer 2 Direct Server Return (L2DSR) load balancer for Linux using XDP/eBPF This is very much a proof of concept at this stage - mos

Dec 22, 2022

Simple HTTP/HTTPS proxy - designed to be distributed as a self-contained binary that can be dropped in anywhere and run.

Simple Proxy This is a simple HTTP/HTTPS proxy - designed to be distributed as a self-contained binary that can be dropped in anywhere and run. Code b

Jan 7, 2023

Use Consul to do service discovery, use gRPC +kafka to do message produce and consume. Use redis to store result.

Use  Consul to do service discovery, use gRPC +kafka to do message produce and consume. Use redis to store result.

目录 gRPC/consul/kafka简介 gRPC+kafka的Demo gRPC+kafka整体示意图 限流器 基于redis计数器生成唯一ID kafka生产消费 kafka生产消费示意图 本文kafka生产消费过程 基于pprof的性能分析Demo 使用pprof统计CPU/HEAP数据的

Jul 9, 2022

A shazam like tool to store songs fingerprints and retrieve them

A shazam like tool to store songs fingerprints and retrieve them

musig 🔈 A shazam-like tool that allows you to compute song's fingerprints and reverse lookup song names. It's more or less an implementation of the s

Dec 12, 2022

OpenDILab RL Object Store

Introduction Decision AI Store Installation Prerequisites Linux Python = 3.6 pip install . Quick Start Start Etcd Server di_store etcd_server ./conf/

Jan 6, 2023

Project Kebe is the open-source Snap Store implementation.

Introduction Kebe intends to be a full replacement for the Snap Store. Quickstart Once you have an environment setup (for instance using https://githu

Nov 9, 2022

Consul K/V Store Implementation For Go

Consul K/V Store Implementation For Go

Consul K/V Store Implementation For Go Enables Consul to be used as a configuration source in go applications Dynamic Configuration with Consul's Key/

Jun 7, 2022

Inventory: Task 1 : Online Store

Task 1 : Online Store ### Q1: Describe what you think happened that caused those bad reviews during our 12.12 event and why it happened. Answer : You

Dec 6, 2021

Header Block is a middleware plugin for Traefik to block request and response headers which regex matched by their name and/or value

Header Block is a middleware plugin for Traefik to block request and response headers which regex matched by their name and/or value Conf

May 24, 2022
Tapestry is an underlying distributed object location and retrieval system (DOLR) which can be used to store and locate objects. This distributed system provides an interface for storing and retrieving key-value pairs.

Tapestry This project implements Tapestry, an underlying distributed object location and retrieval system (DOLR) which can be used to store and locate

Mar 16, 2022
Raft_test - How to use Hashicorp's Raft implementation with gRPC

raft-grpc-example This is some example code for how to use Hashicorp's Raft impl

Dec 30, 2021
In memory Key/Value store in go using gRPC.
In memory Key/Value store in go using gRPC.

In memory cache, using gRPC Contents About Running Server Local Docker Kubernetes Example Helm Terraform API Add Get GetByPrefix GetAllItems DeleteKey

Dec 26, 2022
Traefik proxy plugin to extract HTTP header value and create a new header with extracted value

Copy header value Traefik plugin Traefik plugin that copies HTTP header value with format key1=value1; key2=value2 into a new header. Motivation for t

May 26, 2022
Allows you to programatically modify key:value sysctl pairs on MacOS

go-sysctl-mac Allows you to programatically modify key:value sysctl pairs on MacOS. Tested & confirmd to work on MacOS Big Sur & newer releases. Examp

Dec 4, 2021
A consistent distributed data store.
A consistent distributed data store.

Doozer What Is It? Doozer is a highly-available, completely consistent store for small amounts of extremely important data. When the data changes, it

Jan 6, 2023
Test ssh login key acceptance without having the private key

ssh-key-confirmer This confirms if a SSH public key is listed as a authorized_key on a system Usage $ ssh-key-confirmer -i ./id_rsa.pub [email protected]

Dec 30, 2022
A pizza store design using NATS pub sub queue.
A pizza store design using NATS pub sub queue.

A pizza store design using NATS pub sub queue.

Oct 12, 2022
Backend implementation using go, proto3 and gRPC for a mock online store

Backend implementation using go, proto3 and gRPC for a mock online store Ricardo RICO URIBE Tasks I - Order service The current system exposes a produ

Oct 10, 2021
Using Envoy Proxy to load-balance gRPC services on GKE with header value based Session Affinity

Using Envoy Proxy to load-balance gRPC services on GKE with header value based S

Aug 24, 2022