Commit 287b1413 authored by 宋柯's avatar 宋柯

redis清理

parent ec6755a3
...@@ -253,10 +253,10 @@ nodes=['7877da182171e313bc9326729f82999d1b629c79' ...@@ -253,10 +253,10 @@ nodes=['7877da182171e313bc9326729f82999d1b629c79'
,'f3f1ec6df458a5093c31663517a3cadaed5ab29c' ,'f3f1ec6df458a5093c31663517a3cadaed5ab29c'
,'d35c630aad0a8b7f579bf4100f2860401b5d4f52'] ,'d35c630aad0a8b7f579bf4100f2860401b5d4f52']
# keys = ['rims:tag_v3:coldstart:','doris:tag_v3:coldstart:'] # keys = ['rims:tag_v3:coldstart:','doris:tag_v3:coldstart:']
keys = [''] search_keys = ['']
# conn2 = getRedisConn2() # conn2 = getRedisConn2()
for key_k in keys: for search_key in search_keys:
key = key_k + '*' search_key = search_key + '*'
sum = 0 sum = 0
key_sum = 0 key_sum = 0
conn = getRedisConn4() conn = getRedisConn4()
...@@ -268,16 +268,16 @@ for key_k in keys: ...@@ -268,16 +268,16 @@ for key_k in keys:
cursor = "0" cursor = "0"
while True: while True:
del_datas = set() del_datas = set()
cursor, data = conn.execute_command("scan {} match {} count {} {}".format(cursor,key,10,node)) cursor, keys = conn.execute_command("scan {} match {} count {} {}".format(cursor,search_key,10,node))
cursor = str(cursor,encoding='utf-8') cursor = str(cursor,encoding='utf-8')
for d in data: for key in keys:
dd = str(d, encoding='utf-8') key = str(key, encoding='utf-8')
print(dd) print("key:{}".format(key))
# if len(dd) > 0 and dd.startswith(key_k): # if len(dd) > 0 and dd.startswith(key_k):
# del_datas.add(str(d, encoding='utf-8')) # del_datas.add(str(d, encoding='utf-8'))
sum += len(data) sum += len(keys)
key_sum += len(del_datas) key_sum += len(del_datas)
print("node:{},cursor:{},len(data):{},sum:{}".format(node,cursor, len(data), sum)) print("node:{},cursor:{},len(keys):{},sum:{}".format(node,cursor, len(keys), sum))
break break
# pipline = conn.pipeline() # pipline = conn.pipeline()
# for d in del_datas: # for d in del_datas:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment