Redis的常见命令

2023-05-29  本文已影响0人  青水山
/data/anaconda2/bin/rdb --command json -f 1.csv /tmp/dump.rdb
Cd /data/bak/scripts/redis/redis-rdb-tools
redis-memory-for-key -p 6379 -a xxx key
# redis 5.0以上可以通过如下命令向整个集群执行命令:
redis-cli --cluster call <ip>:<port> command -a xxx
# 查看dbsize,已经全部清零。
redis-cli --cluster call <ip>:<port> command -a xxx
1、先 把slave kill
2、在哨兵节点上执行
redis-cli -h 10.2.52.162 -p 26388 sentinel reset redis19
redis-cli -h 10.2.53.160 -p 26388 sentinel reset redis19
redis-cli -h 10.2.59.16 -p 26388 sentinel reset redis19
./redis-cli -h 127.0.0.1 -p 6379 -a password --scan --pattern 'key-*' | xargs ./redis-cli -h 127.0.0.1 -p 6379 -a password del {}
#!/bin/bash

nodes_addrs=$(redis-cli -a $3 -h $1 -p $2 cluster nodes|grep -v handshake| awk '{print $2}')
echo $nodes_addrs
for addr in ${nodes_addrs[@]}; do
host=${addr%:*}
port=${addr#*:}
del_nodeids=$(redis-cli -a $3 -h $host -p $port cluster nodes|grep -E 'handshake|fail'| awk '{print $1}')
for nodeid in ${del_nodeids[@]}; do
echo $host $port $nodeid
redis-cli -a $3 -h $host -p $port cluster forget $nodeid
done
done
上一篇下一篇

猜你喜欢

热点阅读