steverobbins / Magento-Redismanager

Superuser control for Redis in Magento
137 stars 31 forks source link

unix sockets? #25

Closed stefanskotte closed 5 years ago

stefanskotte commented 8 years ago

Hi there,

I'm wondering how to set it up to support unix sockets ? Appears to only work for tcp ..

steverobbins commented 8 years ago

Are you trying to set up Redis in Magento? Or is this an issue with Redis Manager not supporting unix sockets?

stefanskotte commented 8 years ago

It's an issue with redis manager supporting Unix sockets, sorry if that wasn't clear.

Den tor. 21. apr. 2016 19.37 skrev Steve Robbins notifications@github.com:

Are you trying to set up Redis in Magento? Or is this an issue with Redis Manager not supporting unix sockets?

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/steverobbins/Magento-Redismanager/issues/25#issuecomment-213031725

Stefan Skotte Enhance-IT

steverobbins commented 8 years ago

Can you provide an example of your configuration in app/etc/local.xml for Redis?

stefanskotte commented 8 years ago

Sure thing - here you go:

        <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>0</port>
            <timeout>5</timeout>            <!-- This is the Redis connection timeout, not the locking timeout -->
            <db>4</db>
      <max_concurrency>50</max_concurrency>                   <!-- maximum procs waiting for lock 10% of the number of PHP process
es -->
      <break_after_frontend>5</break_after_frontend>          <!-- seconds to wait for a session lock in the frontend -->
      <break_after_adminhtml>10</break_after_adminhtml>
      <bot_lifetime>7200</bot_lifetime>                    <!-- Bots get shorter session lifetimes. 0 to disable -->
            <compression_threshold>20480</compression_threshold>  <!-- Set to 0 to disable compression -->
            <compression_lib>snappy</compression_lib>              <!-- gzip, lzf or snappy -->
        <persistent>0</persistent>
        </redis_session>
         <cache>
          <backend>Cm_Cache_Backend_Redis</backend>
          <backend_options>
            <server>/var/run/redis/redis.sock</server> <!-- or absolute path to unix socket for better performance -->
            <port>0</port>
            <database>5</database>
            <force_standalone>0</force_standalone>  <!-- 0 for phpredis, 1 for standalone PHP -->
            <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>0</compress_threshold>  <!-- Strings below this size will not be compressed -->
            <compression_lib>snappy</compression_lib> <!-- Supports gzip, lzf and snappy -->
        <use_lua>0</use_lua> <!-- Set to 1 if Lua scripts should be used for some operations -->
          </backend_options>
        </cache>
<full_page_cache>
  <backend>Cm_Cache_Backend_Redis</backend>
  <backend_options>
    <server>/var/run/redis/redis-6380.sock</server> <!-- or absolute path to unix socket -->
    <port>0</port>
    <persistent>0</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>6</database> <!-- Redis database number; protection against accidental data loss is improved by not sharing database
s -->
    <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 -->
  </backend_options>
</full_page_cache>
simbus82 commented 4 years ago

Hi Steve, i have same problem with Magento 1.9.4.3 and your latest version (downloaded 5 minutes ago). Can't use your extension if i'm using the really fast Unix Socket with Redis (now 5.x)

The report of error:

