91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

redis-full-check校驗2個不同redis實例數

發布時間:2020-04-05 07:08:06 來源:網絡 閱讀:623 作者:wjw555 欄目:系統運維

redis-full-check校驗redis數據是否一致:

校驗2個不同的redis實例數據:

6986 為redis實例一
6987 為redis實例二

登錄6986 redis實例一,模擬設置4個key值

[root@localhost redis-full-check-1.4.7]# redis-cli -h 127.0.0.1 -p 6986 -a 'Y2hJKSGtuEq'
Warning: Using a password with '-a' option on the command line interface may not be safe.
127.0.0.1:6986> keys *
(empty list or set)
127.0.0.1:6986> set test001 001
OK
127.0.0.1:6986> set test002 002
OK
127.0.0.1:6986> set test003 003
OK
127.0.0.1:6986> set test004 004
OK
127.0.0.1:6986> keys *
1) "test003"
2) "test002"
3) "test004"
4) "test001"
127.0.0.1:6986>

登錄6987 redis實例二,模擬設置2個key值

[root@localhost redis-full-check-1.4.7]# redis-cli -h 127.0.0.1 -p 6987 -a 'Y2hJKSGtuEq'
Warning: Using a password with '-a' option on the command line interface may not be safe.
127.0.0.1:6987> keys *
(empty list or set)
127.0.0.1:6987> set test002 a02
OK
127.0.0.1:6987> set test004 a04
OK
127.0.0.1:6987> keys *
1) "test004"
2) "test002"
127.0.0.1:6987> 

-m參數指定校驗的模式,校驗的模式分為4種:
-m參數 比較模式,1表示全量比較,2表示只對比value的長度,3只對比key是否存在,4全量比較的情況下,忽略大key的比較

從key名稱來看,6987實例中的key是6986實例key的子集:
不指定校驗模式的話,默認采用的是-m 3 只對比key是否存在。建議在校驗不同redis實例數據時,采用-m 1全量比較模式

把6987實例作為原實例,6986實例作為目標實例,進行校驗:

[root@localhost redis-full-check-1.4.7]# redis-full-check   -s 127.0.0.1:6987  -p 'Y2hJKSGtuEq' -t 127.0.0.1:6986 -a 'Y2hJKSGtuEq'  --log=log  --result=result
[root@localhost redis-full-check-1.4.7]# ls
log  redis-full-check  result  result.db.1  result.db.2  result.db.3

[root@localhost redis-full-check-1.4.7]# sqlite3 result.db.3 
SQLite version 3.7.17 2013-05-20 00:56:22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> select * from key;
sqlite> select * from field;
sqlite>

從key名稱來看,由于6987實例中的key是6986實例key的子集,所以不存在差異

同時從日志中也可以看到:

[INFO 2020-02-08-12:29:32 main.go:65]: init log success
[INFO 2020-02-08-12:29:32 main.go:164]: configuration: {127.0.0.1:6987 Y2hJKSGtuEq auth 0 -1 127.0.0.1:6986 Y2hJKSGtuEq auth 0 -1 result.db result 3 2 unknown unknown unknown 15000 5 256 5 lo
g  false 16384  20445 false}
[INFO 2020-02-08-12:29:32 main.go:166]: ---------
[INFO 2020-02-08-12:29:32 full_check.go:238]: sourceDbType=0, p.sourcePhysicalDBList=[meaningless]
[INFO 2020-02-08-12:29:32 full_check.go:243]: db=0:keys=2
[INFO 2020-02-08-12:29:32 full_check.go:253]: ---------------- start 1th time compare
[INFO 2020-02-08-12:29:32 full_check.go:278]: start compare db 0
[INFO 2020-02-08-12:29:32 scan.go:20]: build connection[source redis addr: [127.0.0.1:6987]]
[INFO 2020-02-08-12:29:33 full_check.go:203]: stat:
times:1, db:0, dbkeys:2, finish:33%, finished:true
KeyScan:{2 2 0}

