Manage rabbitmq-server with supervisor

First I installed rabbitmq:

$ brew install rabbitmq
...
==> make install
/usr/local/Cellar/rabbitmq/2.4.1: 114 files, 1.6M, built in 41 seconds

Running rabbitmq-server will start a server in the foreground, which is kind of inconvenient.

So I installed Supervisor:

$ pip install supervisor
Downloading/unpacking supervisor
  Downloading supervisor-3.0a10.tar.gz (438Kb): 438Kb downloaded
...
    Installing echo_supervisord_conf script to /Library/Frameworks/Python.framework/Versions/2.7/bin
    Installing pidproxy script to /Library/Frameworks/Python.framework/Versions/2.7/bin
    Installing supervisorctl script to /Library/Frameworks/Python.framework/Versions/2.7/bin
    Installing supervisord script to /Library/Frameworks/Python.framework/Versions/2.7/bin
Successfully installed meld3 supervisor
Cleaning up...

Then to set up Supervisor to manage rabbitmq:

$ echo_supervisord_conf > supervisord.conf
$ sudo mv supervisord.conf /etc
$ sudo vim /etc/supervisord.conf
...
$ grep rabbitmq /etc/supervisord.conf 
[program:rabbitmq]
command=/usr/local/sbin/rabbitmq-server

and then to start up rabbitmq and test that it’s working:

$ supervisord
$ supervisorctl status
rabbitmq                         RUNNING    pid 60340, uptime 0:00:04
$ rabbitmqctl status
Status of node 'rabbit@ladyproud-lm' ...
[{pid,60340},
 {running_applications,[{rabbit,"RabbitMQ","2.4.1"},
                        {os_mon,"CPO  CXC 138 46","2.2.5"},
                        {sasl,"SASL  CXC 138 11","2.1.9.3"},
                        {mnesia,"MNESIA  CXC 138 12","4.4.17"},
                        {stdlib,"ERTS  CXC 138 10","1.17.3"},
                        {kernel,"ERTS  CXC 138 10","2.14.3"}]},
 {nodes,[{disc,['rabbit@ladyproud-lm']}]},
 {running_nodes,['rabbit@ladyproud-lm']}]
...done.
$ rabbitmqctl list_exchanges
Listing exchanges ...
amq.direct      direct
amq.topic       topic
amq.rabbitmq.log        topic
amq.fanout      fanout
amq.headers     headers
        direct
amq.match       headers
...done.

Leave a Reply

Your email address will not be published. Required fields are marked *