【Redis】RedisCluster 批量刪除key
阿新 • • 發佈:2019-01-26
首先使用客戶端redis-cli連線你的RedisCluster其中任何一個節點
redis-cli -h host -p post -a password
檢視叢集資訊,找出所有的master節點, 命令如下
cluster nodes
修改如下shell指令碼(redis_delete_key.sh),redis_list為叢集主節點,password是你的叢集密碼
redis_list=("host:post" "host:post") password="redispassword==" for info in ${redis_list[@]} do echo
找出所有要刪除的key,輸出到文字key.txt裡(這裡找的是所有baidu_字首的key)
redis-cli -h 10.16.1.1 -p 6389 keys "baidu_*" >>
執行指令碼,開始批量刪除,當key比較多的時候,耗時較長
sh redis_delete_key.sh