Redis-Shake是一个开源的Redis数据同步工具,它可以帮助我们实现多种数据同步场景,包括从一个Redis实例迁移到另一个Redis实例、从Redis迁移到其他数据存储系统等。
1、下载安装
-- 下载 4.0.2
wget https://github.com/tair-opensource/RedisShake/releases/download/v4.0.2/redis-shake-linux-amd64.tar.gz
-- 解压
tar -zxvf redis-shake-linux-amd64.tar.gz
-- 启动
./redis-shake shake.toml
2、修改Redis-Shake配置文件redis-shake.conf
# 源redis实例的连接信息
[sync_reader]
cluster = false # set to true if source is a redis cluster
address = "192.168.124.23:6379" # when cluster is true, set address to one of the cluster node
username = "" # keep empty if not using ACL
password = "" # keep empty if no authentication is required
tls = false
sync_rdb = true # set to false if you don't want to sync rdb
sync_aof = true # set to false if you don't want to sync aof
# 目标Redis实例的连接信息
[redis_writer]
cluster = false # set to true if target is a redis cluster
address = "192.168.124.22:6379" # when cluster is true, set address to one of the cluster node
username = "" # keep empty if not using ACL
password = "" # keep empty if no authentication is required
tls = false
# 修改恢复的默认动作,rewrite覆盖
rdb_restore_command_behavior = "rewrite"
3、启动脚本
redis-shake-start.sh
#!/bin/bash
nohup ./redis-shake shake.toml 1>> redis-shake.log 2>> redis-shake.log &