forked from mirror/ledisdb
parent
eb6693a86b
commit
b814d6a929
19
README.md
19
README.md
|
@ -26,6 +26,7 @@ LedisDB now supports multiple different databases as backends.
|
|||
|
||||
Create a workspace and checkout ledisdb source
|
||||
|
||||
```shell
|
||||
git clone git@github.com:ledisdb/ledisdb.git
|
||||
cd ledisdb
|
||||
|
||||
|
@ -34,6 +35,7 @@ Create a workspace and checkout ledisdb source
|
|||
|
||||
make
|
||||
make test
|
||||
```
|
||||
|
||||
Then you will find all the binary build on `./bin` directory.
|
||||
|
||||
|
@ -66,7 +68,6 @@ Then you will find all the binary build on `./bin` directory.
|
|||
|
||||
If the RocksDB API changes, LedisDB may not build successfully. LedisDB currently supports RocksDB version 5.1 or later.
|
||||
|
||||
|
||||
## Choose store database
|
||||
|
||||
LedisDB now supports goleveldb, leveldb, rocksdb, and RAM. It will use goleveldb by default.
|
||||
|
@ -79,7 +80,7 @@ Choosing a store database to use is very simple.
|
|||
|
||||
+ Set in command flag
|
||||
|
||||
ledis-server -config=/etc/ledis.conf -db_name=leveldb
|
||||
ledis -config=/etc/ledis.conf -db_name=leveldb
|
||||
|
||||
Flag command set will overwrite config setting.
|
||||
|
||||
|
@ -95,13 +96,14 @@ If you don't use a configuration, LedisDB will use the default for you.
|
|||
|
||||
## Server Example
|
||||
|
||||
```shell
|
||||
//set run environment if not
|
||||
source dev.sh
|
||||
|
||||
./bin/ledis-server -config=/etc/ledis.conf
|
||||
./bin/ledis -config=/etc/ledis.conf
|
||||
|
||||
//another shell
|
||||
./bin/ledis-cli -p 6380
|
||||
./bin/ledis cli -p 6380
|
||||
|
||||
ledis 127.0.0.1:6380> set a 1
|
||||
OK
|
||||
|
@ -114,10 +116,12 @@ If you don't use a configuration, LedisDB will use the default for you.
|
|||
|
||||
curl http://127.0.0.1:11181/0/GET/hello?type=json
|
||||
→ {"GET":"world"}
|
||||
```
|
||||
|
||||
|
||||
## Package Example
|
||||
|
||||
```go
|
||||
import (
|
||||
lediscfg "github.com/ledisdb/ledisdb/config"
|
||||
"github.com/ledisdb/ledisdb/ledis"
|
||||
|
@ -131,16 +135,18 @@ If you don't use a configuration, LedisDB will use the default for you.
|
|||
db.Set(key, value)
|
||||
|
||||
db.Get(key)
|
||||
|
||||
```
|
||||
|
||||
## Replication Example
|
||||
|
||||
Set slaveof in config or dynamiclly
|
||||
|
||||
ledis-cli -p 6381
|
||||
```shell
|
||||
ledis cli -p 6381
|
||||
|
||||
ledis 127.0.0.1:6381> slaveof 127.0.0.1 6380
|
||||
OK
|
||||
```
|
||||
|
||||
## Cluster support
|
||||
|
||||
|
@ -180,7 +186,6 @@ See [Clients](https://github.com/ledisdb/ledisdb/wiki/Clients) to find or contri
|
|||
|
||||
+ [pika](https://github.com/Qihoo360/pika)
|
||||
|
||||
|
||||
## Donate
|
||||
|
||||
If you like the project and want to buy me a cola, you can through:
|
||||
|
|
|
@ -106,13 +106,7 @@ func (l *Ledis) Dump(w io.Writer) error {
|
|||
}
|
||||
}
|
||||
|
||||
if err = wb.Flush(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
compressBuf = nil
|
||||
|
||||
return nil
|
||||
return wb.Flush()
|
||||
}
|
||||
|
||||
// LoadDumpFile clears all data and loads dump file to db
|
||||
|
@ -207,9 +201,6 @@ func (l *Ledis) LoadDump(r io.Reader) (*DumpHead, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
deKeyBuf = nil
|
||||
deValueBuf = nil
|
||||
|
||||
if l.r != nil {
|
||||
if err := l.r.UpdateCommitID(h.CommitID); err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -123,7 +123,7 @@ func (s *FileStore) GetLog(id uint64, l *Log) error {
|
|||
}
|
||||
|
||||
func (s *FileStore) FirstID() (uint64, error) {
|
||||
id := uint64(0)
|
||||
var id uint64
|
||||
|
||||
s.rm.RLock()
|
||||
if len(s.rs) > 0 {
|
||||
|
@ -408,7 +408,6 @@ func (ts tableReaders) check() error {
|
|||
return fmt.Errorf("invalid index %d in table %s", ts[i].index, ts[i])
|
||||
}
|
||||
|
||||
first = ts[i].first
|
||||
last = ts[i].last
|
||||
index = ts[i].index
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue