cancel
Showing results for 
Search instead for 
Did you mean: 

How to install or access Redis extension in CE V1.9x under Windows Azure Web App (IIS environment)

How to install or access Redis extension in CE V1.9x under Windows Azure Web App (IIS environment)

I have a Redis server already created on Microsoft Azure, and I'm trying to configure the Windows-based Azure Web App with the Redis server; I'm not sure how to install or access one of the 2 extensions I've come across.

 

As I've read, Redis was available as a pre-installed extension in CE 1.8 as Mage_Cache_Backend_Redis, however apparently that is not installed in CE v1.9?

 

I'm using CE 1.9.2.2; when I change the local.xml file in my Web App to <backend>Mage_Cache_Backend_Redis</backend> I receive an error:

 

 

looking at the log in var/report/1486484366 shows:

  • a:4:{i:0;s:151:"Connection to Redis failed after 2 failures.Last Error : (10013) An attempt was made to access a socket in a way forbidden by its access permissions.
    ";i:1;s:1389:"#0 D:\home\site\wwwroot\lib\Credis\Client.php(439): Credis_Client->connect()
    #1 D:\home\site\wwwroot\lib\Credis\Client.php(725): Credis_Client->connect()
    #2 D:\home\site\wwwroot\lib\Credis\Client.php(599): Credis_Client->__call('select', Array)
    #3 D:\home\site\wwwroot\lib\Cm\Cache\Backend\Redis.php(135): Credis_Client->select(0)
    #4 D:\home\site\wwwroot\lib\Zend\Cache.php(153): Cm_Cache_Backend_Redis->__construct(Array)
    #5 D:\home\site\wwwroot\lib\Zend\Cache.php(94): Zend_Cache::_makeBackend('Mage_Cache_Back...', Array, true, true)
    #6 D:\home\site\wwwroot\app\code\core\Mage\Core\Model\Cache.php(137): Zend_Cache::factory('Varien_Cache_Co...', 'Mage_Cache_Back...', Array, Array, true, true, true)
    #7 D:\home\site\wwwroot\app\code\core\Mage\Core\Model\Config.php(1348): Mage_Core_Model_Cache->__construct(Array)
    #8 D:\home\site\wwwroot\app\Mage.php(463): Mage_Core_Model_Config->getModelInstance('core/cache', Array)
    #9 D:\home\site\wwwroot\app\code\core\Mage\Core\Model\App.php(412): Mage::getModel('core/cache', Array)
    #10 D:\home\site\wwwroot\app\code\core\Mage\Core\Model\App.php(306): Mage_Core_Model_App->_initCache(Array)
    #11 D:\home\site\wwwroot\app\code\core\Mage\Core\Model\App.php(348): Mage_Core_Model_App->baseInit(Array)
    #12 D:\home\site\wwwroot\app\Mage.php(684): Mage_Core_Model_App->run(Array)
    #13 D:\home\site\wwwroot\index.php(83): Mage::run('', 'store')
    #14 {main}";s:3:"url";s:69:"/index.php/admin/cache/flushAll/key/1976144c15f51ec7fa284d6addb657e0/";s:11:"script_name";s:10:"/index.php";}

 

I've created a REDIS_HOST, REDIS_KEY, and MEMCACHESHIM_REDIS_ENABLE in the App Settings for my Web App as identified under article https://azure.microsoft.com/en-us/documentation/articles/web-sites-connect-to-redis-using-memcache-p... though I understand this article may not be completely relevant but it's the closest I've seen to help with my issue.

Any help would be appreciated.

2 REPLIES 2

Re: How to install or access Redis extension in CE V1.9x under Windows Azure Web App (IIS environmen

You can update your local.xml with the following for your backend cache

 

<config>
    <global>
 
        <!-- other configuration nodes -->
 
        <cache>
          <backend>CACHE_BACKEND_CLASS_NAME</backend>
          <backend_options>
            <server>127.0.0.1</server>              <!-- or absolute path to unix socket -->
            <port>6379</port>
            <persistent></persistent>               <!-- Specify a unique string like "cache-db0" to enable persistent connections. -->
            <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 -->
            <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>
 
        <!-- other configuration nodes -->
 
    </global>
</config>
Magento Moderator since 2009
Keep Calm and Clear Cache!

Re: How to install or access Redis extension in CE V1.9x under Windows Azure Web App (IIS environmen

Brent: Thanks for the help; I've tried that and my current local.xml is below. I've tried with:

 

<backend>Mage_Cache_Backend_Redis</backend>

and the local IP <server>127.0.0.1</server>

 

I just don't see that my Azure site is talking to the Azure Redis server, located at mywebsite.redis.cache.windows.net. The closest documentation I've found is how to connect a site running Memcache at https://azure.microsoft.com/en-us/documentation/articles/web-sites-connect-to-redis-using-memcache-p.../.

 

local.xml:

 

<cache> 
<backend>Cm_RedisSession</backend>
<backend_options>
<server>hostnameremoved.redis.cache.windows.net</server> <!-- or absolute path to unix socket -->
<port>6379</port>
<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>0</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; a value of 1 will not retry after the first failure -->
<read_timeout>10</read_timeout> <!-- Set read timeout duration; phpredis does not currently support setting read timeouts -->
<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> <!-- Support gzip, lzf, lz4 (https://github.com/kjdev/php-ext-lz4) or snappy (https://github.com/goatherd/php-snappy) -->
<use_lua>0</use_lua> <!-- Set to 1 if Lua scripts should be used for some operations -->
</backend_options>
</cache>