Install Redis for Drupal

Follow these steps to install Redis as a cache for Drupal:

  1. Install Predis under sites/all/libraries/predis.
  2. Download and install the Drupal Redis module.

Configure Drupal

To configure Drupal to use Redis as a cache, add the following lines to your settings.php file with the specified changes:

    $conf['redis_client_interface'] = 'Predis';
    $conf['redis_client_host'] = 'hostname';
    $conf['redis_client_port'] = port;
    $conf['redis_client_password'] = 'password';
    $conf['lock_inc'] = 'sites/all/modules/contrib/redis/redis.lock.inc';
    $conf['cache_backends'][] = 'sites/all/modules/contrib/redis/redis.autoload.inc';
    $conf['cache_default_class'] = 'Redis_Cache';
  • In line 2, replace hostname with your database’s hostname or IP address.
  • In line 3, replace port with your database’s port.
  • In line 4, replace password with your database’s password.