Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kidig/celery-sentinel
Celery broker for Redis-Sentinel
https://github.com/kidig/celery-sentinel
broker celery redis sentinel
Last synced: 2 months ago
JSON representation
Celery broker for Redis-Sentinel
- Host: GitHub
- URL: https://github.com/kidig/celery-sentinel
- Owner: kidig
- License: mit
- Created: 2021-04-30T22:13:25.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-04-30T23:23:22.000Z (over 3 years ago)
- Last Synced: 2024-10-14T07:19:19.952Z (3 months ago)
- Topics: broker, celery, redis, sentinel
- Language: Python
- Homepage:
- Size: 5.86 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# celery-sentinel
Celery broker for [Redis Sentinel](http://redis.io/topics/sentinel)
## Installation
As simple as possible:
```pip install celery-sentinel```
## Usage
Setup celery broker:
```python
# settings.pyBROKER_URL='redis-sentinel://redis-sentinel:26379/0'
BROKER_TRANSPORT_OPTIONS = {
'sentinels': [('192.168.1.1', 26379),
('192.168.1.2', 26379),
('192.168.1.3', 26379)],
'service_name': 'master',
'socket_timeout': 0.1,
}
```Configure celery app:
```python
# celery_app.py
import osfrom celery_sentinel import Celery
# set the default Django settings module for the 'celery' program.
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.local")app = Celery("your-project")
# Using a string here means the worker doesn't have to serialize
# the configuration object to child processes.
# - namespace='CELERY' means all celery-related configuration keys
# should have a `CELERY_` prefix.
app.config_from_object("django.conf:settings", namespace="CELERY")# Load task modules from all registered Django app configs.
app.autodiscover_tasks()
```Then use the celery as usual.