- 目录
前言
redis-migrate-tool 是维品会开源的一款redis数据迁移工具,基于redis复制,快速,稳定,github地址为:https://github.com/vipshop/redis-migrate-tool 。
- 快速。
- 多线程。
- 基于redis复制。
- 实时迁移。
- 迁移过程中,源集群不影响对外提供服务。
- 异构迁移。
- 支持Twemproxy集群,redis cluster集群,rdb文件 和 aof文件。
- 过滤功能。
- 当目标集群是Twemproxy,数据会跳过Twemproxy直接导入到后端的redis。
- 迁移状态显示。
- 完善的数据抽样校验(-C redis_check)。
划重点 实时迁移 迁移过程中,源集群不影响对外提供服务
安装redis-migrate-tool
依赖
$ yum -y install automake libtool autoconf bzip2 git
构建
$ cd redis-migrate-tool
$ autoreconf -fvi
$ ./configure
$ make
$ src/redis-migrate-tool -h
警告
在运行工具之前,确保源redis所在的机器有足够的内存可以允许至少一个redis生成.rdb文件,如果源机器有大量足够的内存允许所有的redis生成.rdb,可以在配置文件rmt.conf设置source_safe: false
。
下列命令不支持传播给target redis组,因为这些命令下的keys可能交叉了不同的目标redis节点。
RENAME,RENAMENX,RPOPLPUSH,BRPOPLPUSH,FLUSHALL,FLUSHDB,BITOP,MOVE,GEORADIUS,GEORADIUSBYMEMBER,EVAL,EVALSHA,SCRIPT,PFMERGE
redis-migrate-tool 命令详解
出现下列帮助说明表示安装成功
This is redis-migrate-tool-0.1.0
Usage: redis-migrate-tool [-?hVdIn] [-v verbosity level] [-o output file]
[-c conf file] [-C command]
[-f source address] [-t target address]
[-p pid file] [-m mbuf size] [-r target role]
[-T thread number] [-b buffer size]
Options:
-h, --help : this help
-V, --version : show version and exit
-d, --daemonize : run as a daemon
-I, --information : print some useful information
-n, --noreply : don't receive the target redis reply
-v, --verbosity=N : set logging level (default: 5, min: 0, max: 11)
-o, --output=S : set logging file (default: stderr)
-c, --conf-file=S : set configuration file (default: rmt.conf)
-p, --pid-file=S : set pid file