Redis-full-check is used to compare whether two redis have the same data. We also offer a data synchronization tool called [redis-shake](https://github.com/aliyun/redis-shake) to syncing data from one redis to another redis.<br>
Thanks to the Douyu's WSD team for the support. <br>
* [中文文档](https://yq.aliyun.com/articles/690463)
* [Download redis-full-check.tar.gz](https://github.com/alibaba/RedisFullCheck/releases)
* [第一次使用,如何进行配置](https://github.com/alibaba/RedisFullCheck/wiki/%E7%AC%AC%E4%B8%80%E6%AC%A1%E4%BD%BF%E7%94%A8%EF%BC%8C%E5%A6%82%E4%BD%95%E8%BF%9B%E8%A1%8C%E9%85%8D%E7%BD%AE%EF%BC%9F)
# redis-full-check
---
Redis-full-check is developed and maintained by NoSQL Team in Alibaba-Cloud Database department.<br>
Redis-full-check performs full data verification by comparing the data of the source database and the destination database. The entire check process consists of multiple comparisons, in every comparison, redis-full-check fetches data from two dabatases and then compared, the inconsistent data is put into sqlite3 db for the next comparison. By this iteratively comparing method, the difference continues to converge. The following figure shows the dataflow. In every comparison which is the yellow box, redis-full-check fetches all keys firstly. After that, it runs comparison and stores the difference result(key and field) into the sqlite3 db which is the position that keys and fields can be fetched in next round instead of the source database.<br>
![dataflow.png](https://github.com/aliyun/redis-full-check/blob/master/resources/dataflow.png)<br>
Redis-full-check fetches keys from source and then checks these keys exist on the target. So if one key exists on the target but lack on the source, redis-full-check can't find it. If you want to know whether the data in the source and destination databases are exactly the same, you need to set up a bidirectional link: <br>
* source->RedisFullCheck->target
* target->RedisFullCheck->source
# supports
standalone, cluster, proxy(aliyun-cluster, tencent-cluster). Redis version from 2.x to 7.x (Don't support Redis Modules).
# Code branch rules
Version rules: a.b.c.<br>
* a: major version
* b: minor version. even number means stable version.
* c: bugfix version
| branch name | rules |
| - | :- |
| master | master branch, do not allowed push code. store the latest stable version. develop branch will merge into this branch once new version created. |
| **develop**(main branch) | develop branch. all the bellowing branches fork from this. |
| feature-\* | new feature branch. forked from develop branch and then merge back after finish developing, testing, and code review. |
| bugfix-\* | bugfix branch. forked from develop branch and then merge back after finish developing, testing, and code review. |
| improve-\* | improvement branch. forked from develop branch and then merge back after finish developing, testing, and code review. |
Tag rules:<br>
Add tag when releasing: "release-v{version}-{date}". for example: "release-v1.0.2-20180628"
# Paramters
```
Usage:
redis-full-check [OPTIONS]
Application Options:
-s, --source=SOURCE Set host:port of source redis.
-p, --sourcepassword=Password Set source redis password (format: password or username:password)
--sourceauthtype=AUTH-TYPE useless for opensource redis, valid value:auth/adminauth (default: auth)
-t, --target=TARGET Set host:port of target redis.
-a, --targetpassword=Password Set target redis password (format: password or username:password)
--targetauthtype=AUTH-TYPE useless for opensource redis, valid value:auth/adminauth (default: auth)
-d, --db=Sqlite3-DB-FILE sqlite3 db file for store result. If exist, it will be removed and a new file is created. (default: result.db)
--comparetimes=COUNT Total compare count, at least 1. In the first round, all keys will be compared. The subsequent rounds of the comparison
will be done on the previous results. (default: 3)
-m, --comparemode= compare mode, 1: compare full value, 2: only compare value length, 3: only compare keys outline, 4: compare full value,
but only compare value length when meets big key (default: 2)
--id= used in metric, run id (default: unknown)
--jobid= used in metric, job id (default: unknown)
--taskid= used in metric, task id (default: unknown)
-q, --qps= max qps limit (default: 15000)
--interval=Second The time interval for each round of comparison(Second) (default: 5)
--batchcount=COUNT the count of key/field per batch compare, valid value [1, 10000] (default: 256)
--parallel=COUNT concurrent goroutine number for comparison, valid value [1, 100] (default: 5)
--log=FILE log file, if not specified, log is put to console
--result=FILE store all diff result, format is 'db diff-type key field'
--metric=FILE metrics file
--bigkeythreshold=COUNT
-f, --filterlist=FILTER if the filter list isn't empty, all elements in list will be synced. The input should be split by '|'. The end of the
string is followed by a * to indicate a prefix match, otherwise it is a full match. e.g.: 'abc*|efg|m*' matches 'abc',
'abc1', 'efg', 'm', 'mxyz', but 'efgh', 'p' aren't'
-v, --version
Help Options:
-h, --help Show this help message
```
# Usage
---
Run `./bin/redis-full-check.darwin64` or `redis-full-check.linux64` which is built in OSX and Linux respectively, however, the binaries aren't always the newest version.<br>
Or you can build redis-full-check yourself according to the following steps:<br>
* git clone https://github.com/alibaba/RedisFullCheck.git
* cd RedisFullCheck/
* ./build.sh
* ./bin/redis-full-check -s $(source_redis_ip_port) -p $(source_password) -t $(target_redis_ip_port) -a $(target_password) # these parameters should be given by users
Here comes the sqlite3 example to display the conflict result:<br>
```
$ sqlite3 result.db.3 # result.db.x shows the x-round comparison conflict result. len == -1 means inconsistent key type.
sqlite> select * from key;
id key type conflict_type db source_len target_len
---------- --------------- ---------- ------------- ---------- ---------- ----------
1 keydiff1_string string value 1 6 6
2 keydiff_hash hash value 0 2 1
3 keydiff_string string value 0 6 6
4 key_string_diff string value 0 6 6
5 keylack_string string lack_target 0 6 0
sqlite>
sqlite> select * from field;
id field conflict_type key_id
---------- ---------- ------------- ----------
1 k1 lack_source 2
2 k2 value 2
3 k3 lack_target 2
```
# Shake series tool
---
We also provide some tools for synchronization in Shake series.<br>
* [MongoShake](https://github.com/aliyun/MongoShake): mongodb data synchronization tool.
* [RedisShake](https://github.com/aliyun/RedisShake): redis data synchronization tool.
* [RedisFullCheck](https://github.com/aliyun/RedisFullCheck): redis data synchronization verification tool.
# License
- On `20230427` and later, we distribute this library under the new [Apache2.0](https://www.apache.org/licenses/LICENSE-2.0) protocol, `1.4.10` is the first version to support the Apache2.0 protocol.
- Prior to 20230427, it was distributed under the [GPLV3.0](https://www
赵闪闪168
- 粉丝: 1726
- 资源: 6942
最新资源
- 家用干果机行业分析:2023年全球市场规模大约为1105百万美元.docx
- 卡车变电站市场分析:2023年全球市场规模大约为939百万美元.docx
- 抗炎治疗行业分析:全球抗炎治疗市场规模约为1137.4亿美元.docx
- 科研仪器行业市场:2023年全球市场规模大约为70930百万美元.docx
- 客户服务业务流程外包行业分析:全球收入约为587.6亿美元.docx
- 实验报告.pptx - 数据结构实验操作步骤与结果分析报告
- 蓝牙耳机电池行业分析:TWS耳机是最主要的应用领域.docx
- 客户关系管理软件行业分析:全球收入约为8444.7百万美元.docx
- 冷链监测行业市场分析:北美是全球最大的市场,占约26%份额.docx
- 轮胎动平衡市场分析:2023年全球市场规模大约为708百万美元.docx
- 硫酸镍行业分析:2023年全球市场规模大约为9041百万美元.docx
- 密密钥管理行业分析:北美和亚太占全球约75%的全球市场份额.docx
- 民意调查软件市场分析:北美是全球市场的主要地区,占约50%的市场份额.docx
- 企业评估服务市场分析:全球收入约为3425.4百万美元.docx
- 驱蚊产品市场分析:亚太是全球市场的主要地区.docx
- 汽车原始设备制造商工厂内物流行业分析:华东地区是中国最大的消费市场,约占30%.docx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