Redis Error condition on socket for SYNC: Connection refused

Using celery with redis in my django app Everything was working fine until I ran into a problem. The location of the redis files was changed and redis could not access them. After searching, it turns out that this is due to random attacks on the Internet, and it is necessary to add confg After I added the file, they both worked fine for a while, and then this problem appeared

1:S 25 Jun 2021 00:48:12.029 # Error condition on socket for SYNC: Connection refused
1:S 25 Jun 2021 00:48:12.901 * Connecting to MASTER 194.38.20.199:8886
1:S 25 Jun 2021 00:48:12.902 * MASTER <-> REPLICA sync started
1:S 25 Jun 2021 00:48:13.034 # Error condition on socket for SYNC: Connection refused
1:S 25 Jun 2021 00:48:13.907 * Connecting to MASTER 194.38.20.199:8886
1:S 25 Jun 2021 00:48:13.908 * MASTER <-> REPLICA sync started
1:S 25 Jun 2021 00:48:14.041 # Error condition on socket for SYNC: Connection refused

When I rebuild the Redis container it runs for a very short time and I get the same problem

settings.py

CELERY_BROKER_URL = os.environ.get("redis://redis:6379/0")
CELERY_RESULT_BACKEND = os.environ.get("redis://redis:6379/0")

docker-compose.yml

     redis:
      image: 'redis:alpine'
      restart: unless-stopped
      command: redis-server /usr/local/etc/redis/redis.conf
      volumes:
        - ./docker/redis/redis.conf:/usr/local/etc/redis/redis.conf
      ports:
        - '6379:6379'


  celery:
    restart: unless-stopped
    build:
      context: .
      dockerfile: ./docker/backend/Dockerfile_celery
    entrypoint: /app/docker/backend/celery-entrypoint.sh
    environment:
      - some env vars
    depends_on:
      - asgiserver
      - redis

redis.conf

    bind 0.0.0.0 
    protected-mode yes
    rename-command CONFIG ""


Read more here: https://stackoverflow.com/questions/68124389/redis-error-condition-on-socket-for-sync-connection-refused

Content Attribution

This content was originally published by Elabbasy00 at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: