skip to Main Content

I have taken a free trial for Redis and it gave me an endpoint with a password. I haven’t done anything with Redis or celery before so I really don’t have any idea how it works. From the Docs of Celery everyone connects to the local host but how can I connect to this endpoint?

CELERY_BROKER_URL='redis://localhost:6379',
CELERY_RESULT_BACKEND='redis://localhost:6379'

What should I replace this with? Where should I give the password?

My endpoint looks something like this: redis-18394.c252.######.cloud.redislabs.com:18394, Should I add the password at the end of this after a / ?

2

Answers


  1. You can use channel_redis for this

    CHANNEL_LAYERS = {
        "default": {
            "BACKEND": "channels_redis.core.RedisChannelLayer",
            "CONFIG": {
                "hosts": ["password@your_ip"],
            },
        },
    }
    
    Login or Signup to reply.
  2. According to celery’s documentation, the format is

    redis://:password@hostname:port/db_number
    

    By default, redis has 16 databases so you can use any number from 0-15 for db_number. Use a different db number for broker and result backend.

    https://docs.celeryproject.org/en/stable/getting-started/backends-and-brokers/redis.html#configuration

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