rawkv

module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2020 License: MIT

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 single-node unit tests:

$ go test ./pkg/...

Install binaries:

$ go install ./pkg/...

Build docker image:

$ docker build -t rawkvsvr:latest -f ./pkg/cmd/rawkvsvr/Dockerfile .
Deploy

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

$ kubectl apply -f kubernetes/rawkv.yaml

After the deployment succeeds, get exposed port number to the load balancer of RawKV pods:

$ kubectl get services
NAME       TYPE       CLUSTER-IP      EXTERNAL-IP   PORT(S)                   AGE
...        ...        ...             ...           ...                       ...
rawkv-lb   NodePort   10.103.220.60   <none>        8000:<exposed port>/TCP   5s
...        ...        ...             ...           ...                       ...

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

$ $GOPATH/bin/rawkvcli put -key name -val rawkv -addr 127.0.0.1:30000

The command above sends a put request to add a (name,rawkv) key-value pair to RawKV exposed on port 30000. Use the -h option to see more usages of rawkvcli.

Stop RawKV services:

$ kubectl delete -f kubernetes/rawkv.yaml
$ kubectl delete pvc -l app=rawkv

License

See the LICENSE 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