Redis 基于 RedisShake 集群迁移

不建议手动迁移,以稳来行走天下,免的加班加点。除非您非常专业,每一步都不能错。一错直接完,问题排除起来非常繁琐。在这直接忽略,使用第三方工具 Redis Shark 协助我们迁移,简单、直接、效率高,稳定

原集群

IP 节点
192.168.86.135 6379,6380
192.168.86.136 6381,6382
192.168.86.137 6383,6384

新集群

IP 端口
192.168.86.138 6371,6372
192.168.86.139 6373,6374
192.168.86.140 6375,6376

RedisShake 官方文档

https://github.com/alibaba/RedisShake

RedisFullCheck 官方文档

https://github.com/alibaba/RedisFullCheck

################# 先搭建好新的集群环境 #################

# 原本的集群环境下
[root@redis-master opt]# cd /opt
[root@redis-master opt]# wget https://github.com/alibaba/RedisShake/releases/download/release-v2.0.3-20200724/redis-shake-v2.0.3.tar.gz

[root@redis-master opt]# tar -zxvf redis-shake-v2.0.3.tar.gz
[root@redis-master opt]# cd redis-shake-v2.0.3
[root@redis-master redis-shake-v2.0.3]# vi redis-shake.conf
conf.version = 1
id = redis-shake
source.type = cluster

# 配置原集群主节点即可
source.address = 192.168.86.135:6379,192.168.86.136:6381,192.168.86.137:6383
source.auth_type = auth
source.password_raw = 123456

# 配置新集群主节点即可
target.address = 192.168.86.138:6371,192.168.86.139:6373,192.168.86.140:6375
target.auth_type = auth
target.password_raw = 123456
# 启动迁移
[root@redis-master redis-shake-v2.0.3]# ./redis-shake.linux -conf=redis-shake.conf -type=sync
# 查看新的集群环境下是否迁移成功
[root@redis-new-master redis]# pwd
/usr/local/redis
[root@redis-new-master redis]# ./bin/redis-cli -a 123456 --cluster check  192.168.86.138:6371
# 检测迁移后是否数据一致
[root@redis-master opt]# wget https://github.com/alibaba/RedisFullCheck/releases/download/release-v1.4.8-20200212/redis-full-check-1.4.8.tar.gz
[root@redis-master opt]# tar -zxvf redis-full-check-1.4.8.tar.gz
[root@redis-master redis-full-check-1.4.8]# 
./redis-full-check -s "192.168.86.138:6371,192.168.86.139:6373,192.168.86.140:6375" --sourcepassword=123456  -t "192.168.86.138:6371,192.168.86.139:6373,192.168.86.140:6375" --targetpassword=123456 --comparemode=1 --comparetimes=1 --qps=10 --batchcount=100 --sourcedbtype=1 --targetdbtype=1

Redis 基于 RedisShake 集群迁移

上一篇:if里面同一个变量同时等于多个值的简化操作


下一篇:HDU 5293 Tree chain problem (树形dp + 树剖 + LCA)