Skip to content

Building dkv

Kinshuk Bairagi edited this page Sep 2, 2022 · 3 revisions

Building DKV Docker Image

Follow these instructions to build a DKV container using the Dockerfile included.

$ curl -fsSL https://raw.githubusercontent.com/flipkart-incubator/dkv/master/Dockerfile | docker build -t dkv -f - .
$ docker run -it dkv:latest dkvsrv --help
$ docker run -it -v `pwd`:/config dkv:latest  dkvsrv --config /config/dkvsrv.yaml

Building DKV on Mac OSX

dkv has the following dependencies:

Dependencies

  • Go version 1.13+
  • RocksDB v6.22.1 as a storage engine
  • GoRocksDB provides the CGo bindings with RocksDB
  • Badger v1.6 as a storage engine
  • Nexus for sync replication over Raft consensus

Building RocksDB

wget https://raw.githubusercontent.com/Homebrew/homebrew-core/de2078f76d2963b3831c608c682c15b6776ef227/Formula/rocksdb.rb
brew style --fix rocksdb.rb
brew install -s rocksdb.rb

Compiling

$ git clone https://github.com/flipkart-incubator/dkv
$ cd dkv
$ make build

If you want to build for other platform, set GOOS, GOARCH environment variables. For example, build on macOS for linux run the following:

$ make GOOS=linux build

Running

Once DKV is built, the <PROJECT_ROOT>/bin folder should contain the following binaries:

  • dkvsrv - DKV server program
  • dkvctl - DKV client program
  • dkvbench - DKV benchmarking program

Launching the DKV server in standalone mode

A single DKV instance can be launched using the following command:

$ ./bin/dkvsrv --config dkvsrv.yaml \
    --db-folder <folder_name> \
    --listen-addr <host:port> \
    --db-engine <rocksdb|badger>
$ ./bin/dkvctl -dkvAddr <host:port> -set <key> <value>
$ ./bin/dkvctl -dkvAddr <host:port> -get <key>

Example session:

$ ./bin/dkvsrv --config dkvsrv.yaml --db-folder /tmp/db  -db-engine rocksdb
$ ./bin/dkvctl -dkvAddr 127.0.0.1:8080 -set foo bar
$ ./bin/dkvctl -dkvAddr 127.0.0.1:8080 -get foo
bar
$ ./bin/dkvctl -dkvAddr 127.0.0.1:8080 -set hello world
$ ./bin/dkvctl -dkvAddr 127.0.0.1:8080 -get hello
world
$ ./bin/dkvctl -dkvAddr 127.0.0.1:8080 -del foo
$ ./bin/dkvctl -dkvAddr 127.0.0.1:8080 -iter "*"
hello => world

Testing

The automated test-suite can be run using the following command

$ make test