From 4cd06182792e7ff1c763cb2c5dfa4cf6f74d4f67 Mon Sep 17 00:00:00 2001 From: vinllen Date: Wed, 10 Apr 2019 11:45:50 +0800 Subject: [PATCH 1/3] polish conf comment --- conf/redis-shake.conf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/conf/redis-shake.conf b/conf/redis-shake.conf index d3cc3cd..6111765 100644 --- a/conf/redis-shake.conf +++ b/conf/redis-shake.conf @@ -4,9 +4,9 @@ id = redis-shake # log file,日志文件,不配置将打印到stdout (e.g. /var/log/redis-shake.log ) log_file = -# pid path,进程文件存储地址,不配置将输出到项目目录下(e.g. /var/run/), 注意这个是目录, -# 真正的pid是`{pid_path}/{id}.pid` -pid_path = +# pid path,进程文件存储地址(e.g. /var/run/),不配置将默认输出到redis-shake二进制文件i +# 对应的目录下面, 注意这个是目录,真正的pid是`{pid_path}/{id}.pid` +pid_path = # pprof port system_profile = 9310 From 166a2f0fa3a426d5316237e24c60de37df8d34ec Mon Sep 17 00:00:00 2001 From: vinllen Date: Thu, 11 Apr 2019 14:45:53 +0800 Subject: [PATCH 2/3] polish log --- src/redis-shake/common/utils.go | 1 - src/redis-shake/sync.go | 9 ++++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/redis-shake/common/utils.go b/src/redis-shake/common/utils.go index e4b30df..2d52fea 100644 --- a/src/redis-shake/common/utils.go +++ b/src/redis-shake/common/utils.go @@ -84,7 +84,6 @@ func OpenReadWriteFile(name string) *os.File { } func SendPSyncListeningPort(c net.Conn, port int) { - _, err := c.Write(redis.MustEncodeToBytes(redis.NewCommand("replconf", "listening-port", port))) if err != nil { log.PanicError(errors.Trace(err), "write replconf listening-port failed") diff --git a/src/redis-shake/sync.go b/src/redis-shake/sync.go index 6521d90..acf139e 100644 --- a/src/redis-shake/sync.go +++ b/src/redis-shake/sync.go @@ -100,10 +100,8 @@ func (cmd *CmdSync) Main() { log.Panic("invalid argument: target") } - log.Infof("sync from '%s' to '%s' http '%d'\n", from, target, conf.Options.HttpProfile) - + log.Infof("sync from '%s' to '%s' with http-port[%d]\n", from, target, conf.Options.HttpProfile) cmd.wait_full = make(chan struct{}) - log.Infof("sync from '%s' to '%s'\n", from, target) var sockfile *os.File if len(conf.Options.SockFileName) != 0 { @@ -172,10 +170,15 @@ func (cmd *CmdSync) SendSyncCmd(master, auth_type, passwd string) (net.Conn, int func (cmd *CmdSync) SendPSyncCmd(master, auth_type, passwd string) (pipe.Reader, int64) { c := utils.OpenNetConn(master, auth_type, passwd) + log.Infof("psync connect '%v' with auth type[%v] OK!", master, auth_type) + utils.SendPSyncListeningPort(c, conf.Options.HttpProfile) + log.Infof("psync send listening port[%v] OK!", conf.Options.HttpProfile) + br := bufio.NewReaderSize(c, utils.ReaderBufferSize) bw := bufio.NewWriterSize(c, utils.WriterBufferSize) + log.Infof("try to send 'psync' command") runid, offset, wait := utils.SendPSyncFullsync(br, bw) cmd.targetOffset.Set(offset) log.Infof("psync runid = %s offset = %d, fullsync", runid, offset) From eb03d83f19cf3a50495a8f20ea91a2e01bb5b034 Mon Sep 17 00:00:00 2001 From: vinllen Date: Thu, 11 Apr 2019 14:47:25 +0800 Subject: [PATCH 3/3] polish conf --- conf/redis-shake.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/redis-shake.conf b/conf/redis-shake.conf index 6111765..72873fa 100644 --- a/conf/redis-shake.conf +++ b/conf/redis-shake.conf @@ -4,8 +4,8 @@ id = redis-shake # log file,日志文件,不配置将打印到stdout (e.g. /var/log/redis-shake.log ) log_file = -# pid path,进程文件存储地址(e.g. /var/run/),不配置将默认输出到redis-shake二进制文件i -# 对应的目录下面, 注意这个是目录,真正的pid是`{pid_path}/{id}.pid` +# pid path,进程文件存储地址(e.g. /var/run/),不配置将默认输出到执行下面, +# 注意这个是目录,真正的pid是`{pid_path}/{id}.pid` pid_path = # pprof port