shell - 删除redis key
2021-07-05
#!/bin/bash
num=0
for (( i=0;i<500;i++))
do
echo "游标:"$num
redis-cli -h r-bp1kn32j5t7mvdx2wt.redis.rds.aliyuncs.com -a xxxxx -n 1 --raw scan ${num} match 20041:xxxx* count 10000 | xargs redis-cli -h r-bp1kn32j5t7mvdx2wt.redis.rds.aliyuncs.com -a xxxxx -n 1 del
num=$(redis-cli -h r-bp1kn32j5t7mvdx2wt.redis.rds.aliyuncs.com -a xxxxx -n 1 --raw scan ${num} match 20041:xxxx* count 10000 | grep -Po [0-9]+ | head -n1)
done