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

RQ Worker can't run when limited to one Redis database #1309

Open
torgeirl opened this issue Jul 10, 2024 · 0 comments
Open

RQ Worker can't run when limited to one Redis database #1309

torgeirl opened this issue Jul 10, 2024 · 0 comments

Comments

@torgeirl
Copy link
Collaborator

torgeirl commented Jul 10, 2024

When running multiple services against the same Redis cluster it seems to be good practice to limit each of the services' Redis user to only have access to their assigned Redis database.

In RQ_QUEUES you can specify which of Redis' 16 (0-15) databases the service should use, ie.:

RQ_QUEUES = {
    'default': {
        'HOST': 'redis-server',
        'PORT': 6379,
        'DB': 3,
        'USERNAME': 'redis_username',
        'PASSWORD': 'redis_password',
        'DEFAULT_TIMEOUT': 500,
        'SSL': True,
    },
    (...)

And in Redis 7.0 the user can be set to only access that database:

redis-server:6379> ACL SETUSER redis_username >redis_password +@all ~3__*:*

Running Devilry's RQ Worker with this setup does however yield an error:

redis.exceptions.NoPermissionError: this user has no permissions to access one of the keys used as arguments

Replacing ~3__*:* with ~* (access to all 16 databases) it runs just fine.

It is unclear if this is a problem in Redis v7.0, a limitation in django-rq, a bug in Devilry 6.3.3's implementation, or a documentation mismatch/something I have misunderstood. Perhaps Devilry's RQ Worker tries to read all databases before using the specified database?

@torgeirl torgeirl added this to the Devilry 6.5 milestone Jul 10, 2024
@torgeirl torgeirl modified the milestones: Devilry 6.5, Devilry 6.4 Aug 9, 2024
@torgeirl torgeirl modified the milestones: Devilry 6.4, Devilry 6.5 Dec 3, 2024
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

1 participant