写点什么

redis 数据迁移之 redis-shake

作者:Java高工P7
  • 2021 年 11 月 11 日
  • 本文字数:2168 字

    阅读完需:约 7 分钟

vi redis-shake.conf


修改日志存储位置

log file,日志文件,不配置将打印到 stdout (e.g. /var/log/redis-shake.log )

log.file =/opt/shake/logs/redis-shake.log


配置原 redis 库


source.address = 10.10.12.41:6379


密码没有为空 有则填写


source.password_raw =

source redis configuration.

used in dump, sync and rump.

source redis type, e.g. "standalone" (default), "sentinel" or "cluster".

1. "standalone": standalone db mode.

2. "sentinel": the redis address is read from sentinel.

3. "cluster": the source redis has several db.

4. "proxy": the proxy address, currently, only used in "rump" mode.

源端 redis 的类型,支

【一线大厂Java面试题解析+后端开发学习笔记+最新架构讲解视频+实战项目源码讲义】
浏览器打开:qq.cn.hn/FTf 免费领取
复制代码


持 standalone,sentinel,cluster 和 proxy 四种模式,注意:目前 proxy 只用于 rump 模式。


source.type = standalone

ip:port

the source address can be the following:

1. single db address. for "standalone" type.

2. {master or slave}@sentinel single/cluster address, e.g., mymaster:master@127.0.0.1:26379;127.0.0.1:26380, or @127.0.0.1:26379;127.0.0.1:26380. for "sentinel" type.

3. cluster that has several db nodes split by semicolon(;). for "cluster" type. e.g., 10.1.1.1:20331;10.1.1.2:20441.

4. proxy address(used in "rump" mode only). for "proxy" type.

源 redis 地址。对于 sentinel 或者开源 cluster 模式,输入格式为"master 名字:拉取角色为 master 或者 slave@sentinel 的地址",别的 cluster

架构,比如 codis, twemproxy, aliyun proxy 等需要配置所有 master 或者 slave 的 db 地址。

source.address = 10.10.12.41:6379

password of db/proxy. even if type is sentinel.

source.password_raw =

auth type, don't modify it

source.auth_type = auth

tls enable, true or false. Currently, only support standalone.

open source redis does NOT support tls so far, but some cloud versions do.

source.tls_enable = false

input RDB file.

used in decode and restore.

if the input is list split by semicolon(;), redis-shake will restore the list one by one.

如果是 decode 或者 restore,这个参数表示读取的 rdb 文件。支持输入列表,例如:rdb.0;rdb.1;rdb.2

redis-shake 将会挨个进行恢复。

source.rdb.input = local

the concurrence of RDB syncing, default is len(source.address) or len(source.rdb.input).

used in dump, sync and restore. 0 means default.

This is useless when source.type isn't cluster or only input is only one RDB.

拉取的并发度,如果是dump或者sync,默认是 source.address 中 db 的个数,restore模式默认 len(source.rdb.input)。

假如 db 节点/输入的 rdb 有 5 个,但 rdb.parallel=3,那么一次只会

并发拉取 3 个 db 的全量数据,直到某个 db 的 rdb 拉取完毕并进入增量,才会拉取第 4 个 db 节点的 rdb,

以此类推,最后会有 len(source.address)或者 len(rdb.input)个增量线程同时存在。

source.rdb.parallel = 0

for special cloud vendor: ucloud

used in decode and restore.

ucloud 集群版的 rdb 文件添加了 slot 前缀,进行特判剥离: ucloud_cluster。

source.rdb.special_cloud =


迁移目标库配置


配置原 redis 库


source.address = 10.10.12.42:6380


密码没有为空 有则填写


source.password_raw =


# 当源目的有重复 key,是否进行覆写


# rewrite 表示源端覆盖目的端。


# none 表示一旦发生进程直接退出。


# ignore 表示保留目的端 key,忽略源端的同步 key。该值在 rump 模式下没有用。


#默认 none? ?


#该值在 rump 模式下没有用。


key_exists = rewrite? ?

target redis configuration. used in restore, sync and rump.

the type of target redis can be "standalone", "proxy" or "cluster".

1. "standalone": standalone db mode.

2. "sentinel": the redis address is read from sentinel.

3. "cluster": open source cluster (not supported currently).

4. "proxy": proxy layer ahead redis. Data will be inserted in a round-robin way if more than 1 proxy given.

目的 redis 的类型,支持 standalone,sentinel,cluster 和 proxy 四种模式。

target.type = standalone

ip:port

the target address can be the following:

1. single db address. for "standalone" type.

2. {master or slave}@sentinel single/cluster address, e.g., mymaster:master@127.0.0.1:26379;127.0.0.1:26380, or @127.0.0.1:26379;127.0.0.1:26380. for "sentinel" type.

3. cluster that has several db nodes split by semicolon(;). for "cluster" type.

4. proxy address. for "proxy" type.

target.address = 10.10.12.42:6380

password of db/proxy. even if type is sentinel.

target.password_raw =

auth type, don't modify it

target.auth_type = auth

all the data will be written into this db. < 0 means disable.

target.db = -1

tls enable, true or false. Currently, only support standalone.

open source redis does NOT support tls so far, but some cloud versions do.

target.tls_enable = false

用户头像

Java高工P7

关注

还未添加个人签名 2021.11.08 加入

还未添加个人简介

评论

发布
暂无评论
redis数据迁移之redis-shake