rawkv

module
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 22, 2023 License: GPL-3.0

README

RawKV

RawKV is a cloud-native distributed key-value database aiming to run on Kubernetes clusters, with focuses on:

  • Arbitrary raw bytes as keys and values
  • Write-optimized storage engine based on log-structured merge-tree
  • Reliable data replication with Raft consensus algorithm
  • Favor availability over consistency in the presence of network partitions

Installation

Build

Pass unit tests:

go test ./pkg/...

Install RawKV client:

go install ./pkg/cmd/rawkvcli

Build docker image of RawKV server:

docker build -t rawkvsvr:latest .
Deploy

RawKV requires a running Kubernetes cluster to function. Once the cluster has been established, start deployment:

kubectl apply -f rawkv.yaml

Get exposed port number of RawKV load balancer specified under service/rawkv-lb:

kubectl get -f rawkv.yaml

Use RawKV client rawkvcli to send requests to the load balancer:

$GOPATH/bin/rawkvcli put -addr 127.0.0.1:<port> -key name -val rawkv
$GOPATH/bin/rawkvcli get -addr 127.0.0.1:<port> -key name
$GOPATH/bin/rawkvcli del -addr 127.0.0.1:<port> -key name

Stop services and clean up:

kubectl delete -f rawkv.yaml
kubectl delete pvc -l app=rawkv
Debug

By default, rawkv.yaml creates three RawKV replicas:

kubectl get pods -l app=rawkv

View logs emitted from a replica (index starts with 0):

kubectl logs -f rawkv-<index>

Delete a replica to simulate node crash:

kubectl delete pod rawkv-<index>

License

See the COPYING file for license rights and limitations.

Directories

Path Synopsis
pkg
algods/algo
Package algo implements helper algorithms.
Package algo implements helper algorithms.
algods/treemap
Package treemap implements a tree map to store key-value pairs in sorted key order.
Package treemap implements a tree map to store key-value pairs in sorted key order.
cluster
Package cluster provides methods to get cluster information.
Package cluster provides methods to get cluster information.
cmd/rawkvcli
Package main implements a command-line tool for clients to communicate with rawkv backend.
Package main implements a command-line tool for clients to communicate with rawkv backend.
cmd/rawkvsvr
Package main implements a command-line tool to start a rawkv server.
Package main implements a command-line tool to start a rawkv server.
logging
Package logging provides a Logger to write logs.
Package logging provides a Logger to write logs.
pb
Package pb provides auto-generated protobuf messages and grpc stubs.
Package pb provides auto-generated protobuf messages and grpc stubs.
raft
Package raft implements raft consensus algorithm.
Package raft implements raft consensus algorithm.
server
Package server implements a server to handle grpc requests to the storage engine and raft engine.
Package server implements a server to handle grpc requests to the storage engine and raft engine.
store
Package store defines types of keys and values, and provides helper functions.
Package store defines types of keys and values, and provides helper functions.
store/filestore
Package filestore implements the on-disk storage layer of an LSM tree.
Package filestore implements the on-disk storage layer of an LSM tree.
store/memstore
Package memstore implements the in-memory storage layer of an LSM tree.
Package memstore implements the in-memory storage layer of an LSM tree.
store/shard
Package shard provides methods to manage a range of key-value data.
Package shard provides methods to manage a range of key-value data.
store/shardmgr
Package shardmgr provides methods to manage a group of shards.
Package shardmgr provides methods to manage a group of shards.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL