otherqueues.rst 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. ==========================================================
  2. Using Celery with Redis/Database as the messaging queue.
  3. ==========================================================
  4. There's a plugin for celery that enables the use of Redis or an SQL database
  5. as the messaging queue. This is not part of celery itself, but exists as
  6. an extension to `carrot`_.
  7. .. _`carrot`: http://ask.github.com/carrot
  8. .. _`ghettoq`: http://ask.github.com/ghettoq
  9. Installation
  10. ============
  11. You need to install the latest development versions of `carrot`_ and
  12. `ghettoq`_::
  13. $ git clone git://github.com/ask/carrot.git
  14. $ cd carrot
  15. $ python setup.py install
  16. $ git clone git://github.com/ask/ghettoq.git
  17. $ cd ghettoq
  18. $ python setup.py install
  19. Redis
  20. =====
  21. For the Redis support you have to install the Python redis client::
  22. $ pip install redis
  23. Configuration
  24. -------------
  25. Configuration is easy, set the carrot backend, and configure the location of
  26. your Redis database::
  27. Configuration
  28. -------------
  29. Configuration is easy, set the carrot backend, and configure the location of
  30. your Redis database::
  31. CARROT_BACKEND = "ghettoq.toproot.Redis"
  32. AMQP_HOST = "localhost" # Maps to redis host.
  33. AMQP_PORT = 6379 # Maps to redis port.
  34. AMQP_VHOST = "celery" # Maps to database name.
  35. Database
  36. ========
  37. Configuration
  38. -------------
  39. The database backend uses the Django ``DATABASE_*`` settings for database
  40. configuration values.
  41. * Set your carrot backend::
  42. CARROT_BACKEND = "ghettoq.toproot.Database"
  43. * Add ``ghettoq`` to ``INSTALLED_APPS``::
  44. INSTALLED_APPS = ("ghettoq", )
  45. * Sync your database schema.
  46. $ python manage.py syncdb
  47. * Or if you're not using django, but the default loader instad run
  48. ``celeryinit``::
  49. $ celeryinit
  50. Important notes
  51. ---------------
  52. These message queues does not have the concept of exchanges and routing keys,
  53. there's only the queue entity. As a result of this you need to set the name of
  54. the exchange to be the same as the queue::
  55. CELERY_AMQP_CONSUMER_QUEUE = "tasks"
  56. CELERY_AMQP_EXCHANGE = "tasks"