Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
86 lines (65 sloc) 3.56 KB


redis-migration is a fast, light-weight migration tool for redis. Just add a new file "redis-migration.c" to the redis sources. We scale out our redis clusters by this tool. Please google(baidu) "redis-migration:独创的redis在线数据迁移工具" for more info. Btw, there is a flash for redis migration in source code, 'redis replication flash.pptx'.

redis-migrate是一款超轻量级的redis数据迁移工具,保持redis源码文件不做改动的前提下,只新增加了一个"redis-migration.c"文件,大家可以使用google或者baidu搜索"redis-migration:独创的redis在线数据迁移工具"获取更详细信息。另,源码包里附上了一份redis数据迁移的动画'redis replication flash.pptx',希望大家喜欢。

Thank you for your use and attention, i am very very happy ^_^



To build redis-migration from source:

$ git clone
$ cd redis-migration/deps/
$ chmod +x
$ ./ 3.6.0
$ cd jemalloc
$ ./configure
$ make
$ make install

$ cd ../../src/
$ chmod +x
$ ./
$ cd ../
$ make
$ make install


Usage: redis-migration [options]
       redis-migration -v or --version
       redis-migration -h or --help
       redis-migration -sip: source ip
       redis-migration -sport: source port
       redis-migration -sauth: source password
       redis-migration -dip: destination ip
       redis-migration -dport: destination port
       redis-migration -dauth: destination auth
       redis-migration -rdb: rdb file (snapshot data)
       redis-migration -aof: aof file (delta data)
       redis-migration -client: client num
       ./redis-migration -h
       ./redis-migration -v
       ./redis-migration -sip -sport 6379 -sauth 123456 -dip -dport 6379 -dauth 654321
       ./redis-migration -sip -sport 6379 -sauth 123456 -dip -dport 6379 -dauth 654321 -rdb /tmp/dump.rdb -aof /tmp/appendonly.aof -client 100


Here we use 'twemproxy' as 'destination'.

1.Dirty data:
    It's very important to empty the database on destination(dip:dport) before migrating data, otherwise 
      there will be dirty data or exception.

    Remember that the tool only support db0 database now, but you could comment the code in "redis-migration.c" 
      to support more dbs:
        line 1108   /*if (dbid != 0) {
        line 1109       fprintf(stderr, "Error, RDB file has database:%d\n", dbid);
        line 1110       exit(1);
        line 1111   }*/

    1)Server closed the TCP connection: 

image there any unsupported command for 'twemproxy'? you set 'timeout' parameter in redis.conf which belongs to destination's redis-server? jitter?



        a.there is a very very large key/value pair: you could increase the 'timeout' value in 'twemproxy' 
          to solve this problem;



        a.there is repeated data from multiple sip, such as key1 in sip1 and sip2.
        b.dirty data: do you empty the redis-serveres of 'destination'?