polish code, conf, readme

v4
zhuzhao.cx 6 years ago committed by vinllen
parent 2e5233ee53
commit 709c1da12f
  1. 2
      README.md
  2. 32
      conf/redis-shake.conf
  3. 5
      src/redis-shake/main/main.go

@ -1,7 +1,7 @@
Redis-shake is mainly used to synchronize data from one redis database to another.<br> Redis-shake is mainly used to synchronize data from one redis database to another.<br>
Thanks to the Douyu's WSD team for the support. <br> Thanks to the Douyu's WSD team for the support. <br>
* [中文文档](https://yq.aliyun.com/articles/691794?spm=a2c4e.11155435.0.0.7c3f3312RCZgel): please wait, coming soon. * [中文文档](https://yq.aliyun.com/articles/691794): please wait, coming soon.
# Redis-Shake # Redis-Shake
--- ---

@ -2,12 +2,12 @@
# id # id
id = redis-shake id = redis-shake
# log file # log file,日志文件,不配置将打印到stdout
log_file = log_file =
# pprof port # pprof port
system_profile = 9310 system_profile = 9310
# restful port # restful port,查看metric端口
http_profile = 9320 http_profile = 9320
# runtime.GOMAXPROCS, 0 means use cpu core number: runtime.NumCPU() # runtime.GOMAXPROCS, 0 means use cpu core number: runtime.NumCPU()
@ -18,16 +18,19 @@ parallel = 4
# input RDB file. read from stdin, default is stdin ('/dev/stdin'). # input RDB file. read from stdin, default is stdin ('/dev/stdin').
# used in `decode` and `restore`. # used in `decode` and `restore`.
# 如果是decode或者restore,这个参数表示读取的rdb文件
input_rdb = local_dump input_rdb = local_dump
# output RDB file. default is stdout ('/dev/stdout'). # output RDB file. default is stdout ('/dev/stdout').
# used in `decode` and `dump`. # used in `decode` and `dump`.
# 如果是decode或者dump,这个参数表示输出的rdb
output_rdb = local_dump output_rdb = local_dump
# source redis configuration. # source redis configuration.
# used in `dump` and `sync`. # used in `dump` and `sync`.
# ip:port # ip:port
source.address = 10.101.72.137:20441 # 源redis地址
source.address = 127.0.0.1:20441
# password. # password.
source.password_raw = kLNIl691OZctWST source.password_raw = kLNIl691OZctWST
# auth type, don't modify it # auth type, don't modify it
@ -38,6 +41,7 @@ source.version = 6
# target redis configuration. used in `restore` and `sync`. # target redis configuration. used in `restore` and `sync`.
# used in `restore` and `sync`. # used in `restore` and `sync`.
# ip:port # ip:port
# 目的redis地址
target.address = 10.101.72.137:20551 target.address = 10.101.72.137:20551
# password. # password.
target.password_raw = kLNIl691OZctWST target.password_raw = kLNIl691OZctWST
@ -50,63 +54,79 @@ target.version = 6
target.db = -1 target.db = -1
# use for expire key, set the time gap when source and target timestamp are not the same. # use for expire key, set the time gap when source and target timestamp are not the same.
# 用于处理过期的键值,当迁移两端不一致的时候,目的端需要加上这个值
fake_time = fake_time =
# force rewrite when destination restore has the key # force rewrite when destination restore has the key
# used in `restore` and `sync`. # used in `restore` and `sync`.
# 当源目的有重复key,是否进行覆写
rewrite = true rewrite = true
# filter db or key or slot # filter db or key or slot
# choose these db, e.g., 5, only choose db5. defalut is all. # choose these db, e.g., 5, only choose db5. defalut is all.
# used in `restore` and `sync`. # used in `restore` and `sync`.
# 支持过滤db,只让指定的db通过
filter.db = filter.db =
# filter key with prefix string. multiple keys are separated by ';'. # filter key with prefix string. multiple keys are separated by ';'.
# e.g., a;b;c # e.g., a;b;c
# default is all. # default is all.
# used in `restore` and `sync`. # used in `restore` and `sync`.
# 支持过滤key,只让指定的key通过,分号分隔
filter.key = filter.key =
# filter given slot, multiple slots are separated by ';'. # filter given slot, multiple slots are separated by ';'.
# e.g., 1;2;3 # e.g., 1;2;3
# used in `sync`. # used in `sync`.
# 指定过滤slot,只让指定的slot通过
filter.slot = filter.slot =
# big key threshold, default is 500 * 1024 * 1024. The field of big key will be split in processing. # big key threshold, the default is 500 * 1024 * 1024. The field of the big key will be split in processing.
# 我们对大key有特殊的处理,此处需要指定大key的阈值
big_key_threshold = 524288000 big_key_threshold = 524288000
# use psync command. # use psync command.
# used in `sync`. # used in `sync`.
# 默认使用sync命令,启用将会使用psync命令
psync = false psync = false
# enable metric # enable metric
# used in `sync`. # used in `sync`.
# 是否启用metric
metric = true metric = true
# print in log # print in log
# 是否将metric打印到log中
metric.print_log = true metric.print_log = true
# heartbeat # heartbeat
# send heartbeat to this url # send heartbeat to this url
# used in `sync`. # used in `sync`.
# 心跳的url地址,redis-shake将会发送到这个地址
heartbeat.url = http://127.0.0.1:8000 heartbeat.url = http://127.0.0.1:8000
# interval by seconds # interval by seconds
# 心跳保活周期
heartbeat.interval = 3 heartbeat.interval = 3
# external info which will be included in heartbeat data. # external info which will be included in heartbeat data.
# 在心跳报文中添加额外的信息
heartbeat.external = test external heartbeat.external = test external
# local network card to get ip address, e.g., "lo", "eth0", "en0" # local network card to get ip address, e.g., "lo", "eth0", "en0"
# 获取ip的网卡
heartbeat.network_interface = heartbeat.network_interface =
# sender information. # sender information.
# sender flush buffer size of byte. # sender flush buffer size of byte.
# used in `sync`. # used in `sync`.
# 发送缓存的字节长度,超过这个阈值将会强行刷缓存发送
sender.size = 104857600 sender.size = 104857600
# sender flush buffer size of oplog number. # sender flush buffer size of oplog number.
# used in `sync`. # used in `sync`.
# 发送缓存的报文个数,超过这个阈值将会强行刷缓存发送
sender.count = 5000 sender.count = 5000
# delay channel size. once one oplog is sent to target redis, the oplog id and timestamp will also stored in this delay queue. this timestamp will be used to calculate the time delay when receive ack from target redis. # delay channel size. once one oplog is sent to target redis, the oplog id and timestamp will also stored in this delay queue. this timestamp will be used to calculate the time delay when receiving ack from target redis.
# used in `sync`. # used in `sync`.
# 用于metric统计时延的队列
sender.delay_channel_size = 65535 sender.delay_channel_size = 65535
# ----------------splitter---------------- # ----------------splitter----------------
# belowing variables are useless for current opensource version so don't set. # below variables are useless for current opensource version so don't set.
# replace hash tag. # replace hash tag.
# used in `sync`. # used in `sync`.

@ -52,7 +52,10 @@ func main() {
version := flag.Bool("version", false, "show version") version := flag.Bool("version", false, "show version")
flag.Parse() flag.Parse()
if *configuration == "" || *version { if *configuration == "" || *tp == "" || *version {
if !*version {
fmt.Println("Please show me the '-conf' and '-type'")
}
fmt.Println(utils.Version) fmt.Println(utils.Version)
flag.PrintDefaults() flag.PrintDefaults()
return return

Loading…
Cancel
Save