broker-installation.rst 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. =====================
  2. Broker Installation
  3. =====================
  4. .. contents::
  5. :local:
  6. Installing RabbitMQ
  7. ===================
  8. See `Installing RabbitMQ`_ over at RabbitMQ's website. For Mac OS X
  9. see `Installing RabbitMQ on OS X`_.
  10. .. _`Installing RabbitMQ`: http://www.rabbitmq.com/install.html
  11. Setting up RabbitMQ
  12. ===================
  13. To use celery we need to create a RabbitMQ user, a virtual host and
  14. allow that user access to that virtual host::
  15. $ rabbitmqctl add_user myuser mypassword
  16. $ rabbitmqctl add_vhost myvhost
  17. $ rabbitmqctl set_permissions -p myvhost myuser ".*" ".*" ".*"
  18. See the RabbitMQ `Admin Guide`_ for more information about `access control`_.
  19. .. _`Admin Guide`: http://www.rabbitmq.com/admin-guide.html
  20. .. _`access control`: http://www.rabbitmq.com/admin-guide.html#access-control
  21. Installing RabbitMQ on OS X
  22. ===========================
  23. The easiest way to install RabbitMQ on Snow Leopard is using `Homebrew`_; the new
  24. and shiny package management system for OS X.
  25. In this example we'll install homebrew into ``/lol``, but you can
  26. choose whichever destination, even in your home directory if you want, as one of
  27. the strengths of homebrew is that it's relocateable.
  28. Homebrew is actually a `git`_ repository, so to install homebrew, you first need to
  29. install git. Download and install from the disk image at
  30. http://code.google.com/p/git-osx-installer/downloads/list?can=3
  31. When git is installed you can finally clone the repo, storing it at the
  32. ``/lol`` location::
  33. $ git clone git://github.com/mxcl/homebrew /lol
  34. Brew comes with a simple utility called ``brew``, used to install, remove and
  35. query packages. To use it you first have to add it to ``PATH``, by
  36. adding the following line to the end of your ``~/.profile``::
  37. export PATH="/lol/bin:/lol/sbin:$PATH"
  38. Save your profile and reload it::
  39. $ source ~/.profile
  40. Finally, we can install rabbitmq using ``brew``::
  41. $ brew install rabbitmq
  42. .. _`Homebrew`: http://github.com/mxcl/homebrew/
  43. .. _`git`: http://git-scm.org
  44. Configuring the system hostname
  45. -------------------------------
  46. If you're using a DHCP server that is giving you a random hostname, you need
  47. to permanently configure the hostname. This is because RabbitMQ uses the hostname
  48. to communicate with nodes.
  49. Use the ``scutil`` command to permanently set your hostname::
  50. sudo scutil --set HostName myhost.local
  51. Then add that hostname to ``/etc/hosts`` so it's possible to resolve it
  52. back into an IP address::
  53. 127.0.0.1 localhost myhost myhost.local
  54. If you start the rabbitmq server, your rabbit node should now be ``rabbit@myhost``,
  55. as verified by ``rabbitmqctl``::
  56. $ sudo rabbitmqctl status
  57. Status of node rabbit@myhost ...
  58. [{running_applications,[{rabbit,"RabbitMQ","1.7.1"},
  59. {mnesia,"MNESIA CXC 138 12","4.4.12"},
  60. {os_mon,"CPO CXC 138 46","2.2.4"},
  61. {sasl,"SASL CXC 138 11","2.1.8"},
  62. {stdlib,"ERTS CXC 138 10","1.16.4"},
  63. {kernel,"ERTS CXC 138 10","2.13.4"}]},
  64. {nodes,[rabbit@myhost]},
  65. {running_nodes,[rabbit@myhost]}]
  66. ...done.
  67. This is especially important if your DHCP server gives you a hostname
  68. starting with an IP address, (e.g. ``23.10.112.31.comcast.net``), because
  69. then RabbitMQ will try to use ``rabbit@23``, which is an illegal hostname.
  70. Starting/Stopping the RabbitMQ server
  71. -------------------------------------
  72. To start the server::
  73. $ sudo rabbitmq-server
  74. you can also run it in the background by adding the ``-detached`` option
  75. (note: only one dash)::
  76. $ sudo rabbitmq-server -detached
  77. Never use ``kill`` to stop the RabbitMQ server, but rather use the
  78. ``rabbitmqctl`` command::
  79. $ sudo rabbitmqctl stop
  80. When the server is running, you can continue reading `Setting up RabbitMQ`_.