• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

cmd/H02-Feb-2019-965793

config/H02-Feb-2019-700548

doc/H02-Feb-2019-3,5472,721

etc/H02-Feb-2019-16366

ledis/H02-Feb-2019-9,6097,227

rpl/H02-Feb-2019-2,6091,936

server/H02-Feb-2019-10,4688,161

store/H02-Feb-2019-3,5652,563

tools/H02-Feb-2019-497357

upgrade/ledis-upgrade-ttl/H02-Feb-2019-11889

vendor/H02-Feb-2019-93,06277,989

.gitignoreH A D02-Feb-201962 88

.travis.ymlH A D02-Feb-201962 86

DockerfileH A D02-Feb-20193.9 KiB11086

Gopkg.lockH A D02-Feb-20192.4 KiB8771

Gopkg.tomlH A D02-Feb-20191.1 KiB5743

LICENSEH A D02-Feb-20191.1 KiB2117

MakefileH A D02-Feb-20191.1 KiB4029

README.mdH A D02-Feb-20195.2 KiB194112

clear_vendor.shH A D02-Feb-2019425 65

dev.shH A D02-Feb-20192.4 KiB7958

entrypoint.shH A D02-Feb-2019392 1710

README.md

1# LedisDB
2
3[![Build Status](https://travis-ci.org/siddontang/ledisdb.svg?branch=develop)](https://travis-ci.org/siddontang/ledisdb)
4
5Ledisdb is a high-performance NoSQL database, similar to Redis, written in [Go](http://golang.org/). It supports many data structures including kv, list, hash, zset, set.
6
7LedisDB now supports multiple different databases as backends.
8
9### **You must run `ledis-upgrade-ttl` before using LedisDB version 0.4, I fixed a very serious bug for key expiration and TTL.**
10
11
12## Features
13
14+ Rich data structure: KV, List, Hash, ZSet, Set.
15+ Data storage is not limited by RAM.
16+ Various backends supported: LevelDB, goleveldb, RocksDB, RAM.
17+ Supports Lua scripting.
18+ Supports expiration and TTL.
19+ Can be managed via redis-cli.
20+ Easy to embed in your own Go application.
21+ HTTP API support, JSON/BSON/msgpack output.
22+ Replication to guarantee data safety.
23+ Supplies tools to load, dump, and repair database.
24+ Supports cluster, use [xcodis](https://github.com/siddontang/xcodis)
25+ Authentication (though, not via http)
26
27## Build and Install
28
29Create a workspace and checkout ledisdb source
30
31    mkdir $WORKSPACE
32    cd $WORKSPACE
33    git clone git@github.com:siddontang/ledisdb.git src/github.com/siddontang/ledisdb
34
35    cd src/github.com/siddontang/ledisdb
36
37    #set build and run environment
38    source dev.sh
39
40    make
41    make test
42
43## LevelDB support
44
45+ Install leveldb and snappy.
46
47    LedisDB supplies a simple script to install leveldb and snappy:
48
49        sudo sh tools/build_leveldb.sh
50
51    It will install leveldb at /usr/local/leveldb and snappy at /usr/local/snappy by default.
52
53    LedisDB uses the modified LevelDB for better performance. [Details.](https://github.com/siddontang/ledisdb/wiki/leveldb-source-modification)
54
55    You can easily use other LevelDB versions (like Hyper LevelDB or Basho LevelDB) instead, as long as the header files are in `include/leveldb`, not `include/hyperleveldb` or any other location.
56
57+ Set `LEVELDB_DIR` and `SNAPPY_DIR` to the actual install path in dev.sh.
58+ `make clean && make`
59
60## RocksDB support
61
62+ [Install rocksdb(5.1+)](https://github.com/facebook/rocksdb/blob/master/INSTALL.md)(`make shared_lib`) and snappy first.
63
64    LedisDB has not yet supplied a simple script to install.
65
66+ Set `ROCKSDB_DIR` and `SNAPPY_DIR` to the actual install path in `dev.sh`.
67+ `make clean && make`
68
69
70If the RocksDB API changes, LedisDB may not build successfully. LedisDB currently supports RocksDB version 5.1 or later.
71
72
73## Choose store database
74
75LedisDB now supports goleveldb, leveldb, rocksdb, and RAM. It will use goleveldb by default.
76
77Choosing a store database to use is very simple.
78
79+ Set in server config file
80
81        db_name = "leveldb"
82
83+ Set in command flag
84
85        ledis-server -config=/etc/ledis.conf -db_name=leveldb
86
87    Flag command set will overwrite config setting.
88
89## Lua support
90
91Lua is supported using [gopher-lua](https://github.com/yuin/gopher-lua), a Lua VM, completely written in Go.
92
93## Configuration
94
95LedisDB uses [toml](https://github.com/toml-lang/toml) as the configuration format. The basic configuration ```./etc/ledis.conf``` in LedisDB source may help you.
96
97If you don't use a configuration, LedisDB will use the default for you.
98
99## Server Example
100
101    //set run environment if not
102    source dev.sh
103
104    ./bin/ledis-server -config=/etc/ledis.conf
105
106    //another shell
107    ./bin/ledis-cli -p 6380
108
109    ledis 127.0.0.1:6380> set a 1
110    OK
111    ledis 127.0.0.1:6380> get a
112    "1"
113
114    //use curl
115    curl http://127.0.0.1:11181/SET/hello/world
116    → {"SET":[true,"OK"]}
117
118    curl http://127.0.0.1:11181/0/GET/hello?type=json
119    → {"GET":"world"}
120
121
122## Package Example
123
124    import (
125      lediscfg "github.com/siddontang/ledisdb/config"
126      "github.com/siddontang/ledisdb/ledis"
127    )
128
129    # Use Ledis's default config
130    cfg := lediscfg.NewConfigDefault()
131    l, _ := ledis.Open(cfg)
132    db, _ := l.Select(0)
133
134    db.Set(key, value)
135
136    db.Get(key)
137
138
139## Replication Example
140
141Set slaveof in config or dynamiclly
142
143    ledis-cli -p 6381
144
145    ledis 127.0.0.1:6381> slaveof 127.0.0.1 6380
146    OK
147
148## Cluster support
149
150LedisDB uses a proxy named [xcodis](https://github.com/siddontang/xcodis) to support cluster.
151
152## Benchmark
153
154See [benchmark](https://github.com/siddontang/ledisdb/wiki/Benchmark) for more.
155
156## Todo
157
158See [Issues todo](https://github.com/siddontang/ledisdb/issues?labels=todo&page=1&state=open)
159
160## Client
161
162See [Clients](https://github.com/siddontang/ledisdb/wiki/Clients) to find or contribute LedisDB client.
163
164## Links
165
166+ [Official Website](http://ledisdb.com)
167+ [GoDoc](https://godoc.org/github.com/siddontang/ledisdb)
168+ [Server Commands](https://github.com/siddontang/ledisdb/wiki/Commands)
169
170## Caveat
171
172+ Changing the backend database at runtime is very dangerous. Data validation is not guaranteed if this is done.
173
174## Requirement
175
176+ Go version >= 1.6
177
178## Related Repos
179
180+ [pika](https://github.com/Qihoo360/pika)
181
182
183## Donate
184
185If you like the project and want to buy me a cola, you can through:
186
187|PayPal|微信|
188|------|---|
189|[![](https://www.paypalobjects.com/webstatic/paypalme/images/pp_logo_small.png)](https://paypal.me/siddontang)|[![](https://github.com/siddontang/blog/blob/master/donate/weixin.png)|
190
191## Feedback
192
193+ Gmail: siddontang@gmail.com
194