On this page
Monitoring Redis with redis-cli
Use redis-cli to monitor and manage your Redis instance directly from the command line via SSH.
redis-cli is the Redis command line interface - a simple program that lets you send commands to Redis and read the server's replies directly from the terminal.
Before you start
You need SSH access to your account to use redis-cli. If you do not have SSH access yet, please contact us and we will get that sorted for you.
You also need your Redis socket address. You can find this in cPanel under Redis:

The socket path follows this pattern:
/home/USER/.kxcache/redis.sock
Replace USER with your cPanel username throughout the examples below.
Check that Redis is running
To confirm Redis is responding, run:
redis-cli -s /home/USER/.kxcache/redis.sock PING
You should see:

A PONG reply means Redis is up and accepting connections.
Monitor commands in real time
To watch every command Redis receives as it happens, run:
redis-cli -s /home/USER/.kxcache/redis.sock monitor
The output looks like this:
OK
1460100081.165665 [0 unix:/home/USER/.kxcache/redis.sock] "set" "foo" "bar"
1460100083.053365 [0 unix:/home/USER/.kxcache/redis.sock] "get" "foo"
You can pipe the output to filter for specific patterns, for example:
redis-cli -s /home/USER/.kxcache/redis.sock monitor | grep "set"
The monitor command logs every command received by Redis, which adds overhead. Use it for short debugging sessions rather than leaving it running continuously.
Check the number of keys in a database
The dbsize command returns the number of keys in the currently selected database.
-
Connect to Redis:
redis-cli -s /home/USER/.kxcache/redis.sock -
Select the database you want to check (the default is
0):select 0 -
Run the command:
dbsize
Redis returns the key count as an integer.
View live server statistics
The --stat flag puts redis-cli into continuous stats mode, which is one of its most useful but lesser-known features for monitoring a Redis instance in real time:
redis-cli -s /home/USER/.kxcache/redis.sock --stat
Example output:
------- data ------ --------------------- load -------------------- - child -
keys mem clients blocked requests connections
22481 511.69M 3 0 549054 (+0) 71395
22481 511.75M 6 0 549083 (+29) 71401
22481 511.77M 7 0 549103 (+20) 71404
22481 511.79M 8 0 549115 (+12) 71406
22481 511.77M 7 0 549126 (+11) 71408
22481 511.71M 4 0 549132 (+6) 71409
22481 511.71M 4 0 549150 (+18) 71412
22481 511.94M 12 0 549191 (+41) 71421
The columns tell you:
- keys - how many keys are stored on the server
- mem - total memory in use
- clients - number of connected clients
- blocked - number of blocked clients
- requests - total requests served (with the per-interval delta in brackets)
- connections - total connections made since startup
This gives you a quick, at-a-glance overview of your Redis server's health and load.
Flush the Redis cache
To clear all keys from Redis, run:
redis-cli -s /home/USER/.kxcache/redis.sock flushall
flushall deletes every key in every database immediately and cannot be undone. Only run this if you are sure you want to clear the entire cache.
If you have other useful redis-cli commands you would like to see covered, let us know and we will be happy to add them.