1

I have successfully managed to configure page caching by Redis on my Magento 2 store but Session Storage doesn't appear to be working.

I have used this code : http://devdocs.magento.com/guides/v2.0/config-guide/redis/redis-session.html

In Magento 1 we had to set RedisSession.xml to active. Does something similar need to be done on Magento 2 ?

1

Here is a working example of my env.php file. The parts to pay attention to are the cache element and the session element. You may need to adjust the redis host and port number that it is pointed at. As long as you tell Magento where the redis server lives, it will work.

<?php
return [
    'install' => [
        'date' => 'Thu, 02 Nov 2017 13:30:22 +0000'
    ],
    'db' => [
        'connection' => [
            'default' => [
                'username' => 'root',
                'host' => 'mysql',
                'dbname' => 'magento',
                'password' => 'root'
            ],
            'indexer' => [
                'username' => 'root',
                'host' => 'mysql',
                'dbname' => 'magento',
                'password' => 'root'
            ]
        ]
    ],
    'cache' => [
        'frontend' => [
            'default' => [
                'backend' => 'Cm_Cache_Backend_Redis',
                'backend_options' => [
                    'server' => '127.0.0.1',
                    'port' => '6379',
                    'database' => '1'
                ]
            ],
            'page_cache' => [
                'backend' => 'Cm_Cache_Backend_Redis',
                'backend_options' => [
                    'server' => '127.0.0.1',
                    'port' => '6379',
                    'database' => '1'
                ]
            ]
        ]
    ],
    'crypt' => [
        'key' => 'd8567aa9c120960aa842b29c44a0fccd'
    ],
    'session' => [
        'save' => 'redis',
        'redis' => [
            'host' => '127.0.0.1',
            'port' => '6379',
            'database' => '0'
        ]
    ],
    'backend' => [
        'frontName' => 'admin'
    ],
    'resource' => [
        'default_setup' => [
            'connection' => 'default'
        ]
    ],
    'cache_types' => [
        'compiled_config' => 1,
        'config' => 1,
        'layout' => 1,
        'block_html' => 1,
        'collections' => 1,
        'reflection' => 1,
        'db_ddl' => 1,
        'eav' => 1,
        'customer_notification' => 1,
        'full_page' => 1,
        'target_rule' => 1,
        'config_integration' => 1,
        'config_integration_api' => 1,
        'translate' => 1,
        'config_webservice' => 1
    ],
    'MAGE_MODE' => 'developer',
    'system' => [
        'default' => [
            'dev' => [
                'debug' => [
                    'debug_logging' => '0'
                ]
            ]
        ]
    ]
];
0

There is a piece of code further down env.php which defines session as database. This needs to be removed.

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.