Mini TiKV: A Distributed transactional key-value database
-
RocksDB:
- Clone repo
Rocksdb
:
$ cd /home/$USER/Downloads $ git clone https://github.com/facebook/rocksdb.git
- Follow THIS GUIDE to install rocksdb
- Clone repo
-
Gorocksdb:
- Set CGO variable
export CGO_CFLAGS="-I/home/$USER/Downloads/rocksdb/include" export CGO_LDFLAGS="-L/home/$USER/Downloads/rocksdb -lrocksdb -lstdc++ -lm -lz -lbz2 -lsnappy -llz4 -lzstd"
- Get library
$ go get github.com/tecbot/gorocksdb
- Clone mtikv into workspace:
$ cd ~/go/src/github.com && mkdir thoainguyen && cd thoainguyen $ git clone https://github.com/thoainguyen/mtikv $ cd mtikv
$ cd cmd/pd
$ go run server.go
$ cd cmd/mtikv_cli
$ go run server.go
$ cd cmd/mtikv
$ go run server.go --node 1
$ go run server.go --node 2 // in another shell
$ go run server.go --node 3 // in another shell
$ go run server.go --node 4 // in another shell
First install goreman, which manages Procfile-based applications.
The Procfile script will set up a local mtikv cluster. Start it with:
$ goreman start
$ cd cmd/client
$ go run client.go
$ go run client.go
$ set <key> <value>
$ get <key>
$ del <key>
$ begin // new transaction
$ commit // commit transaction
$ rollback // rollback transaction
Ctr+C to exit
- Nguyen Huynh Thoai - Maintainer - thoainguyen
- Mentor @thuyenpt