源码安装redis-migrate-tool

redis-migrate-tool unzip redis-migrate-tool-master.zip cd redis-migrate-tool-master yum -y install automake libtool autoconf bzip2 autoreconf -fvi ./configure make ./src/redis-migrate-tool

  

rmt.conf 配置项修改- 单机向集群迁移

[source]
type: single  # 源redis类型
servers :
  - 127.0.0.1:7001   # 源redis地址,可以只填一个,保证cluster nodes能获取到正常信息即可
 redis_auth: 123456
[target]
type: redis cluster  # 目标redis类型
servers:
  - 127.0.0.1:8001   # 目标redis地址
 
[common]
listen: 0.0.0.0:8888  # 服务启动后,监听的地址和端口

  

 

启动复制日志
[root@localhost redis-migrate-tool-master]# cat ./start.sh
#!/bin/bash

nohup ./src/redis-migrate-tool rmt.conf &


[root@localhost redis-migrate-tool-master]# tail -100f nohup.out [2023-06-08 08:00:06.255] rmt_core.c:525 Nodes count of source group : 1 [2023-06-08 08:00:06.255] rmt_core.c:526 Total threads count : 2 [2023-06-08 08:00:06.255] rmt_core.c:527 Read threads count assigned: 1 [2023-06-08 08:00:06.255] rmt_core.c:528 Write threads count assigned: 1 [2023-06-08 08:00:06.256] rmt_core.c:836 instances_by_host: [2023-06-08 08:00:06.256] rmt_core.c:840 192.168.77.137:6379 [2023-06-08 08:00:06.256] rmt_core.c:842 [2023-06-08 08:00:06.256] rmt_core.c:2444 Total threads count in fact: 2 [2023-06-08 08:00:06.256] rmt_core.c:2445 Read threads count in fact: 1 [2023-06-08 08:00:06.256] rmt_core.c:2446 Write threads count in fact: 1 [2023-06-08 08:00:06.256] rmt_core.c:2455 read thread(0): [2023-06-08 08:00:06.256] rmt_core.c:2461 192.168.77.137:6379 [2023-06-08 08:00:06.256] rmt_core.c:2488 write thread(0): [2023-06-08 08:00:06.256] rmt_core.c:2494 192.168.77.137:6379 [2023-06-08 08:00:06.256] rmt_connect.c:798 bind on p 8 to addr '0.0.0.0:8888' failed: Address already in use [2023-06-08 08:00:06.256] rmt_connect.c:1690 ERROR: get proxy connect failed. [2023-06-08 08:01:16.881] rmt_core.c:525 Nodes count of source group : 1 [2023-06-08 08:01:16.882] rmt_core.c:526 Total threads count : 2 [2023-06-08 08:01:16.882] rmt_core.c:527 Read threads count assigned: 1 [2023-06-08 08:01:16.882] rmt_core.c:528 Write threads count assigned: 1 [2023-06-08 08:01:16.883] rmt_core.c:836 instances_by_host: [2023-06-08 08:01:16.883] rmt_core.c:840 192.168.77.137:6379 [2023-06-08 08:01:16.883] rmt_core.c:842 [2023-06-08 08:01:16.883] rmt_core.c:2444 Total threads count in fact: 2 [2023-06-08 08:01:16.883] rmt_core.c:2445 Read threads count in fact: 1 [2023-06-08 08:01:16.883] rmt_core.c:2446 Write threads count in fact: 1 [2023-06-08 08:01:16.883] rmt_core.c:2455 read thread(0): [2023-06-08 08:01:16.883] rmt_core.c:2461 192.168.77.137:6379 [2023-06-08 08:01:16.883] rmt_core.c:2488 write thread(0): [2023-06-08 08:01:16.883] rmt_core.c:2494 192.168.77.137:6379 [2023-06-08 08:01:16.883] rmt_core.c:2551 migrate job is running... [2023-06-08 08:01:16.883] rmt_redis.c:1707 Start connecting to MASTER[192.168.77.137:6379]. [2023-06-08 08:01:16.884] rmt_redis.c:1741 Master[192.168.77.137:6379] replied to PING, replication can continue... [2023-06-08 08:01:16.884] rmt_redis.c:1052 Partial resynchronization for MASTER[192.168.77.137:6379] not possible (no cached master). [2023-06-08 08:01:16.911] rmt_redis.c:1111 Full resync from MASTER[192.168.77.137:6379]: 44424d1fa104269e8caef8e41c0f2edc0d95a7ae:4943 [2023-06-08 08:01:16.946] rmt_redis.c:1518 MASTER <-> SLAVE sync: receiving 211 bytes from master[192.168.77.137:6379] [2023-06-08 08:01:16.946] rmt_redis.c:1624 MASTER <-> SLAVE sync: RDB data for node[192.168.77.137:6379] is received, used: 0 s [2023-06-08 08:01:16.946] rmt_redis.c:1644 rdb file node192.168.77.137:6379-1686236476911630-38510.rdb write complete [2023-06-08 08:01:16.946] rmt_redis.c:6637 Rdb file for node[192.168.77.137:6379] parsed finished, use: 0 s. [2023-06-08 08:01:16.946] rmt_redis.c:6745 All nodes' rdb file parsed finished for this write thread(0).