a:5:{i:0;s:25:"No such file or directory";i:1;s:5492:"#0 /home/mywebsite/public_html/magento/lib/Credis/Client.php(432): Redis->connect('/var/run/redis/...', NULL, 2.5)
#1 /home/mywebsite/public_html/magento/lib/Credis/Client.php(725): Credis_Client->connect()
#2 /home/mywebsite/public_html/magento/lib/Credis/Client.php(599): Credis_Client->__call('select', Array)
#3 /home/mywebsite/public_html/magento/lib/Cm/Cache/Backend/Redis.php(135): Credis_Client->select(1)
#4 /home/mywebsite/public_html/magento/app/code/core/Mage/Core/Model/Config.php(1357): Cm_Cache_Backend_Redis->__construct(Array)
#5 /home/mywebsite/public_html/magento/app/Mage.php(466): Mage_Core_Model_Config->getModelInstance('redismanager/ba...', Array)
#6 /home/mywebsite/public_html/magento/app/code/community/Steverobbins/Redismanager/Helper/Data.php(182): Mage::getModel('redismanager/ba...', Array)
#7 /home/mywebsite/public_html/magento/app/code/community/Steverobbins/Redismanager/Block/Adminhtml/Manager.php(53): Steverobbins_Redismanager_Helper_Data->getRedisInstance('/var/run/redis/...', '0', '', '1')
#8 /home/mywebsite/public_html/magento/app/design/adminhtml/default/default/template/steverobbins/redismanager/grid.phtml(14): Steverobbins_Redismanager_Block_Adminhtml_Manager->getSortedServices()
#9 /home/mywebsite/public_html/magento/app/code/core/Mage/Core/Block/Template.php(241): include('/home/mywebsite/pu...')
#10 /home/mywebsite/public_html/magento/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('adminhtml/defau...')
#11 /home/mywebsite/public_html/magento/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#12 /home/mywebsite/public_html/magento/app/code/core/Mage/Adminhtml/Block/Template.php(81): Mage_Core_Block_Template->_toHtml()
#13 /home/mywebsite/public_html/magento/app/code/core/Mage/Core/Block/Abstract.php(923): Mage_Adminhtml_Block_Template->_toHtml()
#14 /home/mywebsite/public_html/magento/app/code/core/Mage/Core/Block/Abstract.php(641): Mage_Core_Block_Abstract->toHtml()
#15 /home/mywebsite/public_html/magento/app/code/core/Mage/Core/Block/Abstract.php(585): Mage_Core_Block_Abstract->_getChildHtml('redismanager.gr...', true)
#16 /home/mywebsite/public_html/magento/app/design/adminhtml/default/default/template/steverobbins/redismanager/manager.phtml(26): Mage_Core_Block_Abstract->getChildHtml('redismanager.gr...')
#17 /home/mywebsite/public_html/magento/app/code/core/Mage/Core/Block/Template.php(241): include('/home/mywebsite/pu...')
#18 /home/mywebsite/public_html/magento/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('adminhtml/defau...')
#19 /home/mywebsite/public_html/magento/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#20 /home/mywebsite/public_html/magento/app/code/core/Mage/Adminhtml/Block/Template.php(81): Mage_Core_Block_Template->_toHtml()
#21 /home/mywebsite/public_html/magento/app/code/core/Mage/Core/Block/Abstract.php(923): Mage_Adminhtml_Block_Template->_toHtml()
#22 /home/mywebsite/public_html/magento/app/code/core/Mage/Core/Block/Text/List.php(43): Mage_Core_Block_Abstract->toHtml()
#23 /home/mywebsite/public_html/magento/app/code/core/Mage/Core/Block/Abstract.php(923): Mage_Core_Block_Text_List->_toHtml()
#24 /home/mywebsite/public_html/magento/app/code/core/Mage/Core/Block/Abstract.php(641): Mage_Core_Block_Abstract->toHtml()
#25 /home/mywebsite/public_html/magento/app/code/core/Mage/Core/Block/Abstract.php(585): Mage_Core_Block_Abstract->_getChildHtml('content', true)
#26 /home/mywebsite/public_html/magento/app/design/adminhtml/default/default/template/page.phtml(74): Mage_Core_Block_Abstract->getChildHtml('content')
#27 /home/mywebsite/public_html/magento/app/code/core/Mage/Core/Block/Template.php(241): include('/home/mywebsite/pu...')
#28 /home/mywebsite/public_html/magento/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('adminhtml/defau...')
#29 /home/mywebsite/public_html/magento/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#30 /home/mywebsite/public_html/magento/app/code/core/Mage/Adminhtml/Block/Template.php(81): Mage_Core_Block_Template->_toHtml()
#31 /home/mywebsite/public_html/magento/app/code/core/Mage/Core/Block/Abstract.php(923): Mage_Adminhtml_Block_Template->_toHtml()
#32 /home/mywebsite/public_html/magento/app/code/core/Mage/Core/Model/Layout.php(555): Mage_Core_Block_Abstract->toHtml()
#33 /home/mywebsite/public_html/magento/app/code/core/Mage/Core/Controller/Varien/Action.php(390): Mage_Core_Model_Layout->getOutput()
#34 /home/mywebsite/public_html/magento/app/code/community/Steverobbins/Redismanager/controllers/Adminhtml/RedismanagerController.php(56): Mage_Core_Controller_Varien_Action->renderLayout()
#35 /home/mywebsite/public_html/magento/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Steverobbins_Redismanager_Adminhtml_RedismanagerController->indexAction()
#36 /home/mywebsite/public_html/magento/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('index')
#37 /home/mywebsite/public_html/magento/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#38 /home/mywebsite/public_html/magento/app/code/core/Mage/Core/Model/App.php(381): Mage_Core_Controller_Varien_Front->dispatch()
#39 /home/mywebsite/public_html/magento/app/Mage.php(686): Mage_Core_Model_App->run(Array)
#40 /home/mywebsite/public_html/magento/index.php(83): Mage::run('', 'store')
#41 {main}";s:3:"url";s:81:"/magento/index.php/admin/redismanager/index/key/82182b4b6da20a4f183cd93416523478/";s:11:"script_name";s:18:"/magento/index.php";s:4:"skin";s:5:"admin";}

And my local setting for the cache

<cache>
  <backend>Cm_Cache_Backend_Redis</backend>
  <backend_options>
    <server>/var/run/redis/redis_6381.sock</server>
    <port>0</port>
    <persistent>cache_db1</persistent>                                
    <database>1</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>lzf</compression_lib>                  
    <use_lua>0</use_lua>                                     
  </backend_options>
</cache>

<session_save>db</session_save>
<redis_session>                                          
    <host>/var/run/redis/redis_6382.sock</host> 
    <port>0</port>
    <password></password>                                
    <timeout>2.5</timeout>                               
    <persistent>sess_db1</persistent>                            
    <db>1</db>                                          
    <compression_threshold>2048</compression_threshold>  
    <compression_lib>lzf</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>
    <first_lifetime>600</first_lifetime>                 
    <bot_first_lifetime>60</bot_first_lifetime>          
    <bot_lifetime>7200</bot_lifetime>                    
    <disable_locking>0</disable_locking>                 
    <min_lifetime>60</min_lifetime>                      
    <max_lifetime>2592000</max_lifetime>                 
</redis_session>