Kubernetes集群外连接redis集群和使用redis-shake工具迁移数据(二)

Kubernetes集群外连接redis集群和使用redis-shake工具迁移数据(一)
Kubernetes集群外连接redis集群和使用redis-shake工具迁移数据(二)

文章目录

一、RedisShake

RedisShake 是一个 Redis 数据同步工具,主要用于实现两个 Redis 实例之间的数据同步。它支持多种同步模式,包括但不限于:

全量同步:将源 Redis 实例中的所有数据复制到目标实例中。

增量同步:在全量同步之后,继续监听源实例的数据变化,并实时同步到目标实例。

指定键同步:用户可以指定需要同步的键或键模式,这样只有符合模式的数据会被同步。

RedisShake 的设计目的是为了满足不同场景下的数据迁移、备份、复制等需求,它能够帮助用户减少数据同步过程中的复杂性和错误率。此外,RedisShake 支持跨网络环境的数据同步,比如从本地环境同步数据到云上环境,或者在不同的云服务提供商之间进行数据同步。

使用 RedisShake 进行数据同步时,通常需要注意配置文件的设置,确保源和目标 Redis 实例的连接信息正确无误,并根据实际需求选择合适的同步模式。此外,还需要考虑同步过程中可能遇到的数据冲突处理方式,以及如何保证数据的一致性等问题。

GitHub地址:https://github.com/tair-opensource/RedisShake

官方地址:https://tair-opensource.github.io/RedisShake/zh

二、Cluster模式迁移

编辑 shake.toml 文件
cat shake.toml | grep -v "^#"

bash 复制代码
[sync_reader]
cluster = true   #源是集群模式,需要开启         # set to true if source is a redis cluster
address = "源redis url:6379" # when cluster is true, set address to one of the cluster node
username = ""              # keep empty if not using ACL
password = "woshimima"              # 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
prefer_replica = false     # set to true if you want to sync from replica node
try_diskless = false       # set to true if you want to sync by socket and source repl-diskless-sync=yes




[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.10:30111" # when cluster is true, set address to one of the cluster node
username = ""              # keep empty if not using ACL
password = "woshimima"              # keep empty if no authentication is required
tls = false
off_reply = false          # turn off the server reply

[filter]
allow_key_prefix = []
allow_key_suffix = []

block_key_prefix = []
block_key_suffix = []

allow_db = []
block_db = []

allow_command = [] 
block_command = [] 

allow_command_group = [] 
block_command_group = [] 

function = ""

[advanced]
dir = "data"
ncpu = 0        # runtime.GOMAXPROCS, 0 means use runtime.NumCPU() cpu cores
pprof_port = 0  # pprof port, 0 means disable
status_port = 0 # status port, 0 means disable

log_file = "shake.log"
log_level = "info"     # debug, info or warn
log_interval = 5       # in seconds

rdb_restore_command_behavior = "panic" # panic, rewrite or skip

pipeline_count_limit = 1024

target_redis_client_max_querybuf_len = 1073741824  # 1GB in bytes

target_redis_proto_max_bulk_len = 512_000_000

aws_psync = "" # example: aws_psync = "10.0.0.1:6379@nmfu2sl5osync,10.0.0.1:6379@xhma21xfkssync"

empty_db_before_sync = false

[module]
target_mbbloom_version = 20603

我测试的时候,打了一个redis-shake 4.2.1版本的镜像swr.cn-north-4.myhuaweicloud.com/asdl-aps/softwares/redis-shake:20241119,进入到cd /RedisShake/bin/目录下,运行./redis-shake shake.toml开始全量和增量同步数据

相关推荐
deeper_wind4 小时前
k8s-单主机Master集群部署+单个pod部署lnmp论坛服务(小白的“升级打怪”成长之路)
云原生·容器·kubernetes
海梨花5 小时前
【从零开始学习Redis】项目实战-黑马点评D2
java·数据库·redis·后端·缓存
zhenshanrenhao6 小时前
#买硬盘欲安装k8s记
云原生·容器·kubernetes
tb_first8 小时前
k8sday09
linux·云原生·容器·kubernetes
稚辉君.MCA_P8_Java9 小时前
豆包 Java的23种设计模式
java·linux·jvm·设计模式·kubernetes
天上掉下来个程小白10 小时前
Docker-14.项目部署-DockerCompose
运维·docker·微服务·容器
星霜笔记14 小时前
Docker 部署 MariaDB+phpMyAdmin+Nextcloud 完整教程
运维·数据库·docker·容器·mariadb
数据知道17 小时前
容器化部署:用Docker封装机器翻译模型与服务详解
docker·容器·机器翻译
鼠鼠我捏,要死了捏21 小时前
生产环境Redis缓存穿透与雪崩防护性能优化实战指南
redis·cache
40kuai1 天前
kubernetes中数据存储etcd
容器·kubernetes·etcd