Search code examples
dockerrediscelerycelerybeat

Celery beat + redis with password throws No Auth exception


I am using celery and redis as two services in my docker setup. Configuration is as below:

  redis:
    image: redis:latest
    hostname: redis
    ports:
      - "0.0.0.0:6379:6379"
    command:
      --requirepass PASSWORD

  celeryworker:
    <<: *django
    depends_on:
      - redis
      - postgres
    command: "celery -E -A rhombus.taskapp worker --beat --scheduler redbeat.schedulers:RedBeatScheduler --loglevel INFO --uid taskmaster --concurrency=5"

When I try to build my containers and schedule some jobs once the workers are ready I get an exception

[2018-03-20 04:40:52,082: WARNING/Beat] redis.exceptions.ResponseError: NOAUTH Authentication required.

I have been unable to figure out what else would be required as configuration to get this setup working. Some insights and guidance into the issue is appreciable.

Below is the complete stack trace.

Complete stack trace


Solution

  • If you have authentication for redis, then URI should be in this format.

    broker_url = 'redis://user:password@redishost:6379/0'
    

    The URI you mentioned is not a valid redis uri. If you update URI, it should work.

    Without authentication, uri should be

    broker_url = 'redis://redishost:6379/0'