You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

redis-cli is a useful tool can handle Redis KEYs in the system. You can search / delete / 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_delete.sh

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

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

  • No labels