對騰訊雲的Redis集群不支持很多指令(config get * 、flushdb、flushall、等相關指令)
redis指令限制:https://www.qcloud.com/document/product/239/4073
沒有辦法,也需想出辦法。。.
刪除單個:del key
刪除多個:redis-cli -h ip -a pass(密碼) keys 關鍵字 | xargs redis-cli -h ip -a pass(密碼) del #Linux下的管道符批量操作
#在redis的客戶端連接處登陸刪除
./redis-cli -h 10.111.0.xx -a xx keys '*str_ account*' | xargs ./redis-cli -h 10.111.0.xx -a xx del
#環境變量直接使用 ln -s /tmp/redis/src/redis-cli /usr/bin/
redis-cli -h 10.111.0.xx -a xx keys '*wxsmrzResult*' | xargs redis-cli -h 10.111.0.xx -a xx del
#在沒有,指令限制的情況下,可以使用Redis的flushdb和flushall命令
刪除當前數據庫中的所有Key flushdb
刪除所有數據庫中的key flushall
要訪問 Redis 中特定的數據庫
指定數據序號為0,即默認數據庫 redis-cli -n 0 keys "*" | xargs redis-cli -n 0 del
注:keys 指令可以進行模糊匹配,但如果 Key 含空格,就匹配不到了
h?llo
matcheshello
,hallo
andhxllo #? 匹配任意單個字符
h*llo
matcheshllo
andheeeello #* 匹配任意字符
h[ae]llo
matcheshello
andhallo,
but nothillo # 或者
h[^e]llo
matcheshallo
,hbllo
, ... but nothello #排除
h[a-b]llo
matcheshallo
andhbllo #
Use \
to escape special characters if you want to match them verbatim.