2

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 2

5

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

Sign up to request clarification or add additional context in comments.

2 Comments

I can confirm, this format worked. I set the broker URL to the redis endpoint with password and set db_number to 0.
where to put username in this format? Before password and the preceding colon?
0

You can use channel_redis for this

CHANNEL_LAYERS = {
    "default": {
        "BACKEND": "channels_redis.core.RedisChannelLayer",
        "CONFIG": {
            "hosts": ["password@your_ip"],
        },
    },
}

2 Comments

Can you just show me the full code? How does this channel be given to celery?
I have added the repo link just above the code. It has a good readme that you can refer to!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.