Move upgrade-ttl as a sub command of ledis so that it's easier to repair the problems (#387)

This commit is contained in:
Lunny Xiao 2020-05-10 18:47:46 +08:00 committed by GitHub
parent 4535a9862e
commit eb6693a86b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 17 deletions

View File

@ -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.
### **You must run `ledis-upgrade-ttl` before using LedisDB version 0.4, I fixed a very serious bug for key expiration and TTL.**
## Features
+ 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.
+ Replication to guarantee data safety.
+ Supplies tools to load, dump, and repair database.
+ Supports cluster, use [xcodis](https://github.com/ledisdb/xcodis)
+ Authentication (though, not via http)
+ Supports cluster, use [xcodis](https://github.com/ledisdb/xcodis).
+ 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

View File

@ -14,12 +14,13 @@ var (
buildTag string
cmds = [][]string{
{"server", "run ledis server"},
{"cli", "run ledis client"},
{"repair", "repair ledis storage directory"},
{"dump", "create a snapshort of ledis"},
{"load", "load data from a snapshort"},
{"benchmark", "run the benchmarks with ledis"},
{"server", "Run ledis server"},
{"cli", "Run ledis client"},
{"repair", "Repair ledis storage directory"},
{"dump", "Create a snapshort of ledis"},
{"load", "Load data from a snapshort"},
{"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()
case "dump":
cmd.Dump()
case "repair-ttl":
cmd.RepairTTL()
case "help":
printSubCmds()
case "server":

View File

@ -1,4 +1,4 @@
package main
package cmd
import (
"encoding/binary"
@ -10,11 +10,11 @@ import (
"github.com/ledisdb/ledisdb/store"
)
func RepairTTL() {
var configPath = flag.String("config", "", "ledisdb config file")
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")
func main() {
flag.Parse()
if len(*configPath) == 0 {

View File

@ -16,8 +16,6 @@ import (
)
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 pprofPort = flag.Int("pprof_port", 6060, "pprof http port")
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")
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")
runtime.GOMAXPROCS(runtime.NumCPU())