(Archived) How to activate Redis for Magento from 1.8
You have tried to access an archived page. Please go to the new https://root360.atlassian.net/wiki/spaces/KB to find more documents.
Setup of Redis in Magento
The Magento Redis module is preinstalled from version 1.8, but deactivated. For activation in the file
Magento-install-dir/app/etc/modules/Cm_RedisSession.xml
simply change option <active> from false to true to enable the module.
Configuration of the local.xml (local.xml.dist)
After the Redis module is activated and installed, the local.xml has to be adapted: Magento-install-dir/app/etc/local.xml with the following entry.
<global>
<cache>
<backend>Cm_Cache_Backend_Redis</backend>
<backend_options>
<server>%REDIS_HOST%</server> <!-- or absolute path to unix socket for better performance -->
<port>%REDIS_PORT%</port>
<database>0</database>
<password></password>
<force_standalone>0</force_standalone> <!-- 0 for phpredis, 1 for standalone PHP -->
<connect_retries>1</connect_retries> <!-- Reduces errors due to random connection failures -->
<automatic_cleaning_factor>0</automatic_cleaning_factor> <!-- Disabled by default -->
<compress_data>1</compress_data> <!-- 0-9 for compression level, recommended: 0 or 1 -->
<compress_tags>1</compress_tags> <!-- 0-9 for compression level, recommended: 0 or 1 -->
<compress_threshold>20480</compress_threshold> <!-- Strings below this size will not be compressed -->
<compression_lib>gzip</compression_lib> <!-- Supports gzip, lzf and snappy -->
<persistent>1</persistent> <!-- persistence value, 0: not in use, > 0 used as persistence ID -->
</backend_options>
</cache>
<!-- example of redis session storage -->
<session_save>db</session_save>
<redis_session> <!-- All options seen here are the defaults -->
<host>%REDIS_HOST%</host> <!-- Specify an absolute path if using a unix socket -->
<port>%REDIS_PORT%</port>
<password></password> <!-- Specify if your Redis server requires authentication -->
<timeout>2.5</timeout> <!-- This is the Redis connection timeout, not the locking timeout -->
<persistent></persistent> <!-- Specify unique string to enable persistent connections. E.g.: sess-db0; bugs with phpredis and php-fpm are known: https://github.com/nicolasff/phpredis/issues/70 -->
<db>1</db> <!-- Redis database number; protection from accidental loss is improved by using a unique DB number for sessions -->
<compression_threshold>2048</compression_threshold> <!-- Set to 0 to disable compression (recommended when suhosin.session.encrypt=on); known bug with strings over 64k: https://github.com/colinmollenhour/Cm_Cache_Backend_Redis/issues/18 -->
<compression_lib>gzip</compression_lib> <!-- gzip, lzf or snappy -->
<log_level>1</log_level> <!-- 0 (emergency: system is unusable), 4 (warning; additional information, recommended), 5 (notice: normal but significant condition), 6 (info: informational messages), 7 (debug: the most information for development/testing) -->
<max_concurrency>20</max_concurrency> <!-- maximum number of processes that can wait for a lock on one session; for large production clusters, set this to at least 10% of the number of PHP processes -->
<break_after_frontend>5</break_after_frontend> <!-- seconds to wait for a session lock in the frontend; not as critical as admin -->
<break_after_adminhtml>30</break_after_adminhtml>
<bot_lifetime>7200</bot_lifetime> <!-- Bots get shorter session lifetimes. 0 to disable -->
</redis_session>
</global>
The <server> </server> and <port> </port> areas must be filled with placeholders, which are replaced with the current values during deployment.
Ex.:
%REDIS_HOST%
%REDIS_PORT%
root360 Knowledge Base - This portal is hosted by Atlassian (atlassian.com | Privacy Policy)