Configure Redis in Magento 1

in CachingPerformance Tags: MagentoperformanceredisSSH

Redis is a caching method which can increase the speed of the backend and frontend of your shop. On Hypernode every customer has access to Redis cache, starting from 64 MB, depending on the plan. This article will explain how to configure Redis on your Magento 1 shop on Hypernode and how to work with redis-cli.

NB: When you used the hypernode-importer and you were already using Redis you don’t have to follow this tutorial.

Want to know how to configure Redis in Magento 2? Have a look at this article!

Download the Redis extension from Collin Mollenhour from Github

NB: If you’re using a Magento version later than 1.8.x, you can skip this extension. Magento 1.8 and bigger ship with a built-in Redis module included.

Follow these steps to change your caching backend to Redis:

  • Go to your public folder: /data/web/public
  • Use the following commands to install the Redis module on your shop:
    • modman init
    • modman clone git://
  • Redis is now installed on your shop.

Change your local.xml file

NB: If you’re using a Magento version newer than 1.8.x you can use the built-in Redis module. To do so, replace <backend>Cm_Cache_Backend_Redis</backend> with <backend>Mage_Cache_Backend_Redis</backend> in the configuration snippet below. If you choose to use Cm_Cache_Backend_Redis when on 1.8.x, use the config snippet as is and install Cm_Cache_Backend_Redis.

Open your local.xml file and paste the next lines of code after the </crypt> tag:


Flush your cache after making these adjustments:

n98-magerun cache:flush

Use the redis-cli command

On Hypernode you can use the redis-cli command to get more information out of the Redis server. All the available commands can be found on the Command page of the Redis website. Below are some examples:

  • Flush all keys in all databases:
redis-cli flushall
  • Flush all keys in database 0 or database 1 respectively:
redis-cli -n 0 flushdb 
redis-cli -n 1 flushdb 
  • Check how much Redis Cache you’re currently using
redis-cli info | grep used_memory_human
  • List all stored keys
redis-cli --scan

Choosing the right database

If you use both a staging environment and a production site, pick the databases carefully. Using the same Redis databases for both production and development can cause unexpected behaviour on both sites.


Environment Db Type Redis Database
production Magento Cache 0
production Magento FPC 1
production Sessions 2
staging Magento Cache 3
staging Magento FPC 4
staging Sessions 5

Changing the compression library

It is possible to use the compression library ‘Snappy’ on Hypernode. More information about Snappy can be found in the changelog: Release-4224.

In order to use the compression library Snappy for your Redis cache you need to change <compression_lib>gzip</compression_lib> to <compression_lib>snappy</compression_lib>in your local.xml.

Configure Magento 1 to use Redis as the session store

You can use Redis for storing sessions too! To do so on Magento 1, read the article about storing sessions in Redis