Skip to content

Magento 2.4.4 READONLY You can’t write against a read-only replica

The website keeps going down throwing error.

{“0″:”READONLY You can’t write against a read-only replica.”,”1″:”#1
CmRedisSessionHandler->read() called at
[vendor/magento/framework/Session/SaveHandler/Redis.php:98]n#2
MagentoFrameworkSessionSaveHandlerRedis->read() called at
[vendor/magento/framework/Session/SaveHandler.php:212]n#3
MagentoFrameworkSessionSaveHandler->callSafely() called at
[vendor/magento/framework/Session/SaveHandler.php:125]n#4
MagentoFrameworkSessionSaveHandler->read()n#5 session_start()
called at
[vendor/magento/framework/Session/SessionManager.php:204]n#6
MagentoFrameworkSessionSessionManager->start() called at
[generated/code/Magento/Backend/Model/Auth/Session/Interceptor.php:122]n#7
MagentoBackendModelAuthSessionInterceptor->start() called at
[vendor/magento/framework/Session/SessionManager.php:141]n#8
MagentoFrameworkSessionSessionManager->__construct() called at
[vendor/magento/module-backend/Model/Auth/Session.php:102]n#9
MagentoBackendModelAuthSession->__construct() called at
[generated/code/Magento/Backend/Model/Auth/Session/Interceptor.php:14]n#10
MagentoBackendModelAuthSessionInterceptor->__construct()
called at
[vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:121]n#11
MagentoFrameworkObjectManagerFactoryAbstractFactory->createObject()
called at
[vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:66]n#12
MagentoFrameworkObjectManagerFactoryDynamicDeveloper->create()
called at
[vendor/magento/framework/ObjectManager/ObjectManager.php:70]n#13
MagentoFrameworkObjectManagerObjectManager->get() called at
[vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:170]n#14
MagentoFrameworkObjectManagerFactoryAbstractFactory->resolveArgument()
called at
[vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:276]n#15
MagentoFrameworkObjectManagerFactoryAbstractFactory->getResolvedArgument()
called at
[vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:239]n#16
MagentoFrameworkObjectManagerFactoryAbstractFactory->resolveArgumentsInRuntime()
called at
[vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:34]n#17
MagentoFrameworkObjectManagerFactoryDynamicDeveloper->_resolveArguments()
called at
[vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:59]n#18
MagentoFrameworkObjectManagerFactoryDynamicDeveloper->create()
called at
[vendor/magento/framework/ObjectManager/ObjectManager.php:70]n#19
MagentoFrameworkObjectManagerObjectManager->get() called at
[vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:170]n#20
MagentoFrameworkObjectManagerFactoryAbstractFactory->resolveArgument()
called at
[vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:276]n#21
MagentoFrameworkObjectManagerFactoryAbstractFactory->getResolvedArgument()
called at
[vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:239]n#22
MagentoFrameworkObjectManagerFactoryAbstractFactory->resolveArgumentsInRuntime()
called at
[vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:34]n#23
MagentoFrameworkObjectManagerFactoryDynamicDeveloper->_resolveArguments()
called at
[vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:59]n#24
MagentoFrameworkObjectManagerFactoryDynamicDeveloper->create()
called at
[vendor/magento/framework/ObjectManager/ObjectManager.php:70]n#25
MagentoFrameworkObjectManagerObjectManager->get() called at
[vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:206]n#26
MagentoFrameworkObjectManagerFactoryAbstractFactory->parseArray()
called at
[vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:182]n#27
MagentoFrameworkObjectManagerFactoryAbstractFactory->resolveArgument()
called at
[vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:276]n#28
MagentoFrameworkObjectManagerFactoryAbstractFactory->getResolvedArgument()
called at
[vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:239]n#29
MagentoFrameworkObjectManagerFactoryAbstractFactory->resolveArgumentsInRuntime()
called at
[vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:34]n#30
MagentoFrameworkObjectManagerFactoryDynamicDeveloper->_resolveArguments()
called at
[vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:59]n#31
MagentoFrameworkObjectManagerFactoryDynamicDeveloper->create()
called at
[vendor/magento/framework/ObjectManager/ObjectManager.php:70]n#32
MagentoFrameworkObjectManagerObjectManager->get() called at
[vendor/magento/framework/App/FrontController.php:109]n#33
MagentoFrameworkAppFrontController->__construct() called at
[generated/code/Magento/Framework/App/FrontController/Interceptor.php:14]n#34
MagentoFrameworkAppFrontControllerInterceptor->__construct()
called at
[vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:121]n#35
MagentoFrameworkObjectManagerFactoryAbstractFactory->createObject()
called at
[vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:66]n#36
MagentoFrameworkObjectManagerFactoryDynamicDeveloper->create()
called at
[vendor/magento/framework/ObjectManager/ObjectManager.php:70]n#37
MagentoFrameworkObjectManagerObjectManager->get() called at
[vendor/magento/framework/App/Http.php:115]n#38
MagentoFrameworkAppHttp->launch() called at
[generated/code/Magento/Framework/App/Http/Interceptor.php:23]n#39
MagentoFrameworkAppHttpInterceptor->launch() called at
[vendor/magento/framework/App/Bootstrap.php:264]n#40

I have Redis installedenter image description here via Docker on Plesk Control Panel running on CentOS operating system. I restart Redis to get the website back online again, attached is the Redis Container configuration.

Also below is env configuration for Redi

    'cache' => [
        'frontend' => [
            'default' => [
                'backend' => 'Magento\Framework\Cache\Backend\Redis',
                'backend_options' => [
                    'server' => '127.0.0.1',
                    'database' => '0',
                    'port' => '6379'
                ]
            ],
            'page_cache' => [
                'backend' => 'Magento\Framework\Cache\Backend\Redis',
                'backend_options' => [
                    'server' => '127.0.0.1',
                    'port' => '6379',
                    'database' => '0',
                    'password' => '',
                    'compress_data' => '1',
                    'force_standalone' => '0',
                    'connect_retries' => '10',
                    'read_timeout' => '30',
                    'automatic_cleaning_factor' => '0',
                    'compress_tags' => '1',
                    'compress_threshold' => '20480',
                    'compression_lib' => 'gzip'
                ]
            ]
        ],
        'allow_parallel_generation' => false,
        'graphql' => [
            'id_salt' => 'xxxxxxxxx'
        ]
    ],
   'session' => [
        'save' => 'redis',
        'redis' => [
            'host' => '127.0.0.1',
            'port' => '6379',
            'password' => '',
            'timeout' => '15',
            'persistent_identifier' => '',
            'database' => '2',
            'compression_threshold' => '2048',
            'compression_library' => 'gzip',
            'log_level' => '1',
            'max_concurrency' => '15',
            'break_after_frontend' => '5',
            'break_after_adminhtml' => '30',
            'first_lifetime' => '600',
            'bot_first_lifetime' => '60',
            'bot_lifetime' => '7200',
            'disable_locking' => '1',
            'min_lifetime' => '60',
            'max_lifetime' => '2592000'
        ]
    ],
    'cache_types' => [
        'config' => 1,
        'layout' => 1,
        'block_html' => 1,
        'collections' => 1,
        'reflection' => 1,
        'db_ddl' => 1,
        'eav' => 1,
        'customer_notification' => 1,
        'config_integration' => 1,
        'config_integration_api' => 1,
        'full_page' => 1,
        'translate' => 1,
        'config_webservice' => 1,
        'compiled_config' => 1,
        'vertex' => 1
    ],