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 Redis (AWS ElastiCache). We provide the redis-cli on your bastion host.
Preconditions
Activated redis-cli on bastion host. You my contact our service team at service@root360.de or create a ticket at https://support.root360.cloud to active redis-cli tool on your bastion host
You can connect to your Redis instance 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
# Keyspace
db0:keys=2414,expires=2409,avg_ttl=734255
db1:keys=7177856,expires=0,avg_ttl=0
db2:keys=305579,expires=305579,avg_ttl=37469529
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.
2) List all keys with no TTL
List all keys with no TTL in redis instance redis in redis database DBNUMBER in redis instance REDISHOST:
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 DBNUMBER and 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