Redis Usage by Site
The info keyspace command will give you the number of keys per database. To access redis-cli you need to run the following command and then type in the redis COMMANDS
redis-cli -s /var/run/redis-object/redis-object.sock -a $(cat /opt/gridpane/object.auth)
In this case, you can run the command:
info keyspace
Example result from a test server:
redis /var/run/redis-object/redis-object.sock> info keyspace
# Keyspace
db1:keys=20,expires=18,avg_ttl=44976476,subexpiry=0
db2:keys=11,expires=5,avg_ttl=3527838,subexpiry=0
This means there are 2 database, one has 20 keys while the other has 11. You can find out which site uses which db from a list created by this command:
grep "WP_REDIS_DATABASE" /var/www/*/wp-config.php
Results from test server:
root@oct03-my-gab-ngx-1:/var/www/test.site# grep "WP_REDIS_DATABASE" /var/www/*/wp-config.php
/var/www/test.site/wp-config.php:define('WP_REDIS_DATABASE', '1');
/var/www/test1.site/wp-config.php:define('WP_REDIS_DATABASE', '2');
/var/www/test2.test/wp-config.php:define('WP_REDIS_DATABASE', '3');
ie db1 -> test.site Please note that the number of keys gives you a rough estimate because we do not get the size of each key. However in general the larger the number of keys the more space they are taking.