Configure Redis Server in Ubuntu – Caching Server For Magento

Redis – Server :-
REDIS is an open source, advanced key-value store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets and sorted sets. Redis works with an in-memory dataset.

Redis-Server Installation on Ubuntu:

Execute below commands in /tmp directory.
-> wget http://download.redis.io/redis-stable.tar.gz
-> tar xvzf redis-stable.tar.gz
-> cd redis-stable
-> make

First Install Redis Cache Extension:
-> git clone https://github.com/colinmollenhour/Cm_Cache_Backend_Redis.git
-> mv Cm_Cache_Backend_Redis/Cm app/code/community
-> rm -rf Cm_Cache_Backend_Redis

Then Install Redis Session Extension:
-> git clone https://github.com/colinmollenhour/credis.git
-> mv credis lib/Credis
-> git clone https://github.com/colinmollenhour/Cm_RedisSession.git
-> mv Cm_RedisSession/code/ app/code/community/Cm/RedisSession
-> mv Cm_RedisSession/Cm_RedisSession.xml app/etc/modules/Cm_RedisSession.xml
-> rm -rf Cm_RedisSession

Just after <global> add, change persistent and db to suit.
Add below lines in app/etc/local.xml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<cache>
<backend>Cm_Cache_Backend_Redis</backend>
<backend_options>
<server>redis11.i</server>
<port>6379</port>
<persistent>cache-db0</persistent>
<database>0</database>
<password></password>
<force_standalone>0</force_standalone>
<connect_retries>1</connect_retries>
<read_timeout>10</read_timeout>
<automatic_cleaning_factor>0</automatic_cleaning_factor>
<compress_data>1</compress_data>
<compress_tags>1</compress_tags>
<compress_threshold>20480</compress_threshold>
<compression_lib>gzip</compression_lib>
</backend_options>
</cache>
 
<session_save>db</session_save>
<redis_session>
<host>redis1.i</host>
<port>6379</port>
<timeout>2.5</timeout>
<persistent>sess-db1</persistent>
<db>1</db>
<compression_threshold>2048</compression_threshold>
<compression_lib>lzf</compression_lib>
<log_broken_locks>0</log_broken_locks>
<max_concurrency>10</max_concurrency>
<break_after_frontend>5</break_after_frontend>
<break_after_adminhtml>30</break_after_adminhtml>
<bot_lifetime>7200</bot_lifetime>
</redis_session>

Check whether Redis-Server is correctly configured.
Execute the following commands in ssh.

root@ip:~# redis-cli (Enter)
redis 127.0.0.1:6379> KEYS *

1) “zc:ti:mage_LAYOUT_GENERAL_CACHE_TAG”
2) “zc:k:mage_LAYOUT_12B8E4E9B9664A88F620395C2B0E265C3″
3) “zc:ti:mage_PRODUCT_31489″
4) “zc:k:mage_LAYOUT_102DAFD20DE438A6CCEAB14C14CBD43E6″
5) “zc:k:mage_LAYOUT_12C9CC1468A49CEAAD89B704922CFA00D”
6) “zc:ti:mage_PRODUCT_32386″
7) “zc:k:mage_LAYOUT_145900AB7F6D4CEB9F4C7CDA3C3FDB3E0″
8) “zc:k:mage_Zend_LocaleL_en_GB_day_”
9) “zc:k:mage_LAYOUT_1570BAB63946016D4308F3846E31F3298″
10) “zc:k:mage_LAYOUT_1A81FEA2A13A548546F8C44C45F291E58″
11) “zc:k:mage_LAYOUT_178D667D0447D0D68CE44FA446B549C57″
12) “zc:k:mage_LAYOUT_1D9AB3A02AE7912CCD665FA0A14082DFE”
13) “zc:k:mage_LAYOUT_1EC736E7B6D5E1342588C904A476EF7A4″
14) “zc:ti:mage_PRODUCT_528″
15) “zc:ti:mage_PRODUCT_5001″
16) “zc:k:mage_LAYOUT_180058FA3A3E7ADD27514DD63BF803443″
17) “zc:k:mage_LAYOUT_149B9701C3A642D6FADE5A8C5EFAB3A53″
18) “zc:ti:mage_PRODUCT_5004″
19) “zc:k:mage_LAYOUT_1747906323D5671235BF2A45136D30FE6″
20) “zc:k:mage_LAYOUT_1F48BF80A73C5CDACE114DBC9168A79F9″

This should be the output.
If you are getting above output then Redis-Server is configured correctly and running. And above count should increase continuously.

For more reference :
–> http://redis.io/topics/quickstart
–> https://help.sonassihosting.com/magestack/installing-the-redis-magento-extension/
—————————————————————————————————————