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 "^#"

[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.3.2版本的镜像swr.cn-north-4.myhuaweicloud.com/dongweizhen/softwares/redis-shake:4.3.2,进入到cd /RedisShake/bin/目录下,修改redis迁移配置,运行./redis-shake shake.toml开始全量和增量同步数据

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

运维归一

整理不易,请个辣条吃吧

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值