exceptionz

Thoughts on Technology, Methodology and Programming.

Archive for March, 2010

Install RabbitMQ on Snow Leopard with Macports

Posted by Marcus Wyatt on 10 March 2010

Before we can start to install RabbitMQ, we need to update the MacPorts repository to use the latest RabbitMQ release:

Open /opt/local/etc/macports/sources.conf in text editor, and replace the ‘rsync://’ line with the following:

http://www.rabbitmq.com/releases/macports
rsync://rsync.macports.org/release/ports/ [default]

Now we can use the sync command to cause MacPorts to retrieve the package indices from the newly-added repository

sudo port sync

Before you install, it will be a good idea to check the available versions of RabbitMQ server by running ‘port search’.

Now, we can install:

sudo port install rabbitmq-server

All good so far, right.

Then the instructions tells you when you want to run the newly installed RabbitMQ server, all you need to do is execute:

sudo rabbitmq-server

Or you can enable the launchd startup item:

sudo launchctl load -w /Library/LaunchDaemons/org.macports.rabbitmq-server.plist

BUT, you get the following error when running ‘sudo rabbitmq-server’:


The error is caused because Erlang cannot find the rabbitmq libraries. The libraries should be installed into the same directory as the Erlang/OTP’s core libraries. The directory usually is ‘/opt/local/lib/rabbitmq/lib’ when you used MacPorts to install Erlang.

You can find out where the libraries is install by using the Erlang shell:

  1. Enter the Erlang console by executing ’erl’ in your shell
  2. Now execute ’code:get_path().’ to get the Erlang libraries path, you should see the following:

Next we need to find out where the RabbitMQ libraries are installed. Normally, with MacPorts install it should be ‘/opt/local/lib/rabbitmq/lib/rabbitmq_server-1.7.2’ (can be another version as well). But, if you used another install method, then you can just search the filesystem for ‘rabbit.beam’ to find the location.

Now, we need to symlink the rabbitmq_server library directory to the Erlang library directory.

cd /opt/local/lib/erlang/lib/
sudo ln -s /opt/local/lib/rabbitmq/lib/rabbitmq_server-1.7.2 rabbitmq_server-1.7.2

And you should be good to go. Now just start your RabbitMQ server with:

sudo rabbitmq-server

And check the server status with:

sudo rabbitmqctl status

You shouldn’t see any error output for the status call.

Status of node ‘rabbit@marcus-macbook’ …[{running_applications,[{rabbit,”RabbitMQ”,”1.7.2”},
{mnesia,”MNESIA CXC 138 12”,”4.4.12”},
{os_mon,”CPO CXC 138 46”,”2.2.4”},
{sasl,”SASL CXC 138 11”,”2.1.8”},
{stdlib,”ERTS CXC 138 10”,”1.16.4”},
{kernel,”ERTS CXC 138 10”,”2.13.4”}]},
{nodes,[‘rabbit@some-server’]},
{running_nodes,[‘rabbit@some-server’]}]
…done.

If you are having troubles with starting the server, try the following:

  • Make sure your ‘/etc/hosts’ file has an entry to ‘127.0.0.1’ pointing to your computer name. To locate your computer name just look in System Settings > Sharing and at the top you’ll see a box containing the computer name.
  • If you are still having issues, try deleting the mnesia database backing RabbitMQ. (When the server starts successfully it will create a new database.)

    sudo rm -rf /opt/local/var/lib/rabbitmq/mnesia/rabbit

Hopefully, peeps will find some of this helpful.

Later


Posted in Uncategorized | Tagged: , , | 5 Comments »