2017-10-13 1 views
0

Lsyncd를 통해 동기화 된 두 개의 동일한 서버 (A와 B)가 있습니다. 주 서버 A는 Apache, Redis 및 RDS로 구성된 Magento 1.9.1 CE를 사용하며 FPC를 사용합니다. 나는 admin을 위해 A를 만들고 B는 front를 위해 custom admin url로 구성했다. varis와 app/etc/local.xml을 제외한 모든 디렉터리를 동기화했습니다. B는 redis 구성을 약간 수정했습니다.Magento 관리자/전면 분할 서버 Redis 오류

B는 A의 redis 인스턴스에 연결됩니다. Redis는 백엔드 캐시 및 세션 저장소로 구성됩니다. 캐시 관리에서 모든 캐시 유형을 사용할 수 없도록 설정했는데 제대로 작동했지만 제대로 작동 할 때 B에서 redis 오류가 발생했습니다. '구성'캐시 유형이 사용 중지되었으며 오류가 사라졌습니다.

신비한 것이 있습니다; 'Configuration'캐시 유형을 활성화 한 다음 redis에서 'flushall'을 수행하면; 어느 서버 A 또는 B가 먼저로드되고 백엔드 캐시 키가 만들어지며 다른 하나는이 오류가 발생합니다. A가 처음으로로드되고 B가 다시 읽기 오류 인 경우를 말합니다. 그리고 redis에서 flushall이 수행되고 B가 먼저로드되면 A는 redis 오류를 갖습니다.

뭐가 잘못 됐는지 모르겠습니다.

 <session_save>db</session_save> 
    <cache> 
     <backend>Mage_Cache_Backend_Redis</backend> 
     <backend_options> 
      <server>127.0.0.1</server> 
      <port>6379</port> 
      <database>0</database> 
      <password>SOME_PASSWORD</password> 
      <force_standalone>0</force_standalone> <!-- 0 for phpredis, 1 for standalone PHP --> 
      <connect_retries>3</connect_retries> <!-- Reduces errors due to random connection failures --> 
      <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 --> 
      <persistent>1</persistent> <!-- persistence value, 0: not in use, > 0 used as persistence ID --> 
     </backend_options> 
    </cache> 
    <redis_session>      <!-- All options seen here are the defaults --> 
     <host>127.0.0.1</host> 
     <port>6379</port> 
     <password>SOME_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> <!-- Set to 0 to disable compression (recommended when suhosin.session.encrypt=on); known bug with strings over 64k: https://github.com/colinmollenhour/Cm_Cache_Backend_Redis/issues/18 --> 
     <compression_lib>gzip</compression_lib>    <!-- gzip, lzf or snappy --> 
     <log_level>4</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 --> 
     <break_after_adminhtml>30</break_after_adminhtml> 
     <bot_lifetime>7200</bot_lifetime>     <!-- Bots get shorter session lifetimes. 0 to disable --> 
    </redis_session> 

문제는 다른 URL 사이에 공유하지 않는 것 백엔드 캐시 즉 데이터베이스 0 함께 : 여기 내 레디 스 구성입니다.

레디 스 오류는 다음과 같습니다 B의 local.xml에 내가 별도의 데이터베이스를 사용하는 경우 Redis error

그러나, 그것은 아무 문제가없는 것보다 백엔드 캐시 2 말할 수 있습니다. A와 B 모두에 대해 동일한 백엔드 캐시 데이터베이스를 사용하고 싶습니다. 아무도 여기에 무슨 일이 일어나는지 이해할 수 있습니까?

감사합니다.

답변

0

해결 방법을 찾았으며 해결책이 맞는 것처럼 보입니다. 두 서버에서 동일한 local.xml 파일을 만들었습니다. 서버 A의 local.xml 파일에서 캐시와 세션 모두에 대해 로컬 IP 127.0.0.1 대신 개인용 IP에 연결하도록 redis를 구성했습니다. B가 이제 A의 redis 인스턴스에 연결해야하므로 구성이 동일합니다. 그리고 나서 나는 홍채를 flushall했고 그것은 효과가있었습니다. Magento가 데이터베이스에 구성을 저장한다고 생각합니다. 캐시 관리에서 캐시 유형 "구성"을 활성화하면 특히 프론트 서버 B에 오류가 발생하는 것으로 보입니다. A가 먼저 호스트 이름을로드 할 때 이전에 127.0.0.1이 데이터베이스에 저장되어 연결을 시도 할 때 redis 연결 오류가 발생한 서버 B가 발생했습니다 원격 서버 A 대신 자체에 연결 (B에서 redis 서비스가 중지됨)

나는 약간의 연구를 수행하여 그 사실을 알았습니다. 이 게시물은 사고 과정을 촉발하는 데 도움이되었습니다.

How can I disable the cache via the database?

는 로컬 데이터베이스와 동일했다. 그래서 RDS를 사용했지만 일관성이없는 호스트 이름과 관련된 문제라는 것을 인식하지 못했습니다.