django-q2
django-q2 copied to clipboard
Running multiple clusters
Hello I want to run multiple clusters on a django project . I found this in the docs:
"You can have multiple clusters on multiple machines, working on the same queue as long as:
They connect to the same broker.
They use the same cluster name. See Configuration
They share the same SECRET_KEY for Django."
Can anyone explain how to implement this, I didn't get it. I understood the configuration but do we have to run same project on multiple servers or something like that. Also how to use same secret key?
Thanks
Can anyone explain how to implement this, I didn't get it.
This entirely depends on what your setup is. If you are using Heroku for example, then you can simply run multiple dynos with the same python manage.py qcluster
command. If you are using supervisor, then you can run multiple processes with the same command.
If you are using docker, you can just run multiple containers with that command.
Also how to use same secret key?
You should be running the same app in those containers/servers/whatever. Django needs a SECRET_KEY
to be set, which is also used by Django-q(2) to sign tasks with. If you would set a different SECRET_KEY
, then it wouldn't be able to read the data from the broker.
Does that make sense?