0

I want to install Redis cache in my magento website so first I need to install Redis cache in my server and after that need to add some code in my Magento app/etc/local.xml file that I know but I am getting error that Connection to Redis failed after 2 failures.

Below is my process to install redis cache in server and website so if there is any mistake help me to solve this.

May I need to install PhpRedis extension ? and how and where to install it?in server or website? Also I thing I need to add cronjob so where can I add cronjob? in magento root directory's cron.php file?

first of all I connect my server using putty and go to root directory of website and after that I run below command that I find from http://redis.io/download

$ wget http://download.redis.io/releases/redis-3.2.0.tar.gz

$ tar xzf redis-3.2.0.tar.gz

$ cd redis-3.2.0

$ make

$ src/redis-server

after doing this I go to magento_root/app/etc/local.xml and place below code in <globle> tag.

<cache>
      <backend>Cm_Cache_Backend_Redis</backend>
      <backend_options>
        <server>redis11.i</server>
        <port>6379</port>
        <persistent></persistent>
        <database>0</database>
        <password></password>
        <force_standalone>0</force_standalone>
        <connect_retries>3</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>lzf</compression_lib>
      </backend_options>
    </cache>

    <session_save>db</session_save>
    <redis_session>             
        <host>redis1.i</host>  
        <port>6379</port>
        <timeout>2.5</timeout>  
        <persistent></persistent>
        <db>0</db>
        <compression_threshold>2048</compression_threshold> 
        <compression_lib>lzf</compression_lib> 
        <log_level>4</log_level>
        <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>            
        <first_lifetime>600</first_lifetime> 
        <bot_first_lifetime>60</bot_first_lifetime>
        <bot_lifetime>3600</bot_lifetime>
        <disable_locking>0</disable_locking>
        <min_lifetime>60</min_lifetime>
        <max_lifetime>86400</max_lifetime>
    </redis_session>

I think I have mistaken somewhere in local.xml file to put correct value for all tags so please look at all tags and if anyone knows please help.

UPDATE

Most of the thing in local.xml file I copy from internet and past to my file so I don't know some of the tags for what? so subsequently don't know that what is the correct value for these tags?

1

hate just posting a link, but these instructions have never seen me wrong

http://inchoo.net/magento/using-redis-cache-backend-and-session-storage-in-magento/

edit, just to expand.

is redis installed locally? here is one of my local.xmls' i just use 127.0.0.1

<cache>
          <backend>Mage_Cache_Backend_Redis</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>
<full_page_cache>
          <backend>Mage_Cache_Backend_Redis</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>1</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>
  • I refer this link but not understand all point because I am newbie to magento and redis. – Dhaval Jun 14 '16 at 7:03
  • May I copy and paste this code to my local.xml file or need to change anything like persistent , database etc. – Dhaval Jun 14 '16 at 7:08
  • And how to check that redis is install in server or not? – Dhaval Jun 14 '16 at 7:08
  • May I need to install PhpRedis extension? – Dhaval Jun 14 '16 at 7:09
  • from cli type: redis-cli :: if that returns a different prompt (mine looks liek 127.0.0.1/> ) the monitor command will output what redis is caching – endozs Jun 14 '16 at 7:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.