Skip to content

Instantly share code, notes, and snippets.

@dvershinin
Last active January 16, 2021 23:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dvershinin/357642754f3b2bf22046876038fa7636 to your computer and use it in GitHub Desktop.
Save dvershinin/357642754f3b2bf22046876038fa7636 to your computer and use it in GitHub Desktop.
Magento Redis Configuration
<?xml version="1.0"?>
<config>
<global>
<cache>
<backend>Mage_Cache_Backend_Redis</backend>
<backend_options>
<server>/var/run/redis/redis.sock</server> <!-- or absolute path to unix socket -->
<persistent></persistent> <!-- Specify a unique string like "cache-db0" to enable persistent connections. -->
<database>2</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 -->
<read_timeout>10</read_timeout> <!-- Set read timeout duration -->
<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 -->
</backend_options>
</cache>
</global>
</config>
<?xml version="1.0"?>
<!--
/**
* Lesti_Fpc (http:gordonlesti.com/lestifpc)
*
* PHP version 5
*
* @link https://github.com/GordonLesti/Lesti_Fpc
* @package Lesti_Fpc
* @author Gordon Lesti <info@gordonlesti.com>
* @copyright Copyright (c) 2013-2014 Gordon Lesti (http://gordonlesti.com)
* @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
*/
-->
<config>
<global>
<fpc>
<lifetime>86400</lifetime>
<!-- example for redis -->
<!-- please read https://github.com/colinmollenhour/Cm_Cache_Backend_Redis for more informations -->
<backend>Cm_Cache_Backend_Redis</backend>
<backend_options>
<server>127.0.0.1</server>
<port>6379</port>
<persistent>cache-fpc</persistent>
<database>2</database>
<password></password>
<force_standalone>1</force_standalone>
<connect_retries>1</connect_retries>
<lifetimelimit>86400</lifetimelimit>
<read_timeout>10</read_timeout>
<compress_data>1</compress_data>
<compress_tags>1</compress_tags>
<compress_data>gzip</compress_data>
</backend_options>
</fpc>
</global>
</config>
<!--
/**
* Complete example
* This configuration stores sessions, general cache and PotatoCommerce FPC caches to Redis
*/
-->
<?xml version="1.0"?>
<config>
<global>
<session_save>db</session_save>
<redis_session> <!-- All options seen here are the defaults -->
<host>/var/run/redis/redis.sock</host> <!-- Specify an absolute path if using a unix socket -->
<port>6379</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> <!-- Known bug with strings over 64k: https://github.com/colinmollenhour/Cm_Cache_Backend_Redis/issues/18 -->
<compression_lib>gzip</compression_lib> <!-- gzip, lzf, lz4, snappy or none to disable compression -->
<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>6</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 -->
<fail_after>10</fail_after> <!-- seconds after which we bail from attempting to obtain lock (in addition to break after time) -->
<break_after_adminhtml>30</break_after_adminhtml>
<first_lifetime>600</first_lifetime> <!-- Lifetime of session for non-bots on the first write. 0 to disable -->
<bot_first_lifetime>60</bot_first_lifetime> <!-- Lifetime of session for bots on the first write. 0 to disable -->
<bot_lifetime>7200</bot_lifetime> <!-- Lifetime of session for bots on subsequent writes. 0 to disable -->
<disable_locking>0</disable_locking> <!-- Disable session locking entirely. -->
<min_lifetime>60</min_lifetime> <!-- Set the minimum session lifetime -->
<max_lifetime>2592000</max_lifetime> <!-- Set the maximum session lifetime -->
<log_exceptions>0</log_exceptions> <!-- Log connection failure and concurrent connection exceptions in exception.log. -->
</redis_session>
<cache>
<backend>Mage_Cache_Backend_Redis</backend>
<backend_options>
<server>/var/run/redis/redis.sock</server> <!-- or absolute path to unix socket -->
<persistent></persistent> <!-- Specify a unique string like "cache-db0" to enable persistent connections. -->
<database>2</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 -->
<read_timeout>10</read_timeout> <!-- Set read timeout duration -->
<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 -->
</backend_options>
</cache>
<!-- This is a child node of config/global for Magento Enterprise FPC -->
<full_page_cache>
<backend>Cm_Cache_Backend_Redis</backend>
<backend_options>
<server>/var/run/redis/redis.sock</server> <!-- or absolute path to unix socket -->
<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 -->
<database>3</database> <!-- Redis database number; protection against accidental data loss is improved by not sharing databases -->
<password></password> <!-- Specify if your Redis server requires authentication -->
<force_standalone>0</force_standalone> <!-- 0 for phpredis, 1 for standalone PHP -->
<connect_retries>1</connect_retries> <!-- Reduces errors due to random connection failures -->
<lifetimelimit>57600</lifetimelimit> <!-- 16 hours of lifetime for cache record -->
<compress_data>0</compress_data> <!-- DISABLE compression for EE FPC since it already uses compression -->
<auto_expire_lifetime></auto_expire_lifetime> <!-- Force an expiry (Enterprise_PageCache will not set one) -->
<auto_expire_refresh_on_load></auto_expire_refresh_on_load> <!-- Refresh keys when loaded (Keeps cache primed frequently requested resources) -->
</backend_options>
</full_page_cache>
</global>
</config>
<?xml version="1.0"?>
<config>
<global>
<session_save>db</session_save>
<redis_session>
<host>/var/run/redis/redis.sock</host>
<port>6379</port>
<password></password>
<timeout>2.5</timeout>
<persistent></persistent>
<db>0</db>
<compression_threshold>2048</compression_threshold>
<compression_lib>gzip</compression_lib>
<log_level>1</log_level>
<max_concurrency>6</max_concurrency>
<break_after_frontend>5</break_after_frontend>
<break_after_adminhtml>30</break_after_adminhtml>
<bot_lifetime>7200</bot_lifetime>
</redis_session>
</global>
</config>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment