I am using Laradock to deploy a Laravel application.
Suddenly I get the following error, when hitting the welcome page of the app:
RedisException READONLY You can’t write against a read only replica
I have set to true the installation of Redis in the three workspace, php-fpm, and worker containers:
.env
WORKSPACE_INSTALL_PHPREDIS=true
PHP_FPM_INSTALL_PHPREDIS=true
PHP_WORKER_INSTALL_REDIS=true
I also get the exact same error if I test redis in Artisan tinker
➜ www git:(master) ✗ artisan tinker
Psy Shell v0.11.4 (PHP 8.1.5 — cli) by Justin Hileman
>>> Cache::store('redis')->put('Laradock', 'Awesome', 10);
RedisException with message 'READONLY You can't write against a read only replica.'
How do I fix this?
2
Answers
I had restart docker container (redis) to fix it
add this to your redis docker compose
using
redis-cli
check ifconfig get replica-read-only
gives valueno
.Sorce:
https://laracasts.com/discuss/channels/servers/docker-on-production-error-redisexception-readonly-you-cant-write-against-a-read-only-replica