skip to Main Content

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


  1. I had restart docker container (redis) to fix it

    Login or Signup to reply.
  2. add this to your redis docker compose

    ​command: redis-server --appendonly yes --replica-read-only no ​
    

    using redis-cli check if config get replica-read-only​ gives value no.

    Sorce:
    https://laracasts.com/discuss/channels/servers/docker-on-production-error-redisexception-readonly-you-cant-write-against-a-read-only-replica

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search