Drupal Redis setup Predis and Module

Here is the short introduction of installing Redis for Drupal

Install Redis

sudo apt-get install redis-server php5-redis

Install Redis Drupal module


Make sure Predis library is downloaded and should be installed in sites/all/libraries/predis

Edit site settings.php

$conf[‘redis_client_interface’] = ‘Predis’;
$conf[‘redis_client_host’] = ‘’;
$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’;




One of my Drupal Amazon AWS CDN migration experiences

Lately I’ve helped to move one of the existing sites from an Amazon EC2 to another, this is a cross-account migration.

Some config and environment:

Old server: ubuntu 12.04 / Apache on a m3.medium EC2 instance with Drupal 7, database is on an RDS instance alone
New server: ubuntu 14.04 / Apache 2 / php5-fpm on a m3.medium EC2 instance, it also has a RDS instance for the database
The new instances were all set up prior for this migration.

So the other parts were relatively simple like always:

  • Put site to maintenance mode, disabled clean-url, deleted cache, etc.
  • Site file tar gz compressed
  • Used mysqldump to get MySQL dump file and tar gz
  • From the destination EC2 instance, ssh to the old instance to get the compressed file
  • Copied everything from old bucket to the new bucket by using CloudBerry Explorer for Amazon S3 / S3 Browser

The CDN and sitemap issue

It’s all good, however when I installed and set up everything. I’ve found files missing and the sitemap was just with the old domain name.
The sitemap was generated with Drupal XML sitemap
No matter how many times that I rebuilt the sitemap it’s just the old one that shows in the browser when directly visit
So I started to look for the cause of this issue.
The rest of the parts were all looking good, so I then started to look at the most suspicious CDN setup, and finally get it sorted out.
The following are the steps that I did.
Config Steps:
  • need to hand code all the Amazon AWS details into the site settings.php
  • need to hand code the base URL to settings.php
  • need to run a complete CRON
  • delete all caches including S3 cache, static cache, everything cached
  • need to enable base url option in advgg -> under OBSCURE OPTIONS -> check “include the base_url variable in the hooks hash array”
  • remove the old sitemap in xmlsitemap panel
  • add a new sitemap file back in
  • go to rebuild the sitemap links in the rebuid panel
  • check the sitemap that is rebuit then use update cached files, click “update”
  • the I have a perfect sitemap to submit to the Search Engines


  • The sitemap built is actually not located on the web server, it’s a CDN distribution over S3 bucket via CloudFront – usually sitemap will located on the web server site root though
  • So if you go to the web server site root to look for this sitemap file it’ll not show there
  • The Amazon details needed to be hand coded in the setting files, this may not be the best option but it’s the only option that works at the moment
  • CRON takes time also the CDN distribution has delay, the changes could not be seen immediately
  • Drupal can’t live without caching otherwise it’s very slow, but caching will cause problem over development and/or troubleshooting as what you are looking at were all cached files and changes made could not take effect right away

Here is the reference: