Commit cf8ba4bb authored by 宋柯's avatar 宋柯

redis清理

parent 2edb98a8
......@@ -288,8 +288,21 @@ for search_key in search_keys:
if cursor == "0":
break
print("node: {}, cursor: {}, node_key_count: {}, node_del_key_count: {}, node_del_key_rate: {}%".format(node, cursor, node_key_count, len(node_del_key_list), 100 * len(node_del_key_list) / node_key_count))
node_del_key_count = len(node_del_key_list)
print("node: {}, cursor: {}, node_key_count: {}, node_del_key_count: {}, node_del_key_rate: {}%".format(node, cursor, node_key_count, node_del_key_count, 100 * len(node_del_key_list) / node_key_count))
print("node: {}, node_del_key_sample_100: {}".format(node, np.random.choice(node_del_key_list, 50, replace= False)))
node_del_batch_size = 10000
node_has_del_key_count = 0
for batch_start_idx in range(len(node_del_key_list), node_del_batch_size):
node_del_key_batch_list = node_del_key_list[batch_start_idx : batch_start_idx + node_del_batch_size]
pipline = conn.pipeline()
for node_del_key in node_del_key_batch_list:
pipline.delete(node_del_key)
pipline.execute()
node_has_del_key_count += len(node_del_key_batch_list)
print("node: {}, node_has_del_key_count: {}, node_del_key_count: {}, node_has_del_key_rate: {}%".format(node, node_has_del_key_count, node_del_key_count, 100 * node_has_del_key_count / node_del_key_count))
print("")
#
# nodes = ['7877da182171e313bc9326729f82999d1b629c79'
......
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