rediscompare
简体中文
rediscompare is a command line tool used to compare redis database data consistency

Verification mechanism
rediscompare scans the data in the source database and compares it with the target database through the scan command, and checks it from dimensions such as value length, value, and ttl. Finally, a result file is generated, which contains the key of the data inconsistency and the reason for the inconsistency.
In actual scenarios, some keys may be inconsistent in the first comparison due to transmission delay issues. Rediscompare supports multiple comparisons in a cycle, which is based on the inconsistent keys in the last comparison and generates a result file. The number of cycles can be passed “–comparetimes” "Parameter specification
Scenario
rediscompare provides a comparison plan for the following scenarios according to the different types of targets and sources
-
compare parameters
To compare diff of parameters between two redis insance
-
single2single
Comparison of redis single instance to single instance. Used to compare the data consistency of a single instance single database
-
single2cluster
Used to compare the data consistency between a db in a single instance and the redis native cluster
-
cluster2cluster
Used to compare the data consistency between redis native cluster and native cluster
-
multisingle2single
Used to compare the data consistency between a collection of multiple databases in multiple single instances and a database in a single instance
-
multisingle2cluster
Used to compare the data consistency between multiple databases collections in multiple single instances and a single instance database
quick start
build execute file
git clone https://github.com/TraceNature/rediscompare.git
cd rediscompare
go mod tidy
go mod vendor
go build -o rediscompare
Usage example
rediscompare supports command line mode and interactive mode, interactive mode supports command prompt. The comparison command supports direct command input and yaml customization. Let’s introduce the basic usage of each scene according to the scene.
Use the -i parameter to enter the interactive mode “rediscompare -i”
compare subcommand
The two scenarios of multisingle2single and multisingle2cluster are difficult to express due to the complex mapping relationship of the databases. Currently, only yaml file execution is supported; single2single, single2cluster, cluster2cluster support command line and yaml file mode.
yaml example
For yaml example files, please refer to the .yml file in the execyamlexample directory
result subcommand
The result subcommand is used to format a .result or .rep file. The file is the comparison result, json plaintext. The result command converts the file into a two-dimensional table to increase readability
rediscompare result parse compare_xxxxxxxx.rep
评论