• https://github.com/alibaba/RedisShake/wiki/%E8%BF%90%E8%A1%8C%E7%9B%91%E6%8E%A7

redis-shake is a tool for Redis data migration and data filtering.

Feature

  • High performance
  • Tested on Redis 5.0, Redis 6.0 and Redis 7.0
  • Support custom filtering rules
  • Support large instance migration
  • Support restore mode and sync mode
  • ️ Support Aliyun Redis and ElastiCache

For older versions of redis-shake (support codis, twemproxy) please visit here.

Document

Install

Binary package

Download from Release: https://github.com/alibaba/RedisShake/releases

Compile from source

After downloading the source code, run the sh build.sh command to compile.

git clone https://github.com/alibaba/RedisShake
cd RedisShake
sh build.sh

Usage

  1. Edit sync.toml or restore.toml.
  2. Start redis-shake.
./bin/redis-shake redis-shake.toml
# or
./bin/redis-shake restore.toml
  1. Check data synchronization status.

Configure

The redis-shake configuration file refers to sync.toml or restore.toml.

Data filtering

redis-shake supports custom filtering rules using lua scripts. redis-shake can be started with the following command:

./bin/redis-shake sync.toml filter/xxx.lua

Some following filter templates are provided in filter directory:

  1. filter/print.lua:print all commands
  2. filter/swap_db.lua:swap the data of db0 and db1

Custom filter rules

Refer to filter/print.lua to create a new lua script, and implement the filter function in the lua script. The arguments of the function are:

  • id: command id
  • is_base: is the command read from the dump.rdb file
  • group: command group, see the description file under redis/src/commands
  • cmd_name: command name
  • keys: keys in command
  • slots: slots in command
  • db_id: database id
  • timestamp_ms: timestamp of the command in milliseconds. The current version does not support it.

The return value is:

  • code

    • 0: allow this command to pass
    • 1: this command is not allowed to pass
    • 2: this command should not appear, and let redis-shake exit with an error
  • db_id: redirected db_id

Contribution

Lua script

Welcome to share more creative lua scripts.

  1. Add lua scripts under filters/.
  2. Add description to README.md.
  3. Submit a pull request.

Redis Module support

  1. Add code under internal/rdb/types.
  2. Add a command file under scripts/commands, and use the script to generate a table.go file and move it to the internal/commands directory.
  3. Add test cases under test/cases.
  4. Submit a pull request.

感谢

redis-shake 旧版是阿里云基于豌豆荚开源的 redis-port 进行二次开发的一个支持 Redis 异构集群实时同步的工具。 redis-shake v3 在 redis-shake 旧版的基础上重新组织代码结构,使其更具可维护性的版本。

redis-shake v3 参考借鉴了以下项目:

