redisshake同步例子(过滤同步)
环境:
OS:Centos 7
RedisShake:v4.2.2
1.下载地址
https://github.com/tair-opensource/RedisShake/releases/download/v4.2.2/redis-shake-linux-amd64.tar.gz
2.解压安装
mkdir -p /opt/redis-shake ##安装包上传到该目录
[root@dev_test_redis soft]# mv redis-shake-linux-amd64.tar.gz /opt/redis-shake/
[root@dev_test_redis soft]# cd /opt/redis-shake/
tar -xvf redis-shake-linux-amd64.tar.gz
3.修改配置文件
vi /opt/redis-shake/shake.toml
4.执行迁移
/opt/redis-shake/redis-shake /opt/redis-shake/shake.toml
配置例子:
1.ecs自己单机redis迁移到阿里云云服务redis(集群模式)
[sync_reader]
cluster = false # set to true if source is a redis cluster
address = "172.1.40.200:6379" # when cluster is true, set address to one of the cluster node
username = "" # keep empty if not using ACL
password = "aaaaaaaaa" # keep empty if no authentication is required
[redis_writer]
cluster = false # set to true if target is a redis cluster
sentinel = false # set to true if target is a redis sentinel
master = "" # set to master name if target is a redis sentinel
address = "r-wzeeeeeeeeeeee:6379" # when cluster is true, set address to one of the clust
er node
username = "" # keep empty if not using ACL
password = "aaaaaaa" # keep empty if no authentication is required
[filter]
# Allow keys with specific prefixes or suffixes
# Examples:
# allow_key_prefix = ["user:", "product:"]
# allow_key_suffix = [":active", ":valid"]
# Leave empty to allow all keys
allow_key_prefix = ["hxl"]
allow_key_suffix = []
说明:
a.目标端阿里云的地址是代理模式的url,内部是集群,但是这里cluster设置成false
b.只同步hxl开头的key
c.需要将程序运行所在ECS的ip加入到阿里云redis云服务的白名单。
d.可以重复执行同步,存在的key会删除
e.过滤多个key,以分号分隔,如:allow_key_prefix = ["hxl","jjf"]
2.集群到集群(自建)
[sync_reader]
cluster = true # set to true if source is a redis cluster
address = "192.168.1.100:6379" # when cluster is true, set address to one of the cluster node
username = "" # keep empty if not using ACL
password = "2018" # keep empty if no authentication is required
[redis_writer]
cluster = true # set to true if target is a redis cluster
sentinel = false # set to true if target is a redis sentinel
master = "" # set to master name if target is a redis sentinel
address = "192.168.1.101:6479" # when cluster is true, set address to one of the cluster node
username = "" # keep empty if not using ACL
password = "2018" # keep empty if no authentication is required
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?