Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use Redis-full-check

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the relevant knowledge of "how to use Redis-full-check". In the operation of actual cases, many people will encounter such a dilemma. Then let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Installation

Redis-full-check is an open source tool of Ali, GitHub address https://github.com/alibaba/RedisFullCheck, we need to find a Linux machine before installation, and the version of GLIBC needs to be higher than 2.14, otherwise we will be prompted / lib64/libc.so.6: version GLIBC_2.14 not found. We have two ways to download, the first is to download directly locally and then upload to the server, and the other is to execute wget https://github.com/alibaba/RedisFullCheck/releases/download/release-v1.4.8-20200212/redis-full-check-1.4.8.tar.gz directly on the server to download. Extract the tar xzvf redis-full-check-1.4.8.tar.gz after the download is complete. The specific process is as follows:

Check the GLIBC version of the current server and execute the command strings / lib64/libc.so.6 | grep GLIBC_, is shown in the following figure. If it is higher than 2.14, you can consider changing the server or updating it yourself, but please be careful if there is a risk of update. The specific update method is Baidu.

Download the compressed package and execute: decompress wget https://github.com/alibaba/RedisFullCheck/releases/download/release-v1.4.8-20200212/redis-full-check-1.4.8.tar.gz when the download is complete. Ah Fan has already been downloaded here, so there is no need to download it again. After decompression, enter the directory and enter. / redis-full-check-v if you can see the version number normally, it means that the download and installation is successful.

Use

Before using this tool, what you need is two different Redis instances. Ah Fan already has it because it is switched from a stand-alone machine to a cluster. Below, there are stand-alone machines and clusters to show you. We execute the following command:. / redis-full-check-s "172.20.xxx.xxx:6379"-p "sourcePassword"-- sourcedbfilterlist=0-t "172.20.xxx.xxxride 6379There is 172.20.yyy.yyyy.yyy sourcePassword 6379"-a "targetPassword"-- targetdbtype=1

Description:

-s: indicates the source Redis instance

P: source Redis password

-- sourcedbfilterlist: matches the specified db library. A specific db library can be set for a single set of Redis, but not in the cluster environment. Decide whether to use it or not according to your own situation.

-t: target Redis, A Fan is a cluster, so there will be multiple nodes, each separated by a semicolon. In addition, note that all master nodes or all slave nodes must be entered here, not mixed. All the master nodes filled in here are successful, but all the slave seems to have failed, so you can try it yourself.

-a: indicates the password of the target Redis

-- targetdbtype=1: type of target Redis environment, 0:db (standalone single node, master-slave), 1: cluster (cluster version), 2: Ali Cloud

The detailed parameters are as follows:

-s,-- source=SOURCE source db library address (ip:port). If it is a cluster version, you need to separate different reds with a semicolon (;). You only need to configure one of the master or slaves. For example: 10.1.1.1VOLTING 1000TIX 10.2.2.2VOLTITITY 10.3.3.3RHANG 3000. -p,-- sourcepassword=Password source redis library password-- sourceauthtype=AUTH-TYPE source library management permissions. This parameter is useless under open source reids. -- Category of sourcedbtype= source database, 0:db (standalone single node, master / slave), 1: cluster (cluster version), 2: Ali Cloud-logical db whitelist to be crawled by sourcedbfilterlist= source database, separated by semicolon (;), for example: 0t5 15 means that both db0,db5 and db15 will be crawled-t,-- target=TARGET destination redis library address (ip:port)-a,-- targetpassword=Password destination redis library password-- targetauthtype=AUTH-TYPE destination library management permission. This parameter is useless under open source reids. -- targetdbtype= reference sourcedbtype-- targetdbfilterlist= reference sourcedbfilterlist-d,-- db=Sqlite3-DB-FILE for the location of the sqlite3 db stored in the differential key, the default result.db-- comparetimes=COUNT compares the number of rounds-m,-- comparemode= comparison mode, 1 indicates full comparison, 2 indicates only the length of the value, 3 only compares the existence of the key. 4 in the case of full comparison Ignore the comparison of large key-- id= is used to hit metric-- jobid= is used to hit metric-- taskid= is used to hit metric-Q -- qps= qps speed limit threshold-- time interval between each round of interval=Second-- number of batchcount=COUNT batch aggregations-- number of concurrent collaborations for parallel=COUNT comparison Default 5-- log=FILE log file-- result=FILE inconsistent results are recorded in result file. Format:'db diff-type key field'-- metric=FILE metric file-- threshold for bigkeythreshold=COUNT large key split, used for comparemode=4-f,-- key list to be compared by filterlist=FILTER, with semicolon ( ) split. For example: "abc* | efg | m *" means to compare 'abc',' abc1', 'efg',' masks, and 'mxyz', does not compare to' efgh','p'. -v,-- version to view the results

After executing the above command, three files will be generated in the current directory, namely result.db.1,result.db.2,result.db.3. We can query through the sqlite3 tool.

Enter the terminal through the sqlite3 result.db.3 command, and then query the data we need from the key table. Sqlite3 tool is a database similar to MySQL, you can study how to use it yourself, and then you can share it with you later.

From the above, we can find that this result looks very uncomfortable. Ah Fan will teach you a few more tricks to make it look better! After entering the terminal, we enter the following commands in turn

Header on opens the header, id is just a serial number, key represents the key,type representation type in the source Redis, db represents the db library of the source Redis where the key resides, source_len, and target_len represents the length of the value in the source Redis and destination Redis, respectively. We can quickly view different data by length.

.mode column sets the output mode

.widht int int... Set the length of each column to make it more beautiful

Exit the terminal

Through this output, we can clearly see which data are inconsistent, thus comparing the data of the two Redis instances, it is important to note that Redis-full-check compares whether the source instance is a subset of the target instance!

That's all for the content of "how to use Redis-full-check". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report