redis-shake的更多相关文章

  1. 使用redis构建可靠分布式锁

    关于分布式锁的概念,具体实现方式,直接参阅下面两个帖子,这里就不多介绍了. 分布式锁的多种实现方式 分布式锁总结 对于分布式锁的几种实现方式的优劣,这里再列举下 1. 数据库实现方式 优点:易理解 缺 ...

  2. Ignite性能测试以及对redis的对比

    测试方法 为了对Ignite做一个基本了解,做了一个性能测试,测试方法也比较简单主要是针对client模式,因为这种方法和使用redis的方式特别像.测试方法很简单主要是下面几点: 不作参数优化,默认 ...

  3. mac osx 安装redis扩展

    1 php -v查看php版本 2 brew search php|grep redis 搜索对应的redis   ps:如果没有brew 就根据http://brew.sh安装 3 brew ins ...

  4. Redis/HBase/Tair比较

    KV系统对比表 对比维度 Redis Redis Cluster Medis Hbase Tair 访问模式    支持Value大小 理论上不超过1GB(建议不超过1MB) 理论上可配置(默认配置1 ...

  5. Redis数据库

    Redis是k-v型数据库的典范,设计思想及数据结构实现都值得学习. 1.数据类型 value支持五种数据类型:1.字符串(strings)2.字符串列表(lists)3.字符串集合(sets)4.有 ...

  6. redis 学习笔记(2)

    redis-cluster 简介 redis-cluster是一个分布式.容错的redis实现,redis-cluster通过将各个单独的redis实例通过特定的协议连接到一起实现了分布式.集群化的目 ...

  7. redis 学习笔记(1)

    redis持久化 snapshot数据快照(rdb) 这是一种定时将redis内存中的数据写入磁盘文件的一种方案,这样保留这一时刻redis中的数据镜像,用于意外回滚.redis的snapshot的格 ...

  8. python+uwsgi导致redis无法长链接引起性能下降问题记录

    今天在部署python代码到预生产环境时,web站老是出现redis链接未初始化,无法连接到服务的提示,比对了一下开发环境与测试环境代码,完全一致,然后就是查看各种日志,排查了半天也没有查明是什么原因 ...

  9. nginx+iis+redis+Task.MainForm构建分布式架构 之 (redis存储分布式共享的session及共享session运作流程)

    本次要分享的是利用windows+nginx+iis+redis+Task.MainForm组建分布式架构,上一篇分享文章制作是在windows上使用的nginx,一般正式发布的时候是在linux来配 ...

  10. windows+nginx+iis+redis+Task.MainForm构建分布式架构 之 (nginx+iis构建服务集群)

    本次要分享的是利用windows+nginx+iis+redis+Task.MainForm组建分布式架构,由标题就能看出此内容不是一篇分享文章能说完的,所以我打算分几篇分享文章来讲解,一步一步实现分 ...

随机推荐

  1. 【乘风破浪的开发者】丁一超:从AI实战营出发探索未知的AI世界

    摘要:从年初的不知不觉进入AI学习的道路,到认识并熟练使用ModelArts平台.虽然只有短短的半年,但这半年的探索学习,让丁一超看清了未来的路在何方. 从招聘网站上输入"人工智能工程技术人 ...

  2. JS引擎(1):JS引擎擂台赛,JavaScript引擎的特征比较及术语科普

    上篇介绍过JavaScript引擎的历史,<JS引擎(0):起底各种JavaScript引擎群雄争霸之路> 一些流行的 JavaScript 引擎 SpiderMonkey ,Brenda ...

  3. Solon Web 开发:四、认识请求上下文(Context)

    Handler + Context 架构,是Solon Web 的基础.在 Context (org.noear.solon.core.handle.Context)里可以获取: 请求相关的对象与接口 ...

  4. ChatGPT访问互联网,不神秘了

    我测试了一下,它其实调用了微软必应的api,搜索了关键词而已 比如我问它:https://twitter.com/elonmusk 马斯克最近在忙什么 它的回答是: 近期,马斯克在做的一些事情包括: ...

  5. Linux day2:文件和文件夹相关命令 文件内容编辑命令 Linux常用目录 Linux重要文件

    目录 问题说明 前期必备知识 系统运行命令 shutdown -c 快捷方式命令 ctrl+e 目录结构相关命令 mkdir -p 文件和文件夹相关命令 创建文件 touch 查看文件和目录 ls - ...

  6. 【源码系列#06】Vue3 Diff算法

    专栏分享:vue2源码专栏,vue3源码专栏,vue router源码专栏,玩具项目专栏,硬核推荐 欢迎各位ITer关注点赞收藏 Vue2 Diff算法可以参考此篇文章[Vue2.x源码系列08]Di ...

  7. 用 ChatGPT 写一篇《ChatGPT 会取代我们的工作吗》

    自从 ChatGPT 火爆以后,最常谈到的话题就是 ChatGPT 会取代我们的工作吗?在写这篇内容时我有个大胆的想法,那就是让 ChatGPT 来取代我的工作. 首先,我决定直接让 ChatGPT ...

  8. k8s-修改线程数

    1.背景: (1)胖容器ssh登录报错:handshake error (2)登录宿主机后,观察pod状态为running,但是kubectl exec 和docker exec 均无法进入该容器,报 ...

  9. GIL 锁或将在 CPython 中成为可选项

    哈喽大家好,我是咸鱼 几天前有媒体报道称,经过多次辩论,Python 指导委员会打算批准通过 PEP 703 提案,让 GIL(全局解释器)锁在 CPython 中成为一个可选项 PEP 703 提案 ...

  10. 【CJsonObject】C++ JSON 解析器使用教程

    能选封装的尽量不使用底层的 一.CJsonObject 简介 CJsonObject 是 Bwar 基于 cJSON 全新开发一个 C++ 版的 JSON 库. CJsonObject 的最大优势是轻 ...