Redis and cache issues!

Hello Craig and everyone!

excuse my bag English in advance.

I have followed Craig’s lesson on how to install and configure Redis on the server and everything was running smoothly until I restarted the server, now the pages are loading is very slow and to investigate the problem I copied my live magento store site into a testing environment on the same server.
ex. my live site url is : xxxxx.com
my test magento site url is: xxxxx.com/test

unfortunately, now on the test site whenever I tried to access any page it redirects me to the live site address not the test, even though I made all the necessary changes on the core_config_data table to point to the new address for the test site.

My diagnostion is because of Redis is saving the cache pages of the live site in the server.

My question here is how to resolve this issue? and how go back from Redis to magento default setting?

Best regards,

Ali

Just a few tips based on your situation

  • It’s ideal not to have any sort of caching in a Development environment as it tends to hinder work
  • If you create a copy of your Production Site that already runs Redis, you should always strip out the Redis Caching in app/etc/env.php in the Dev copy (see below)
  • After amending the Base URL in the database, be sure to clear the Magento cache
  • Depending on your store setup, you may have multiple base_url entries in your core_config_data table - Therefore, it’s easy to overlook them

Remove Redis configuration from Magento
Running the Redis commands that configure Magento is a one-way process. In order to “undo” the changes, you’ll need to amend the app/etc/env.php file. What you’re looking to do is strip out the Redis references.

Be careful, editing the wrong parts will break the site - And pay attention to those pesky commas.

To help you work out what needs removing, here is a copy of the app/etc/env.php file before Redis is added:

<?php
return [
    'backend' => [
        'frontName' => 'my_database_url'
    ],
    'install' => [
        'date' => 'Mon, 05 Aug 2019 19:04:55 +0000'
    ],
    'crypt' => [
        'key' => 'my_magento_key'
    ],
    'session' => [
        'save' => 'files'
    ],
    'db' => [
        'table_prefix' => '',
        'connection' => [
            'default' => [
                'host' => 'localhost',
                'dbname' => 'my_database_name',
                'username' => 'my_database_username',
                'password' => 'my_database_password',
                'model' => 'mysql4',
                'engine' => 'innodb',
                'initStatements' => 'SET NAMES utf8;',
                'active' => '1'
            ]
        ]
    ],
    'resource' => [
        'default_setup' => [
            'connection' => 'default'
        ]
    ],
    'x-frame-options' => 'SAMEORIGIN',
    'MAGE_MODE' => 'production',
    'cache_types' => [
        'config' => 1,
        'layout' => 1,
        'block_html' => 1,
        'collections' => 1,
        'reflection' => 1,
        'db_ddl' => 1,
        'eav' => 1,
        'config_integration' => 1,
        'config_integration_api' => 1,
        'full_page' => 1,
        'translate' => 1,
        'config_webservice' => 1,
        'compiled_config' => 1,
        'customer_notification' => 1,
        'vertex' => 1
    ]
];

It should be pretty simple to work out what needs removing. Don’t try to copy and paste this into your server thought because some details won’t be compatible.

Thank you Craig!

I will check it now and let you posted.