redis-cli is a useful tool can handle Redis KEYs in the system. You can search / delete / get / clear / check its status simple on your terminal.




redis_clear.sh

#!/bin/bash
redis-cli -h hostname -p port_number -a passphrase FLUSHALL

redis_status.sh

#!/bin/bash
sudo redis-cli -h hostname -p port_number -a passphrase --stat

redis_search.sh

redis_search.sh
#!/bin/bash
redis-cli -h hostname -p port_number -a passphrase --scan --pattern $1

Note that you can use special characters like $. Example) PROD_lock_*

redis_get.sh

#!/bin/bash
redis-cli -h hostname -p port_number -a passphrase --scan --pattern $1 | xargs redis-cli -h hostname -p port_number -a passphrase GET

redis_delete.sh

#!/bin/bash
if [ "$1" ];
then
	redis-cli -h hostname -p port_number -a passphrase --scan --pattern $1 | xargs redis-cli DEL
else
	echo "Usage: $0 <key>"
fi

Note that you can use special characters like $. Example) PROD_lock_*