Redis is a key-value store. The keys and their values are stored in separate databases, which are numbered db0, db1, …
You can use the redis-cli (command line interface) to interact with the Redis API to control records stored at our component
. We provide the redis-cli on your bastion host. https://root360.atlassian.net/wiki/spaces/KB/pages/2014350660 Preconditions Usage Examples
You can connect to your Redis via the redis-cli with the following command to run on the bastion host:
redis-cli -n 1 -h $redishost
As a common use case you may use the redis-cli tool to identify objects which does not provide a Time-To-Live (TTL). Such objects are not deleted according to their defined TTL and may increase memory utilization at a critical level.
1) INFO keyspace
For a quick overview of the number of keys and their average TTL:
redis-cli -h redis info keyspace
expires is the number of keys with an expiration/ttl configured for that database.
avg_ttl is the average ttl for keys in that database. Only keys that have a ttl are included in the calculation.
2) List all keys with no TTL
List all keys with no TTL in redis instance
redis in redis database
DBNUMBER in redis instance
redis-cli -n DBNUMBER -h REDISHOST --scan | while read LINE ; do TTL=`redis-cli -h REDISHOST ttl "$LINE"`; if [ $TTL -eq -1 ]; then echo "$LINE"; fi; done;
To run this command you need to replace placeholder
REDISHOST with information of your environment
3) Redis trouble shooting
If you use
redis-cli to troubleshoot redis. Redis will automatically select
db0. Select the Redis logical database having the specified zero-based numeric index.
Eg. to work at
db1you need to run
before any other command. For list of all redis-cli commands, you can visit