Connecting to Redis Cluster
RedBeat supports connecting to a native Redis Cluster setup.
To configure a Redis Cluster connection, you should use the redis-cluster:// URL scheme and provide the initial list of cluster nodes in redbeat_redis_options.
Configuration
Using REDBEAT_REDIS_URL
This is the recommended approach to keep RedBeat's configuration separate from the Celery broker.
# celeryconfig.py
REDBEAT_REDIS_URL = 'redis-cluster://redis-cluster:30001/0'
REDBEAT_REDIS_OPTIONS = {
'startup_nodes': [
{"host": "192.168.1.1", "port": "30001"},
{"host": "192.168.1.2", "port": "30002"},
{"host": "192.168.1.3", "port": "30003"}
],
'password': 'your-redis-password'
}
Using BROKER_URL
If your Celery broker also uses the same Redis Cluster, you can configure it globally.
# celeryconfig.py
BROKER_URL = 'redis-cluster://redis-cluster:30001/0'
BROKER_TRANSPORT_OPTIONS = {
'startup_nodes': [
{"host": "192.168.1.1", "port": "30001"},
{"host": "192.168.1.2", "port": "30002"},
],
'password': 'your-redis-password'
}
# RedBeat will inherit these settings by default
Notes:
- The hostname and port in the URL are ignored. The
startup_nodeslist is the authoritative source for the initial connection. - The Redis client will automatically discover the rest of the cluster topology from the startup nodes.
- The
portvalue in thestartup_nodeslist can be a string or an integer.