Yet another distributed fault-tolerant key-value database Compatible with Redis written in Golang.
ZanRedisDB is a distributed redis cluster with strong consistency.
Install the compress library
yum install snappy-devel (for CentOS) apt-get install libsnappy1 libsnappy-dev (for Debian/Ubuntu) brew install snappy (for Mac)
Build the rocksdb with jemalloc
git clone https://github.com/absolute8511/rocksdb.git cd rocksdb git checkout v6.4.6-patched PORTABLE=1 USE_SSE=1 USE_PCLMUL=1 WITH_JEMALLOC_FLAG=1 JEMALLOC=1 make static_lib
Install the dependency (for old go version only, if using go1.13+, it will be done in go modules):
CGO_CFLAGS="-I/path/to/rocksdb/include" CGO_LDFLAGS="-L/path/to/rocksdb -lrocksdb -lstdc++ -lm -lsnappy -lrt -ljemalloc" go get github.com/youzan/gorocksdb CGO_CFLAGS="-I/path/to/rocksdb/include" CGO_LDFLAGS="-L/path/to/rocksdb -lrocksdb -lstdc++ -lm -lsnappy -ljemalloc" go get github.com/youzan/gorocksdb (for MacOS)
use the dep ensure
to install other dependencies or use go modules for go1.13+
Build zankv and placedriver from the source (only support go version 1.10+, gcc 4.9+ or xcode-command-line-tools on Mac):
ROCKSDB=/path/to/rocksdb make
If you want package the binary release run the scripts
./pre-dist.sh ROCKSDB=/path/to/rocksdb ./dist.sh
placedriver -config=/path/to/config
zankv -config=/path/to/config
vm.swappiness=0
vm.min_free_kbytes
to at least 1GB (8GB on larger memory system)vm.zone_reclaim_mode=0
echo 4 > /proc/sys/net/ipv4/tcp_delack_min
(for old OS only)placedriver has several HTTP APIs to manager the namespace
GET /namespaces
GET /datanodes
GET /listpd
GET /query/namespace_name
POST /cluster/namespace/create?namespace=test_p16&partition_num=16&replicator=3
POST /cluster/namespace/delete?namespace=test_p16&partition=**
storage server HTTP APIs for stats:
GET /stats
GET /raft/stats
POST /kv/optimize
GET /cluster/leader/namespace-partition
storage server also support the redis apis for read/write :
Golang client SDK : client-sdk , a redis proxy can be deployed based on this golang sdk if you want use the redis client in other language.
Many thanks for these great projects which make this project possible: etcd, RocksDB, ledisdb, pika.