update make

This commit is contained in:
siddontang 2014-07-26 09:22:09 +08:00
parent e073396481
commit dc5c2d9095
7 changed files with 58 additions and 24 deletions

3
.gitignore vendored
View File

@ -1,4 +1,5 @@
build build
*.pyc *.pyc
.DS_Store .DS_Store
nohup.out nohup.out
build_config.mk

View File

@ -1,3 +1,9 @@
$(shell ./bootstrap.sh)
$(shell ./build_config.sh build_config.mk ./)
include build_config.mk
all: build all: build
build: build:

View File

@ -1,11 +1,14 @@
# LedisDB # LedisDB
Ledisdb is a high performance NoSQL like Redis based on LevelDB written by go. It supports some advanced data structure like kv, list, hash and zset, and may be alternative for Redis. Ledisdb is a high performance NoSQL like Redis written by go. It supports some advanced data structure like kv, list, hash and zset, and may be alternative for Redis.
LedisDB now supports multi database as backend to store data, you can test and choose the proper one for you.
## Features ## Features
+ Rich advanced data structure: KV, List, Hash, ZSet, Bit. + Rich advanced data structure: KV, List, Hash, ZSet, Bit.
+ Uses leveldb to store lots of data, over the memory limit. + Stores lots of data, over the memory limit.
+ Various backend database to use: LevelDB, goleveldb, LMDB.
+ Supports expiration and ttl. + Supports expiration and ttl.
+ Redis clients, like redis-cli, are supported directly. + Redis clients, like redis-cli, are supported directly.
+ Multi client API supports, including Golang, Python, Lua(Openresty). + Multi client API supports, including Golang, Python, Lua(Openresty).
@ -15,13 +18,17 @@ Ledisdb is a high performance NoSQL like Redis based on LevelDB written by go. I
## Build and Install ## Build and Install
+ Create a workspace and checkout ledisdb source Create a workspace and checkout ledisdb source
mkdir $WORKSPACE mkdir $WORKSPACE
cd $WORKSPACE cd $WORKSPACE
git clone git@github.com:siddontang/ledisdb.git src/github.com/siddontang/ledisdb git clone git@github.com:siddontang/ledisdb.git src/github.com/siddontang/ledisdb
cd src/github.com/siddontang/ledisdb cd src/github.com/siddontang/ledisdb
make
## LevelDB support
+ Install leveldb and snappy, if you have installed, skip. + Install leveldb and snappy, if you have installed, skip.
@ -35,12 +42,11 @@ Ledisdb is a high performance NoSQL like Redis based on LevelDB written by go. I
+ Set LEVELDB_DIR and SNAPPY_DIR to the actual install path in dev.sh. + Set LEVELDB_DIR and SNAPPY_DIR to the actual install path in dev.sh.
+ Then: + make
. ./bootstap.sh ## RocksDB support
. ./dev.sh
go install ./... todo.......
## Server Example ## Server Example

0
bootstrap.sh Normal file → Executable file
View File

16
build_config.sh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/sh
OUTPUT=$1
PREFIX=$2
if test -z "$OUTPUT" || test -z "$PREFIX"; then
echo "usage: $0 <output-filename> <directory_prefix>" >&2
exit 1
fi
# Delete existing output, if it exists
rm -f $OUTPUT
touch $OUTPUT
source ./dev.sh
echo "GO_BUILD_TAGS=$GO_BUILD_TAGS" >> $OUTPUT

26
dev.sh
View File