[INFO 2020-02-08-12:29:33 full_check.go:250]: wait 5 seconds before start
[INFO 2020-02-08-12:29:38 full_check.go:253]: ---------------- start 2th time compare
[INFO 2020-02-08-12:29:38 full_check.go:278]: start compare db 0
[INFO 2020-02-08-12:29:38 full_check.go:203]: stat:
times:2, db:0, finished:true
KeyScan:{0 0 0}

[INFO 2020-02-08-12:29:38 full_check.go:250]: wait 5 seconds before start
[INFO 2020-02-08-12:29:43 full_check.go:253]: ---------------- start 3th time compare
[INFO 2020-02-08-12:29:43 full_check.go:278]: start compare db 0
[INFO 2020-02-08-12:29:43 full_check.go:203]: stat:
times:3, db:0, finished:true
KeyScan:{0 0 0}

[INFO 2020-02-08-12:29:43 full_check.go:328]: --------------- finished! ----------------
all finish successfully, totally 0 key(s) and 0 field(s) conflict

但是把原實例和目標實例互換下比對,就找到不一致了

把6986實例作為原實例,6987實例作為目標實例,進行校驗:

redis-full-check   -s 127.0.0.1:6986  -p 'Y2hJKSGtuEq' -t 127.0.0.1:6987 -a 'Y2hJKSGtuEq'  --log=log  --result=result
[root@localhost redis-full-check-1.4.7]# sqlite3 result.db.3 
SQLite version 3.7.17 2013-05-20 00:56:22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> select * from field;
sqlite> select * from key;
1|test001|string|lack_target|0|3|0
2|test003|string|lack_target|0|3|0

查看到6986實例比6987實例多出了2個key

從日志中也可以看到不同:


[INFO 2020-02-08-12:35:10 main.go:65]: init log success
[INFO 2020-02-08-12:35:10 main.go:164]: configuration: {127.0.0.1:6986 Y2hJKSGtuEq auth 0 -1 127.0.0.1:6987 Y2hJKSGtuEq auth 0 -1 result.db result 3 2 unknown unknown unknown 15000 5 256 5 lo
g  false 16384  20445 false}
[INFO 2020-02-08-12:35:10 main.go:166]: ---------
[INFO 2020-02-08-12:35:10 full_check.go:238]: sourceDbType=0, p.sourcePhysicalDBList=[meaningless]
[INFO 2020-02-08-12:35:10 full_check.go:243]: db=0:keys=4
[INFO 2020-02-08-12:35:10 full_check.go:253]: ---------------- start 1th time compare
[INFO 2020-02-08-12:35:10 full_check.go:278]: start compare db 0
[INFO 2020-02-08-12:35:10 scan.go:20]: build connection[source redis addr: [127.0.0.1:6986]]
[INFO 2020-02-08-12:35:11 full_check.go:203]: stat:
times:1, db:0, dbkeys:4, finish:33%, finished:true
KeyScan:{4 4 0}
KeyConflictInProcess|string|lack_target|{2 2 0}

[INFO 2020-02-08-12:35:11 full_check.go:250]: wait 5 seconds before start
[INFO 2020-02-08-12:35:16 full_check.go:253]: ---------------- start 2th time compare
[INFO 2020-02-08-12:35:16 full_check.go:278]: start compare db 0
[INFO 2020-02-08-12:35:17 full_check.go:203]: stat:
times:2, db:0, finished:true
KeyScan:{2 2 0}
KeyConflictInProcess|string|lack_target|{2 2 0}

[INFO 2020-02-08-12:35:17 full_check.go:250]: wait 5 seconds before start
[INFO 2020-02-08-12:35:22 full_check.go:253]: ---------------- start 3th time compare
[INFO 2020-02-08-12:35:22 full_check.go:278]: start compare db 0
[INFO 2020-02-08-12:35:23 full_check.go:203]: stat:
times:3, db:0, finished:true
KeyScan:{2 2 0}
KeyConflictAtLast|string|lack_target|{2 2 0}
[INFO 2020-02-08-12:35:23 full_check.go:328]: --------------- finished! ----------------
all finish successfully, totally 4 key(s) and 0 field(s) conflict

