Redis集群迁移工具,基于redis复制,快速,稳定。
特点:
快速。多线程。基于redis复制。实时迁移。迁移过程中,源集群不影响对外提供服务。异构迁移。支持Twemproxy集群,rediscluster集群,rdb文件和aof文件。过滤功能。当目标集群是Twemproxy,数据会跳过Twemproxy直接导入到后端的redis。迁移状态显示。完善的数据抽样校验。
迁移工具的来源可以是:单独的redis实例,twemproxy集群,rediscluster,rdb文件,aof文件。
迁移工具的目标可以是:单独的redis实例,twemproxy集群,rediscluster,rdb文件。
软件编译安装:
$ cd redis-migrate-tool$ autoreconf -fvi$ ./configure$ make$ src/redis-migrate-tool -h软件运行:
src/redis-migrate-tool -c rmt.conf -o log -d配置文件示例:从rediscluster集群迁移数据到twemproxy集群
[source]type: redis clusterservers:- 127.0.0.1:6379[target]type: twemproxyhash: fnv1a_64hash_tag: "{}"distribution: ketamaservers:- 127.0.0.1:6380:1 server1- 127.0.0.1:6381:1 server2- 127.0.0.1:6382:1 server3- 127.0.0.1:6383:1 server4[common]listen: 0.0.0.0:34345threads: 8step: 1mbuf_size: 512source_safe: true配置文件示例:从rediscluster集群迁移数据到另外一个cluster集群
[source]type:redisclusterservers:-127.0.0.1:8379[target]type:redisclusterservers:-127.0.0.1:7379[common]listen:0.0.0.0:8888配置文件示例:从rdb文件恢复数据到rediscluster集群
[source]type:rdbfileservers:-/data/redis/dump1.rdb-/data/redis/dump2.rdb-/data/redis/dump3.rdb[target]type:redisclusterservers:-127.0.0.1:7379[common]listen:0.0.0.0:8888状态查看:通过redis-cli连接redis-migrate-tool监控的端口,运行info命令
$redis-cli-h127.0.0.1-p8888127.0.0.1:8888>info#Serverversion:0.1.0os:Linux2.6.32-573.12.1.el6.x86_64x86_64multiplexing_api:epollgcc_version:4.4.7process_id:9199tcp_port:8888uptime_in_seconds:1662uptime_in_days:0config_file:/ect/rmt.conf#Clientsconnected_clients:1max_clients_limit:100total_connections_received:3#Memorymem_allocator:jemalloc-4.0.4#Groupsource_nodes_count:32target_nodes_count:48#Statsall_rdb_received:1all_rdb_parsed:1rdb_received_count:32rdb_parsed_count:32total_msgs_recv:7753587total_msgs_sent:7753587total_net_input_bytes:234636318total_net_output_bytes:255384129total_net_input_bytes_human:223.77Mtotal_net_output_bytes_human:243.55Mtotal_mbufs_inqueue:0total_msgs_outqueue:0127.0.0.1:8888>数据校验:
$src/redis-migrate-tool-crmt.conf-olog-Credis_checkCheckjobisrunning...Checkedkeys:1000Inconsistentvaluekeys:0Inconsistentexpirekeys:0Othercheckerrorkeys:0CheckedOKkeys:1000AllkeyscheckedOK!Checkjobfinished,used1.041s
评论