2 exception(s): Exception #0 (CredisException): READONLY You can't write against a read only replica. Exception #1 (RedisException): READONLY You can't write against a read only replica.
@markshust Description After some time the master configuration itself changes to replication and gives me a problem connecting to the API what is the problem?
Steps To Reproduce I'm currently solving it by going into the redis container in cle and setting repicaof no one But it's just happening now and again.
Actual Result 2 exception(s): Exception #0 (CredisException): READONLY You can't write against a read only replica. Exception #1 (RedisException): READONLY You can't write against a read only replica.
Exception #0 (CredisException): READONLY You can't write against a read only replica.
#1 Cm\RedisSession\Handler->read() called at [vendor/magento/framework/Session/SaveHandler/Redis.php:84] #2 Magento\Framework\Session\SaveHandler\Redis->read() called at [vendor/magento/framework/Session/SaveHandler.php:213] #3 Magento\Framework\Session\SaveHandler->callSafely() called at [vendor/magento/framework/Session/SaveHandler.php:126] #4 Magento\Framework\Session\SaveHandler->read()
The issue you're encountering, where Redis switches to a read-only replica mode, is not directly addressed in the docker-magento repository documentation. However, this behavior can occur due to several reasons, such as network partitions, misconfigurations, or Redis Sentinel triggering a failover.
Here are a few steps you can take to troubleshoot and potentially resolve the issue:
-
Check Redis Configuration: Ensure that your Redis configuration does not include any settings that might trigger a failover or replication. Look for any
replicaoforslaveofdirectives in your Redis configuration files. -
Network Stability: Ensure that your network is stable and that there are no intermittent connectivity issues between your Redis instances, which could cause a failover.
-
Redis Logs: Check the Redis logs for any messages that might indicate why the failover is occurring. This can provide insights into whether it's a configuration issue or an external trigger.
-
Redis Sentinel: If you are using Redis Sentinel for high availability, ensure that it is configured correctly and that the failover conditions are appropriate for your setup.
-
Manual Intervention: As a temporary workaround, you can manually set the Redis instance back to master using the
replicaof no onecommand, as you mentioned. However, this is not a permanent solution.
If the issue persists, you might need to review your entire Redis setup and consider consulting Redis-specific resources or communities for more targeted assistance.
To continue talking to Dosu, mention @dosu.
Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other
I'm unable to replicate, so either need steps to replicate or need multiple other users to confirm this issue.
While working, Redis automatically switches to replication mode and is no longer the master. I manually change it back, and it continues to work, but I don't know why this is happening — it didn't happen before.
What steps do you need me to provide, and what do you suspect might be causing the problem?
@RedbudiDev This issue is not happening for me, so I will need steps from:
- a brand new fresh install of this project
- any changes that may have occurred, if any
- document the process of how to confirm the
redisservice switches from master to slave
The process needs to be reproducible, so that I can replicate it locally on my machine to confirm there is an issue, and work on a potential fix. Thanks!
Hi, @RedbudiDev. I'm Dosu, and I'm helping the docker-magento team manage their backlog and am marking this issue as stale.
Issue Summary:
- You reported that your Redis master node unexpectedly switches to read-only replica mode, causing write errors.
- You temporarily fix the issue by manually resetting the replica status.
- Suggestions were made to check Redis configuration, network stability, logs, and Sentinel setup.
- The maintainer, markshust, has not been able to replicate the issue and requested detailed, reproducible steps including a fresh install and any changes you made.
- You were also asked to document how to confirm the Redis role switch to assist with diagnosis.
Next Steps:
- Please let me know if this issue is still relevant with the latest version of the docker-magento repository by commenting here.
- If I don’t hear back within 30 days, this issue will be automatically closed.
Thanks for your understanding and contribution!