Skip to content

Latest commit

 

History

History
21 lines (15 loc) · 491 Bytes

清理集群.md

File metadata and controls

21 lines (15 loc) · 491 Bytes
redis_list=("172.0.0.1:6379")

pkey_list=("han8gui*")

for info in ${redis_list[@]}
    do
        echo "开始执行:$info"
        ip=`echo $info | cut -d \: -f 1`
        port=`echo $info | cut -d \: -f 2`

                for pkey in ${pkey_list[@]}
                do
                        redis-cli -c -h $ip -p $port -a password --scan --pattern  $pkey | xargs -r -t -n1 redis-cli -c -h $ip -p $port -a password del
                done
    done
echo "清理完成"