Redis Cluster Synchronous Migration Method (II): implemented by Redis-migrate-tool

Source: Internet
Author: User
Tags redis cluster


The Redis replication method described in the previous chapter has many steps and is prone to error. There are some open source tools on Git that also enable synchronous migration, with simple steps such as Redis-port,redis-migrate-tool tools. The experiment demo uses Redis-migrate-tool to migrate the Redis cluster to a single-instance redis. installation of 1.redis-migrate-toolSee Https://github.com/vipshop/redis-migrate-tool need to note is installed Redis-migrate-tool dependent automake, Libtool, autoconf and bzip2 these packages 2: Operating EnvironmentSOURCE node: 10.86.30.37:36379/10.86.30.37:36380/10.86.30.37:36381[[email protected]_86_30_37_10.86.30.37 redis-migrate-tool]# redis-cli-c-P 36379-h 10.86.30.37 cluster Nodes7fab85269fe72d68414ffd15a54605d45f280aff 10.86.30.37:36381 master-0 1477555329981 7 connected 10001-16383e0c45fe484e55967c968814076b0a5f67f4f6821 10.86.30.37:36380 master-0 1477555330984 8 Connected 5001-10000ba3d6a50ef6bdf6212c0360baec97f29f3b25385 10.86.30.37:36379 myself,master-0 0 6 connected 0-5000 target node: 10.86.30.37:6389 3. Migration Process
    • Redis cluster migrating profiles to Redis Single instance
 
[source]
type: redis cluster
servers: - 10.86.30.37:36379 [target]
type: single
servers: - 10.86.30.37:6389 [common]
listen: 0.0.0.0:8888
    • Executing commands for synchronization
/usr/local/redis-migrate-tool/src/redis-migrate-tool-c mgr.conf-d
    • View the files after synchronization
[[email protected]_86_30_37_10.86.30.37 redis]# redis-cli -h 10.86.30.37 -p 6389 keys \*
1) "5"
2) "2"
3) "1"
4) "10"
5) "12"
6) "3"
7) "4"
8) "13"
9) "11"
[[email protected]_86_30_37_10.86.30.37 redis]# redis-cli -h 10.86.30.37 -p 36379 keys \*
1) "10"
2) "11"
3) "3"
[[email protected]_86_30_37_10.86.30.37 redis]# redis-cli -h 10.86.30.37 -p 36380 keys \*
1) "12"
2) "1"
3) "2"
4) "5"
[[email protected]_86_30_37_10.86.30.37 redis]# redis-cli -h 10.86.30.37 -p 36381 keys \*
1) "13"
2) "4"
All node data is synchronized to the instance node, inserting the data test
[[email protected]_86_30_37_10.86.30.37 redis]# redis-cli -h 10.86.30.37 -p 36379 -c
10.86.30.37:36379> set 30 30
-> Redirected to slot [9877] located at 10.86.30.37:36380
OK
10.86.30.37:36380> set 31 31
-> Redirected to slot [14004] located at 10.86.30.37:36381
OK
10.86.30.37:36381> set 32 32
-> Redirected to slot [1751] located at 10.86.30.37:36379
OK 
[[email protected]_86_30_37_10.86.30.37 redis]# redis-cli -h 10.86.30.37 -p 6389 keys \*
 1) "5"
 2) "30"
 3) "31"
 4) "2"
 5) "1"
 6) "10"
 7) "21"
 8) "12"
 9) "3"
10) "4"
11) "13"
12) "32"
13) "11"
You can see that the new data is also synced to the Redis Single instance node 4. More comprehensive validation with Redis-migrate-tool tools
    • Use the commands provided by Redis-migrate-tool for consistency checking:
[[email protected]_86_30_37_10.86.30.37 redis]# /usr/local/redis-migrate-tool/src/redis-migrate-tool -c mgr.conf log -C redis_check
Check job is running...
 
Checked keys: 1000
Inconsistent value keys: 0
Inconsistent expire keys : 0
Other check error keys: 0
Checked OK keys: 1000
 
All keys checked OK!
Check job finished, used 0.047s
    • Insert validation with commands provided by Redis-migrate-tool:
[[email protected]_86_30_37_10.86.30.37 redis]# /usr/local/redis-migrate-tool/src/redis-migrate-tool -c mgr.conf log -C redis_testinsert
Test insert job is running...
 
Insert string keys: 200
Insert list keys  : 200
Insert set keys   : 200
Insert zset keys  : 200
Insert hash keys  : 200
Insert total keys : 1000
 
Correct inserted keys: 1000
Test insert job finished, used 0.417s
It is important to note that the data that is generated by the insert checksum is not purged, and if it is only for testing functions, the inserted key can be reduced.


Redis Cluster Synchronous Migration Method (II): implemented by Redis-migrate-tool


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.