Question

I've recently switched from memcache to redis to handle the cache and session storage. All has gone well except I can't flush the cache for the home page.

Template updates won't show and sessions aren't working correctly on the home page. It doesn't allow products to be added to the cart and shows the cart as empty, even if products have been successfully added on pages other than the home page.

Things I've tried:
- Flushing cache & cache storage in magento backend
- Flushing cache/sessions with redis cli(redis-cli flushall & redis-cli -n 0 flushdb)
- Flushing cloudflare cache
- Restarting services(php-fpm/opcache, nginx, redis, mariadb)
- Checked file permissions & ownership

Server stack:
- magento CE 1.9.3.2
- centos 7.3.1611(Core) x86_64
- nginx 1.10.2
- php 5.4.16(opcache 7.0.5)
- redis 3.2.3
- mysql 15.1 Distrib 5.5.52-MariaDB

My local.xml setup:

<?xml version="1.0"?>
<config>
    <global>
        <install>
            <date><![CDATA[Mon, 29 Dec 2014 02:23:52 +0000]]></date>
        </install>
        <crypt>
            <key><![CDATA[EXAMPLE]]></key>
        </crypt>
        <disable_local_modules>false</disable_local_modules>
        <resources>
            <db>
                <table_prefix><![CDATA[]]></table_prefix>
            </db>
            <default_setup>
                <connection>
                    <host><![CDATA[localhost]]></host>
                    <username><![CDATA[EXAMPLE]]></username>
                    <password><![CDATA[EXAMPLE]]></password>
                    <dbname><![CDATA[EXAMPLE]]></dbname>
                    <initStatements><![CDATA[SET NAMES utf8]]></initStatements>
                    <model><![CDATA[mysql4]]></model>
                    <type><![CDATA[pdo_mysql]]></type>
                    <pdoType><![CDATA[]]></pdoType>
                    <active>1</active>
                </connection>
            </default_setup>
        </resources>

        <cache>
            <backend>Cm_Cache_Backend_Redis</backend>
            <backend_options>
                <server>127.0.0.1</server>
                <port>6379</port>
                <persistent></persistent>
                <database>0</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>gzip</compression_lib>
            </backend_options>
        </cache>

        <session_save>db</session_save>
        <redis_session>
            <host>127.0.0.1</host>
            <port>6379</port>
            <password></password>
            <timeout>2.5</timeout>
            <persistent></persistent>
            <db>2</db>
            <compression_threshold>2048</compression_threshold>
            <compression_lib>gzip</compression_lib>
            <log_level>4</log_level>
            <max_concurrency>6</max_concurrency>
            <break_after_frontend>5</break_after_frontend>
        </redis_session>
    </global>
    <admin>
        <routers>
            <adminhtml>
                <args>
                    <frontName><![CDATA[backend]]></frontName>
                </args>
            </adminhtml>
        </routers>
    </admin>
    <stores>
        <admin>
            <design>
                <package>
                    <name>default</name>
                </package>
                <theme>
                    <default>[EXAMPLE]</default>
                </theme>
            </design>
        </admin>
    </stores>
    <stores>
        <admin>
            <design>
                <package>
                    <name>default</name>
                </package>
                <theme>
                    <default>[EXAMPLE]</default>
                </theme>
            </design>
        </admin>
    </stores>
</config>

My redis config file with comments removed(only the dir setting has been changed):

daemonize no
pidfile /var/run/redis/redis.pid
port 6379
tcp-backlog 511
bind 127.0.0.1
timeout 0
tcp-keepalive 0
loglevel notice
logfile /var/log/redis/redis.log
databases 16
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
dir /ebs2/redis/
slave-serve-stale-data yes
slave-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-disable-tcp-nodelay no
slave-priority 100
appendonly no
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-entries 512
list-max-ziplist-value 64
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
aof-rewrite-incremental-fsync yes
Était-ce utile?

La solution

In my base magento directory was the file index.html as well as duplicates index.html.1 and index.html.2. They were static html copies of the home page after being rendered by magento.

How they got there I'm not sure(I assume it was something I've done myself, maybe from wget'ing the websites headers or something similar). Removing them and flushing the cache fixed it.

Licencié sous: CC-BY-SA avec attribution
Non affilié à magento.stackexchange
scroll top