forked from mirror/ledisdb
Move upgrade-ttl as a sub command of ledis so that it's easier to repair the problems (#387)
This commit is contained in:
parent
4535a9862e
commit
eb6693a86b
|
@ -6,8 +6,6 @@ Ledisdb is a high-performance NoSQL database library and server written in [Go](
|
||||||
|
|
||||||
LedisDB now supports multiple different databases as backends.
|
LedisDB now supports multiple different databases as backends.
|
||||||
|
|
||||||
### **You must run `ledis-upgrade-ttl` before using LedisDB version 0.4, I fixed a very serious bug for key expiration and TTL.**
|
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
+ Rich data structure: KV, List, Hash, ZSet, Set.
|
+ Rich data structure: KV, List, Hash, ZSet, Set.
|
||||||
|
@ -20,8 +18,9 @@ LedisDB now supports multiple different databases as backends.
|
||||||
+ HTTP API support, JSON/BSON/msgpack output.
|
+ HTTP API support, JSON/BSON/msgpack output.
|
||||||
+ Replication to guarantee data safety.
|
+ Replication to guarantee data safety.
|
||||||
+ Supplies tools to load, dump, and repair database.
|
+ Supplies tools to load, dump, and repair database.
|
||||||
+ Supports cluster, use [xcodis](https://github.com/ledisdb/xcodis)
|
+ Supports cluster, use [xcodis](https://github.com/ledisdb/xcodis).
|
||||||
+ Authentication (though, not via http)
|
+ Authentication (though, not via http).
|
||||||
|
+ Repair integrated: You can use `ledis repair` to repair broken databases and `ledis repair-ttl` to repair a very serious bug for key expiration and TTL if you upgraded from v0.4.
|
||||||
|
|
||||||
## Build from source
|
## Build from source
|
||||||
|
|
||||||
|
|
|
@ -14,12 +14,13 @@ var (
|
||||||
buildTag string
|
buildTag string
|
||||||
|
|
||||||
cmds = [][]string{
|
cmds = [][]string{
|
||||||
{"server", "run ledis server"},
|
{"server", "Run ledis server"},
|
||||||
{"cli", "run ledis client"},
|
{"cli", "Run ledis client"},
|
||||||
{"repair", "repair ledis storage directory"},
|
{"repair", "Repair ledis storage directory"},
|
||||||
{"dump", "create a snapshort of ledis"},
|
{"dump", "Create a snapshort of ledis"},
|
||||||
{"load", "load data from a snapshort"},
|
{"load", "Load data from a snapshort"},
|
||||||
{"benchmark", "run the benchmarks with ledis"},
|
{"benchmark", "Run the benchmarks with ledis"},
|
||||||
|
{"repair-ttl", "Repair a very serious bug for key expiration and TTL before v0.4"},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -55,6 +56,8 @@ func main() {
|
||||||
cmd.Cli()
|
cmd.Cli()
|
||||||
case "dump":
|
case "dump":
|
||||||
cmd.Dump()
|
cmd.Dump()
|
||||||
|
case "repair-ttl":
|
||||||
|
cmd.RepairTTL()
|
||||||
case "help":
|
case "help":
|
||||||
printSubCmds()
|
printSubCmds()
|
||||||
case "server":
|
case "server":
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package main
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
|
@ -10,11 +10,11 @@ import (
|
||||||
"github.com/ledisdb/ledisdb/store"
|
"github.com/ledisdb/ledisdb/store"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func RepairTTL() {
|
||||||
var configPath = flag.String("config", "", "ledisdb config file")
|
var configPath = flag.String("config", "", "ledisdb config file")
|
||||||
var dataDir = flag.String("data_dir", "", "ledisdb base data dir")
|
var dataDir = flag.String("data_dir", "", "ledisdb base data dir")
|
||||||
var dbName = flag.String("db_name", "", "select a db to use, it will overwrite the config's db name")
|
var dbName = flag.String("db_name", "", "select a db to use, it will overwrite the config's db name")
|
||||||
|
|
||||||
func main() {
|
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
if len(*configPath) == 0 {
|
if len(*configPath) == 0 {
|
|
@ -16,8 +16,6 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var addr = flag.String("addr", "", "ledisdb listen address")
|
var addr = flag.String("addr", "", "ledisdb listen address")
|
||||||
var dataDir = flag.String("data_dir", "", "ledisdb base data dir")
|
|
||||||
var dbName = flag.String("db_name", "", "select a db to use, it will overwrite the config's db name")
|
|
||||||
var usePprof = flag.Bool("pprof", false, "enable pprof")
|
var usePprof = flag.Bool("pprof", false, "enable pprof")
|
||||||
var pprofPort = flag.Int("pprof_port", 6060, "pprof http port")
|
var pprofPort = flag.Int("pprof_port", 6060, "pprof http port")
|
||||||
var slaveof = flag.String("slaveof", "", "make the server a slave of another instance")
|
var slaveof = flag.String("slaveof", "", "make the server a slave of another instance")
|
||||||
|
@ -28,6 +26,8 @@ var ttlCheck = flag.Int("ttl_check", 0, "TTL check interval")
|
||||||
var databases = flag.Int("databases", 0, "ledisdb maximum database number")
|
var databases = flag.Int("databases", 0, "ledisdb maximum database number")
|
||||||
|
|
||||||
func Server() {
|
func Server() {
|
||||||
|
var dbName = flag.String("db_name", "", "select a db to use, it will overwrite the config's db name")
|
||||||
|
var dataDir = flag.String("data_dir", "", "ledisdb base data dir")
|
||||||
var configFile = flag.String("config", "", "ledisdb config file")
|
var configFile = flag.String("config", "", "ledisdb config file")
|
||||||
|
|
||||||
runtime.GOMAXPROCS(runtime.NumCPU())
|
runtime.GOMAXPROCS(runtime.NumCPU())
|
||||||
|
|
Loading…
Reference in New Issue