codecamp

Redis到pika迁移工具

名称:

Berry

位置:

pika bin目录下

目的:

方便Redis数据到Pika的迁移

背景:

Pika兼容Redis协议,所以任何使用于Redis的迁移工具同样也适用于Pika,Redis-cli本身提供了一个pipe参数来完成Redis到Redis的数据迁移。该工具的实现方式为读取待迁移Redis的aof文件并批量发送到目的Redis。Berry借鉴这种方式,并增加了如下改进:

  • 迁移过程中,不断读取aof新增内容
  • 错误输出
  • 线程并行方式代替串行方式,提高迁移效率

实现:

reader线程

  1. tail -f 的方式读取指定aof文件中的内容
  2. 根据设定的单次发送长度拼装成块,依次来减少网络通信
  3. 将要发送的块压入队列

sender线程

  1. 从队列中读取一个发送块
  2. 发送到目的服务器
  3. 处理reply信息并做统计

使用:

Parameters:
-i: aof file
-h: the target host
-p: the target port
-a: the target auth
-v: show more information
Example: ./aof -i ./appendonly.aof -h 127.0.0.1 -p 6379 -a abc -v


pika根据时间戳恢复数据工具
Redis请求实时copy到pika工具
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }