2013-10-09 42 views
1

我一直在涉足Redis,作爲我們性能問題的潛在解決方案,但我在Magneto Enterprise 1.13.0.2中配置Redis時遇到問題。Magento Redis配置問題:找不到指定的PHP會話模塊(redis)

我收到以下錯誤Warning: session_module_name(): Cannot find named PHP session module (redis)

對我來說這是說,它不知道會話處理器reddis的。

由於EE 1.13 Redis應該是可用的,奇怪的是full_page_cache適用於它,但標準cachesession_save沒有。

我local.xml中配置:

<session_save><![CDATA[redis]]></session_save> 
    <session_save_path><![CDATA[tcp://127.0.0.1:6379?weight=2&timeout=2.5]]></session_save_path> 
    <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> <!-- Separate database 1 to keep FPC separately --> 
      <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 --> 
      <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> 
</global> 

我有一個很難找到好的文檔吧,我會回落到https://github.com/colinmollenhour/Cm_Cache_Backend_Redis,但我想用一個核心軟件包這一funconality,這讓升級路徑更清潔。

http://www.magentocommerce.com/knowledge-base/entry/redis-magento-ce-ee#config-mage https://magento.stackexchange.com/questions/4264/redis-on-magento-enterprise-1-13

回答

2

這竟然是失蹤的PECL redis的擴展名的問題的結構,所以安裝,你應該是好去:

pecl install redis

我是,我可以通過使用獨立的PHP的印象如下:

<force_standalone>1</force_standalone> <!-- 0 for phpredis, 1 for standalone PHP --> 

我的全配置已經結束了:

<!-- Uses database 0 --> 
    <session_save><![CDATA[redis]]></session_save> 
    <session_save_path><![CDATA[tcp://127.0.0.1:6379?weight=2&timeout=2.5]]></session_save_path> 
    <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> <!-- Separate database 2 to keep separate from FPC + Session --> 
      <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>2</database> <!-- Separate database 2 to keep FPC separately --> 
      <password></password> 
      <force_standalone>1</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> 
</global> 
1

我沒有做很多的 「DEV-OPS」 類型的東西,

警告:session_module_name():無法找到名爲PHP會話模塊(Redis的)

是一個PHP錯誤,而不是Magento錯誤。有(據我所知)沒有redis後端存儲模塊,隨PHP附帶。

GitHubCm_RedisSession模塊,在Magento Wiki Setup友情鏈接,你不應該設置

`<session_save>` 

節點local.xml。相反

將app/etc/local.xml中的global/session_save配置更改爲「db」。 「db」值是MySQL處理程序,但Cm_RedisSession會覆蓋它以避免修改核心文件。

,看起來像這樣

<session_save>db</session_save> 
<redis_session>      <!-- All options seen here are the defaults --> 
    <host>127.0.0.1</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>   
    <!-- ... more at https://github.com/colinmollenhour/Cm_RedisSession/blob/master/README.md --> 
+0

謝謝你的建議阿蘭,配置會話這樣,當它保存到數據庫,並沒有觸及我的Redis的情況下,他們纔在港Cm_RedisSession以及後端?當使用'session_save'作爲'files'和'cache'後端類作爲'Mage_Cache_Backend_Redis'時,我得到了同樣的問題,很奇怪。 – input

+0

@input我還沒有看得太深,但是閱讀Cm_RedisSession文檔使得它聽起來像這個擴展在運行時將配置從db更改爲別的。 –