Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set virtual_host for Redis Sentinels #750

Closed
Duologic opened this issue Jun 7, 2017 · 2 comments
Closed

Set virtual_host for Redis Sentinels #750

Duologic opened this issue Jun 7, 2017 · 2 comments

Comments

@Duologic
Copy link

Duologic commented Jun 7, 2017

Hi guys, I hope to get a quick answer as I have a feeling this is implemented already.

I want to set the virtual_host for the Redis Sentinel configuration, but I don't find it in the code (nor the absent documentation) on how this should be done.

I've got this config for Celery via Django:

CELERY_BROKER_URL = "sentinel://192.168.0.1:26379;sentinel://192.168.0.2:26379;sentinel://192.168.0.3:26379"
CELERY_BROKER_TRANSPORT_OPTIONS = {'visibility_timeout': 1800, 'master_name': 'mymaster'}

The BROKER_TRANSPORT_OPTIONS doesn't include the virtual_host, however I do see it getting extracted from the BROKER_URL in kombu/transport/redis.py, but it is not clear to me if this would work with the Sentinel-style BROKER_URL.

I'm going to try it out anyway, but it wouldn't harm to have this documented somewhere, at least the next person with this question can find it in this ticket then.

@auvipy
Copy link
Member

auvipy commented Jun 7, 2017

try it and let us know. if it works then send a pr for docs inclusion, otherwise with the traceback

@Duologic
Copy link
Author

Duologic commented Jun 7, 2017

This works:

CELERY_BROKER_URL = "sentinel://:s3cr3t@192.168.0.1:26379/2;sentinel://:s3cr3t@192.168.0.2:26379/2;sentinel://:s3cr3t@192.168.0.3:26379/2"
CELERY_BROKER_TRANSPORT_OPTIONS = {'visibility_timeout': 1800, 'master_name': 'mymaster'}

I'm not 100% sure how the password and vhost are found, either it uses only the first match or it matches the current master in Sentinel.

As the password and the vhost are redundant on the latter definitions, wouldn't it be more useful to have it in transport options?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants