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

Add Support for Redis as a Persistence Database in Flower #1411

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

NitinSingh8
Copy link

Summary

This pull request introduces support for using Redis as a persistence database in Flower. This enhancement allows users to store and retrieve the state data using Redis, providing a more scalable and distributed solution compared to file-based storage.

Key Changes

  • README Update: Added documentation on how to configure Flower to use Redis for persistence, including the necessary command-line arguments.
  • Redis Integration: Modified flower/events.py to support Redis as a backend for state persistence.
    • Added new parameters: redis_host, redis_port, redis_db, redis_key, and redis_ssl.
    • Implemented logic to load and save state data to Redis using redis.StrictRedis.
    • Ensured backward compatibility by maintaining support for file-based persistence using shelve.

Usage

To use Redis as a persistence database, run Flower with the following command-line arguments:

bash
celery -A tasks.app flower --broker=amqp://guest:guest@localhost:5672// --redis_host=localhost --redis_port=6379 --redis_db=0 --redis_key=flower --redis_ssl=True

Benefits

  • Scalability: Redis provides a scalable solution for state persistence, especially in distributed environments.
  • Performance: Redis offers fast read and write operations, improving the performance of state management.
  • Flexibility: Users can choose between Redis and file-based storage based on their requirements.

Testing

  • Verified that state data is correctly saved and loaded from Redis.
  • Ensured that existing functionality with file-based storage remains unaffected.

Notes

  • Ensure that the Redis server is properly configured and accessible from the Flower instance.
  • The default Redis key is set to flower, but it can be customized as needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant