Skip to content

Configuration Adding Redis

rgeleta edited this page Dec 25, 2014 · 3 revisions

NOT TESTED

Sharing my notes on how to install Redis as a caching backend for local environments. May not

  1. Install Redis Server
    $ sudo apt-get install redis-server
  2. Install the phpredis library.
  3. To target your local environment variables, create a unique environment variable:
$ sudo nano /etc/nginx/fastcgi_params
...
# Set redis on
fastcgi_param REDIS on;
  1. Within the site's settings.php you can now configure settings without effecting another environment. Please make sure to read the README.txt in the redis module and make sure the redis module is enabled after you restart kalastack.
/**
 * Settings for local environments with redis enabled.
 */
if (isset($_SERVER['REDIS']) &&  $_SERVER['REDIS'] === 'on') {
  $conf['site_name'] = 'Greenbiz Local Redis Enabled';
  $conf['redis_client_interface'] = 'PhpRedis';
  $conf['cache_backends'][] = 'sites/all/modules/contrib/redis/redis.autoload.inc';
  $conf['cache_default_class'] = 'Redis_Cache';
  // Make sure that we don't have collisions here
  $conf['cache_prefix'] = array('default' => 'kalabox');
  // Do not use Redis for cache_form (no performance difference).
  $conf['cache_class_cache_form'] = 'DrupalDatabaseCache';
  // Don't use Redis for Views cache, has caused some display issues.
  $conf['cache_class_cache_views'] = 'DrupalDatabaseCache';
  $conf['cache_class_cache_views_data'] = 'DrupalDatabaseCache';
  // Use Redis for Drupal locks (semaphore).
  $conf['lock_inc'] = 'sites/all/modules/contrib/redis/redis.lock.inc';
}
  1. Restart and notice the speed increase, hopefully.