value: field存在于源端key和目的端key,但是field對應的value不同
登錄6987redis實例,修改key test004 為a04; 修改key test003 a03

[root@localhost redis-full-check-1.4.7]# redis-cli -h 127.0.0.1 -p 6987 -a 'Y2hJKSGtuEq'
Warning: Using a password with '-a' option on the command line interface may not be safe.
127.0.0.1:6987> get test004
"a04"
127.0.0.1:6987> get test002
"002"
127.0.0.1:6987> get test001
"001"
127.0.0.1:6987> get test003
"a03"

此時采用redis-full_check全量校驗模式:

[root@localhost redis-full-check-1.4.7]# redis-full-check   -s 127.0.0.1:6987  -p 'Y2hJKSGtuEq' -t 127.0.0.1:6986 -a 'Y2hJKSGtuEq'  --log=log  --result=result -m 1
[root@localhost redis-full-check-1.4.7]# redis-full-check   -s 127.0.0.1:6987  -p 'Y2hJKSGtuEq' -t 127.0.0.1:6986 -a 'Y2hJKSGtuEq'  --log=log  --result=result -m 4

[root@localhost redis-full-check-1.4.7]#  redis-full-check   -s 127.0.0.1:6986  -p 'Y2hJKSGtuEq' -t 127.0.0.1:6987 -a 'Y2hJKSGtuEq'    --result=result -m 1
[INFO 2020-02-08-14:44:36 main.go:65]: init log success
........
........
[INFO 2020-02-08-14:44:49 full_check.go:328]: --------------- finished! ----------------
all finish successfully, totally 4 key(s) and 0 field(s) conflict

日志中看到2實例存在數據不一致

查看到實例6986 和實例6987 中key test003 和test004 的value值不一致:

[root@localhost redis-full-check-1.4.7]# sqlite3 result.db.3 
SQLite version 3.7.17 2013-05-20 00:56:22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> select * from key;
1|test004|string|value|0|3|3
2|test003|string|value|0|3|3
sqlite> 

登錄6987redis實例,刪除key test001:

[root@localhost redis-full-check-1.4.7]# redis-cli -h 127.0.0.1 -p 6987 -a 'Y2hJKSGtuEq'
Warning: Using a password with '-a' option on the command line interface may not be safe.
127.0.0.1:6987> get test001
"001"
127.0.0.1:6987> get test002
"002"
127.0.0.1:6987> get test003
"a03"
127.0.0.1:6987> get test004
"a04"
127.0.0.1:6987> del test002
(integer) 1
127.0.0.1:6987> keys *
1) "test001"
2) "test004"
3) "test003"

此時采用redis-full_check全量校驗模式:

[root@localhost redis-full-check-1.4.7]#  redis-full-check   -s 127.0.0.1:6986  -p 'Y2hJKSGtuEq' -t 127.0.0.1:6987 -a 'Y2hJKSGtuEq'    --result=result -m 1
[INFO 2020-02-08-14:54:25 main.go:65]: init log success
...............
...............
[INFO 2020-02-08-14:54:38 full_check.go:328]: --------------- finished! ----------------
all finish successfully, totally 6 key(s) and 0 field(s) conflict

發現實例6986 和實例6987中存在key和value值不一致:

[root@localhost redis-full-check-1.4.7]# sqlite3 result.db.3 
SQLite version 3.7.17 2013-05-20 00:56:22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> select * from key;
1|test004|string|value|0|3|3
2|test003|string|value|0|3|3
3|test002|string|lack_target|0|3|0
sqlite> select * from field;
向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

汝州市| 富蕴县| 华蓥市| 武乡县| 桐城市| 谢通门县| 灵宝市| 资讯| 商都县| 崇州市| 峨山| 遂平县| 巴楚县| 万荣县| 丹江口市| 两当县| 西安市| 阜平县| 白山市| 溧水县| 泗洪县| 博野县| 涟水县| 永清县| 丽江市| 东方市| 龙川县| 丹江口市| 满洲里市| 河西区| 黄平县| 明水县| 山阳县| 肇州县| 城固县| 温州市| 勐海县| 徐水县| 荥经县| 东乡| 关岭|