Redis 数据迁移工具Redis-shake

Redis-shake 数据迁移工具

redis-shake 是阿里云开源的用于 Redis 数据迁移和过滤的工具。

redis-shake 支持特性:

  • 🚄 高性能
  • ✅ 在Redis 5.0、Redis 6.0和Redis 7.0上测试
  • 🤗 支持自定义过滤规则
  • 💪 支持大实例迁移
  • 💖支持模式:restore mode,sync mode和scan mode
  • ☁️ 支持阿里云Redis和ElastiCache

项目地址:https://github.com/alibaba/RedisShake

对于旧版本的redis-shake(支持codis,twemproxy)请 访问 这里

redis-shake2.PNG

Redis-shake 快速体验

1、下载 redis-shake 二进制包

1
2
3
# wget https://github.com/alibaba/RedisShake/releases/download/v3.1.4/redis-shake-linux-amd64.tar.gz
# mkdir redis-shake
# tar xf redis-shake-linux-amd64.tar.gz -C ./redis-shake

2、创建迁移配置文件

完整示例配置文件参考:https://github.com/alibaba/RedisShake/blob/v3/redis-shake.toml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
[root@redis redis-shake]# vim sync.toml
type = "sync"

[source]
version = 4.0 # redis version, such as 2.8, 4.0, 5.0, 6.0, 6.2, 7.0, ...
address = "172.101.79.100:6379"
username = "" # keep empty if not using ACL
password = "*********" # keep empty if no authentication is required
tls = false

[target]
version = 4.0
address = "10.57.0.3:6001"
username = ""
password = "*********"
tls = false

单机到集群迁移示例配置文件

1
2
3
4
5
6
7
8
[source]
address = "r-aaaaa.redis.zhangbei.rds.aliyuncs.com:6379"
password = "r-aaaaa:xxxxx"

[target]
type = "cluster"
address = "192.168.0.1:6379" # 这里写集群中的任意一个节点的地址即可
password = "r-ccccc:xxxxx"

更多迁移模式可以查看github示例

3、执行redis数据库迁移

1
[root@redis redis-shake]# ./redis-shake sync.toml
-------------本文结束感谢您的阅读-------------