@ -25,35 +25,37 @@ function add_path()
fi fi
} }
GO_BUILD_TAGS=
export GOPATH=$(add_path $GOPATH $VTROOT) export GOPATH=$(add_path $GOPATH $VTROOT)
# check snappy # check snappy
if [ -f $SNAPPY_DIR/lib/libsnappy.a ]; then if [ -f $SNAPPY_DIR/lib/libsnappy.a ]; then
CGO_CFLAGS+="-I$SNAPPY_DIR/include" CGO_CFLAGS="$CGO_CFLAGS -I$SNAPPY_DIR/include"
CGO_CXXFLAGS+="-I$SNAPPY_DIR/include" CGO_CXXFLAGS="$CGO_CXXFLAGS -I$SNAPPY_DIR/include"
CGO_LDFLAGS+="-L$SNAPPY_DIR/lib -lsnappy" CGO_LDFLAGS="$CGO_LDFLAGS -L$SNAPPY_DIR/lib -lsnappy"
LD_LIBRARY_PATH=$(add_path $LD_LIBRARY_PATH $SNAPPY_DIR/lib) LD_LIBRARY_PATH=$(add_path $LD_LIBRARY_PATH $SNAPPY_DIR/lib)
DYLD_LIBRARY_PATH=$(add_path $DYLD_LIBRARY_PATH $SNAPPY_DIR/lib) DYLD_LIBRARY_PATH=$(add_path $DYLD_LIBRARY_PATH $SNAPPY_DIR/lib)
fi fi
# check leveldb # check leveldb
if [ -f $LEVELDB_DIR/lib/libleveldb.a ]; then if [ -f $LEVELDB_DIR/lib/libleveldb.a ]; then
CGO_CFLAGS+="-I$LEVELDB_DIR/include" CGO_CFLAGS="$CGO_CFLAGS -I$LEVELDB_DIR/include"
CGO_CXXFLAGS+="-I$LEVELDB_DIR/include" CGO_CXXFLAGS="$CGO_CXXFLAGS -I$LEVELDB_DIR/include"
CGO_LDFLAGS+="-L$LEVELDB_DIR/lib -lleveldb" CGO_LDFLAGS="$CGO_LDFLAGS -L$LEVELDB_DIR/lib -lleveldb"
LD_LIBRARY_PATH=$(add_path $LD_LIBRARY_PATH $LEVELDB_DIR/lib) LD_LIBRARY_PATH=$(add_path $LD_LIBRARY_PATH $LEVELDB_DIR/lib)
DYLD_LIBRARY_PATH=$(add_path $DYLD_LIBRARY_PATH $LEVELDB_DIR/lib) DYLD_LIBRARY_PATH=$(add_path $DYLD_LIBRARY_PATH $LEVELDB_DIR/lib)
GO_BUILD_TAGS+="leveldb" GO_BUILD_TAGS="$GO_BUILD_TAGS leveldb"
fi fi
# check rocksdb # check rocksdb
if [ -f $ROCKSDB_DIR/lib/libleveldb.a ]; then if [ -f $ROCKSDB_DIR/lib/librocksdb.a ]; then
CGO_CFLAGS+="-I$ROCKSDB_DIR/include" CGO_CFLAGS="$CGO_CFLAGS -I$ROCKSDB_DIR/include"
CGO_CXXFLAGS+="-I$ROCKSDB_DIR/include" CGO_CXXFLAGS="$CGO_CXXFLAGS -I$ROCKSDB_DIR/include"
CGO_LDFLAGS+="-L$ROCKSDB_DIR/lib -lleveldb" CGO_LDFLAGS="$CGO_LDFLAGS -L$ROCKSDB_DIR/lib -lleveldb"
LD_LIBRARY_PATH=$(add_path $LD_LIBRARY_PATH $ROCKSDB_DIR/lib) LD_LIBRARY_PATH=$(add_path $LD_LIBRARY_PATH $ROCKSDB_DIR/lib)
DYLD_LIBRARY_PATH=$(add_path $DYLD_LIBRARY_PATH $ROCKSDB_DIR/lib) DYLD_LIBRARY_PATH=$(add_path $DYLD_LIBRARY_PATH $ROCKSDB_DIR/lib)
GO_BUILD_TAGS+="rocksdb" GO_BUILD_TAGS="$GO_BUILD_TAGS rocksdb"
fi fi
export CGO_CFLAGS export CGO_CFLAGS

View File

@ -1,7 +1,10 @@
{ {
"addr": "127.0.0.1:6380", "addr": "127.0.0.1:6380",
"data_dir": "/tmp/ledis_server", "data_dir": "/tmp/ledis_server",
"db": { "db": {
"name" : "golveldb",
"compression": false, "compression": false,
"block_size": 32768, "block_size": 32768,
"write_buffer_size": 67108864, "write_buffer_size": 67108864,