当前位置:网站首页>Redis batch deletes keys with specific prefixes
Redis batch deletes keys with specific prefixes
2022-07-19 03:53:00 【Lao Wang's notes】
The methods usually given are as follows
./redis-cli -a password keys "test*" | xargs ./redis-cli -a password del
But this can be deleted in the case of a single machine , If it's in Redis Errors will be reported in the cluster ;
The experiment is as follows :
Make numbers :
for x in {1..100};do echo $x;redis-cli -h 127.0.0.1 -p 6379 set k$x v$x;done
~]# redis-cli -h 127.0.0.1 -p 6379 keys "k*"
1) "k52"
...
37) "k75"
38) "k3"
39) "k79"Delete
~]# redis-cli -h 127.0.0.1 -p 6379 keys "k*" | xargs redis-cli -h 127.0.0.1 -p 6379 del
(error) CROSSSLOT Keys in request don't hash to the same slot
We can write a for Cycle to delete ;
for x in `redis-cli -h 127.0.0.1 -p 6379 keys "k*"`;do echo $x; redis-cli -h 127.0.0.1 -p 6379 del $x;done
k52
(integer) 1
k6
(integer) 1
.
.
.
(integer) 1
k79
(integer) 1边栏推荐
猜你喜欢
随机推荐
Matlab绘制激活函数sigmoid,Relu
当 mysql 表从压缩表变成普通表会发生什么?
DataX dorisworter plug-in documentation
数学建模比赛论文模板格式
Understanding of random forest
Bias and variance
Hcip Experiment 5
HCIP第七天笔记
【Try to Hack】NTLM身份验证过程
Latex environment configuration based on pandoc and vscode
2022 electrician Cup: emergency material distribution in 5g network environment (optimization)
windows10:vscode下go语言的适配
Web semantics (emphasis tag EM italic) (emphasis tag strong bold) (custom list: DL, DT, DD)
Nature Communications
laradock重启mysql 找来的
Explanation of Hoff transformation
Pinhole minimally invasive gingival surgery (pinhole gum rejuvenation)
[2016 CCPC 杭州J] Just a Math Problem (莫比乌斯反演)
正畸学分支和工具
【LeetCode】735. 行星碰撞









