Skip to content

ERROR: Error fetching job: READONLY You can't write against a read only replica. #434

Open
@Annastacia-dev

Description

@Annastacia-dev

I'm using sidekiq in my rails app for background processing that depends on a redis container that I have in my compose.yml

 redis:
    image: redis:latest
    container_name: redis_server
    ports:
      - "6379:6379"
    command: redis-server --appendonly yes
    sysctls:
     - net.core.somaxconn=1024
    volumes:
      - redis_data:/data

It works most of the time but sometimes I get this error

 ERROR: Error fetching job: READONLY You can't write against a read only replica.
 2025-03-16T06:30:27.285Z pid=1 tid=j7p WARN: RedisClient::ReadOnlyError: READONLY You can't write against a read only replica. (redis://redis:6379)
 2025-03-16T06:30:27.286Z pid=1 tid=j7p WARN:
 2025-03-16T06:30:28.756Z pid=1 tid=10y1 WARN: Unable to flush stats: READONLY You can't write against a read only replica.
 2025-03-16T06:30:28.771Z pid=1 tid=10y1 ERROR: heartbeat: READONLY You can't write against a read only replica.
 2025-03-16T06:30:35.400Z pid=1 tid=j7p INFO: Redis is online, 8.11720569897443 sec downtime

Which removes all my cron jobs added to the queue and I have to restart my containers.

I have never used redis inside docker before and I haven't faced this issue when using redis anywhere else before.

Any idea what the cause is and how I could fix it would be highly appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions