-
-
Notifications
You must be signed in to change notification settings - Fork 286
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
Sentinel support broken since 2.9.0 #642
Comments
This appears to depend on how you have your sentinel configured. We use Django's CACHES to define the redis connection via django-redis instead of django-rq since it was more expressive (at least at the time) and it will have a host, but not a port as I fixed in #637. You may want to provide a minimal config to either easily reproduce or allow someone to create an appropriate test. If you have the time a PR would be helpful 🙂 |
@terencehonles RQ_QUEUES = {
'default': {
'HOST': 'localhost',
'PORT': 6379,
'DB': 0,
'USERNAME': 'some-user',
'PASSWORD': 'some-password',
'DEFAULT_TIMEOUT': 360,
'REDIS_CLIENT_KWARGS': { # Eventual additional Redis connection arguments
'ssl_cert_reqs': None,
},
},
'with-sentinel': {
'SENTINELS': [('localhost', 26736), ('localhost', 26737)],
'MASTER_NAME': 'redismaster',
'DB': 0,
# Redis username/password
'USERNAME': 'redis-user',
'PASSWORD': 'secret',
'SOCKET_TIMEOUT': 0.3,
'CONNECTION_KWARGS': { # Eventual additional Redis connection arguments
'ssl': True
},
'SENTINEL_KWARGS': { # Eventual Sentinel connection arguments
# If Sentinel also has auth, username/password can be passed here
'username': 'sentinel-user',
'password': 'secret',
},
},
'high': {
'URL': os.getenv('REDISTOGO_URL', 'redis://localhost:6379/0'), # If you're on Heroku
'DEFAULT_TIMEOUT': 500,
},
'low': {
'HOST': 'localhost',
'PORT': 6379,
'DB': 0,
}
} As you can see: To provide more example config, take a look at referenced NetBox issue description: |
Hi, sentinel support should be added to RQ itself so please open an issue there. |
@selwin Also django-rq has a Sentinel config-example in the README.md: https://github.com/rq/django-rq/blob/v2.10.1/README.rst?plain=1#L60-L76 |
@moonrail PR welcome :) |
PR #671 has been merged and fixes the issue. The fix is not released yet (as of 2.10.2). |
Hello altogether,
while using redis sentinel we've run into the following exception with django-rq 2.9.0 and 2.10.1:
Sentinel configuration does not have a
host
key, hence theKeyError
.The cause can be found here: https://github.com/rq/django-rq/blob/v2.10.1/django_rq/utils.py#L106
It was introduced with this commit: df32713
I like that tests were added to test this new functionality as well, but they should also cover sentinel setups, as this library supports them and even provides example configuration as simple in the README.md for it.
We've stumbled over this problem via usage of NetBox, a Django based application leveraging django-rq: netbox-community/netbox#14752
The text was updated successfully, but these errors were encountered: