diff --git a/conf/redis-shake.conf b/conf/redis-shake.conf index 0667c63..81c5a06 100644 --- a/conf/redis-shake.conf +++ b/conf/redis-shake.conf @@ -12,9 +12,11 @@ log.level = info # 注意这个是目录,真正的pid是`{pid_path}/{id}.pid` pid_path = -# pprof port +# pprof port. system_profile = 9310 -# restful port,查看metric端口 +# restful port, set -1 means disable, in `restore` mode RedisShake will exit once finish restoring RDB only if this value +# is -1, otherwise, it'll wait forever. +# restful port,查看metric端口, -1表示不启用,如果是`restore`模式,只有设置为-1才会在完成RDB恢复后退出,否则会一直block。 http_profile = 9320 # runtime.GOMAXPROCS, 0 means use cpu core number: runtime.NumCPU() @@ -137,9 +139,11 @@ filter.slot = filter.lua = false # big key threshold, the default is 500 * 1024 * 1024 bytes. If the value is bigger than -# this given value, all the field will be spilt and write into the target in order. +# this given value, all the field will be spilt and write into the target in order. If +# the target Redis type is Codis, this should be set to 1, please checkout FAQ to find +# the reason. # 正常key如果不大,那么都是直接调用restore写入到目的端,如果key对应的value字节超过了给定 -# 的值,那么会分批依次一个一个写入。 +# 的值,那么会分批依次一个一个写入。如果目的端是Codis,这个需要置为1,具体原因请查看FAQ。 big_key_threshold = 524288000 # use psync command. diff --git a/src/redis-shake/main/main.go b/src/redis-shake/main/main.go index b91c146..676d3ad 100644 --- a/src/redis-shake/main/main.go +++ b/src/redis-shake/main/main.go @@ -34,8 +34,8 @@ import ( type Exit struct{ Code int } const ( - defaultHttpPort = 20881 - defaultSystemPort = 20882 + defaultHttpPort = 9320 + defaultSystemPort = 9310 defaultSenderSize = 65535 defaultSenderCount = 1024 ) @@ -150,6 +150,10 @@ func initFreeOS() { } func startHttpServer() { + if conf.Options.HttpProfile == -1 { + return + } + utils.InitHttpApi(conf.Options.HttpProfile) utils.HttpApi.RegisterAPI("/conf", nimo.HttpGet, func([]byte) interface{} { return &conf.Options @@ -360,11 +364,13 @@ func sanitizeOptions(tp string) error { } } - if conf.Options.HttpProfile < 0 || conf.Options.HttpProfile > 65535 { + if conf.Options.HttpProfile < -1 || conf.Options.HttpProfile > 65535 { return fmt.Errorf("HttpProfile[%v] should in [0, 65535]", conf.Options.HttpProfile) } else if conf.Options.HttpProfile == 0 { // set to default when not set conf.Options.HttpProfile = defaultHttpPort + } else if conf.Options.HttpProfile == -1 { + log.Info("http_profile is disable") } if conf.Options.SystemProfile < 0 || conf.Options.SystemProfile > 65535 { diff --git a/src/redis-shake/restore.go b/src/redis-shake/restore.go index 234f807..7102953 100644 --- a/src/redis-shake/restore.go +++ b/src/redis-shake/restore.go @@ -87,7 +87,8 @@ func (cmd *CmdRestore) Main() { wg.Wait() close(restoreChan) - if conf.Options.HttpProfile > 0 { + log.Infof("restore from '%s' to '%s' done", conf.Options.RdbInput, conf.Options.TargetAddressList) + if conf.Options.HttpProfile != -1 { //fake status if set http_port. and wait forever base.Status = "incr" log.Infof("Enabled http stats, set status (incr), and wait forever.")