Setup php-redis-admin to manage your Redis caches

in Tools

To manage your redis caches php-redis-admin is a very simple, yet very effective web based editor for your Redis databases. You can use it to show the contents of your Redis databases, view statistics, flush your databases and add or edit keys.

This page shows you how to setup and configure php-redis-admin.

Setup php redis admin

Install php-redis-admin

You can either clone the git repository in place or use composer to install php-redis-admin in this document we use the composer method.
If you choose however to clone the repository, check the github page of it’s creator

To install with composer, use the following command:

cd /data/web/public
composer create-project -s dev erik-dubbelboer/php-redis-admin /data/web/public/redis

This will install the latest version of php-redis-admin.

Configure php-redis-admin

To configure php-redis-admin for our redis setup, create a file called /data/web/public/redis/includes/config.inc.php with the following content:

<?php
$config = array(
    'servers' => array(
        array(
            'name' => 'Redismaster',
            'host' => 'redismaster',
            'port' => 6379,
            'databases' => 16,
            'seperator' => 'HAAAA',
            'flush' => true,
            'keys' => false,
            'scansize' => 1000
        ),
    ),
    'seperator' => ':',
    'faster' => true,
    'maxkeylen' => 100,
    'count_elements_page' => 100,
    'keys' => false,
    'scansize' => 1000
);
?>

This will instruct php-redis-admin to use the local Redis instance and all of its databases.

Configure nginx

Create whitelisting and basic_auth config

If you haven’t, created a whitelist or basic_auth config using include files to protect your phpredisadmin from unsolicited ip addresses, do this first.

Setup nginx config

Next, to configure Nginx, place a file called server.phpredisadmin in /data/web/nginx:

location /redis {
    include /etc/nginx/app/include.whitelist;
    include /etc/nginx/app/include.basic_auth;

    root /data/web/public;
    index index.php;
    try_files $uri $uri/ /redis/index.php;

    location ~ \.php$ {
        echo_exec @phpfpm;
    }
}

Troubleshooting

  • Due to the nature of our Redis config, it is not possible to use the save function.
  • As our Redis server only listens on localhost, it is not possible to connect to redis from an external location (I.E.: Manage all your redis instances on multiple hypernodes from the same phpmyredis installation).

0