OK, so a few people heard that I was playing with RabbitMQ and MCollective and hinted (less than subtly I might add!) that a blog post might be in order, so here it is. If you want someone to blame, look no further than @patrickdebois and @garethr 🙂
The original issue was as follows:
- I already use MCollective with ActiveMQ over STOMP, but the XML config format is a nightmare.
- I want to use LogStash but that uses AMQP and ActiveMQ doesn’t support that.
- I don’t want to have to run two message queuing servers on my network.
@ripienaar mentioned that he’d managed to get MCollective working with RabbitMQ’s new stomp plugin, and RabbitMQ is the AMQP server suggested by the logstash site. This looked promising – could I really kill two birds with one stone?
The answer – I’m pleased to announce – is yes, I was able to kill two birds with one stone, and this is how I did it…
Installing RabbitMQ
Install RabbitMQ-server 2.2.0 from the package downloaded from the RabbitMQ website as the version in EPEL doesn’t support the STOMP plugin.
I’ve found (as with so many of these things!) if the package is available as an RPM it’s probably easier to create your own YUM Repository on a webserver somewhere and point a yum.repo.d config file at it – that way you can let YUM pull in the dependencies instead of sinking into rpm-hell!
If you’re installing from RPM, you’ll need to install EPEL (for the dependencies) and then install the following packages:
yum install tk-8.4.13-5.el5_1.1.i386 unixODBC-2.2.11-7.1.i386 erlang-R12B-5.10.el5.i386
then install the package:
rpm -Uvh rabbitmq-server-2.2.0-1.noarch.rpm
If you’re installing from a yum repo, the following works:
yum install rabbitmq-server
(told you it was easier!)
Once RabbitMQ is installed, download the following plugins from the RabbitMQ site:
amqp_client-2.2.0.ez
rabbit_stomp-2.2.0.ez
and place them into /usr/lib/rabbitmq/lib/rabbitmq_server-2.2.0/plugins
Create /etc/rabbitmq/rabbitmq.conf with the following content:
SERVER_START_ARGS=”-rabbit_stomp listeners [{“0.0.0.0″,6163}]”
and restart RabbitMQ:
service rabbitmq-server restart
Configuring MCollective
I’m assuming that you’ve already got MCollective installed, if not, I just happen to have a handy guide to doing just that, so ignore the ActiveMQ stuff and come back once you’re ready to continue…
OK, sitting comfortably? Good, then I’ll continue! 🙂
The config for MCollective is simple:
- Set the plugin.stomp.host to the ip address of the server running RabbitMQ
- Set plugin.stomp.user to ‘guest’
- Set plugin.stomp.password to ‘guest’
- Make sure port 6163 is open on the RabbitMQ server’s firewall
- Restart MCollective
- Run mc-find-hosts and see all your servers! 🙂
I need to work out how to set the username/password to something other than guest, but the above should get you up and running at least!
To set the username and password, check out http://www.rabbitmq.com/man/rabbitmqctl.1.man.html#Access%20control
LikeLike
Awesome, thanks. I’ll check that out and update the post.
LikeLike
Followed these steps, and it looks like Rabbit is reading the rabbitmq.conf but doesn’t like the syntax:
[root@jessica rabbitmq]# cat /var/log/rabbitmq/startup_err
/etc/rabbitmq/rabbitmq.conf: line 2: listeners: command not found
[root@jessica rabbitmq]# cat /etc/rabbitmq/rabbitmq.conf
# listen for STOMP requests
SERVER_START_ARGS=’-rabbit_stomp listeners [{“0.0.0.0”,6163}]‘
The plugins load but listen on loopback 61613.
LikeLike
Hum, some weird shell escaping thing going on?
This worked for me:
SERVER_START_ARGS=”-rabbit_stomp listeners [{“0.0.0.0″,6163}]”
Going to re-kickstart the box and see if that helps; i did have the EPEL RPM installed before and maybe it’s left something odd lying around.
LikeLike
Hi,
It looks like a cut and paste error – those should be quotes, not back-ticks.
I’ve updated the post to reflect this…
PF.
LikeLike
This works for me:
SERVER_START_ARGS=’-rabbit_stomp listeners [{“0.0.0.0”,61613}]’
LikeLike
Ok, I’m using rabbit 2.1.1 so not sure if this is possible, but here’s my problem.
My rabbitmq.conf syntax breaks with the SERVER_START_ARGS entry.
Currently my conf looks like this:
[
{rabbit, [
{cluster_nodes, [‘rabbit@mgmt1′,’rabbit@mgmt2’]}
]}
].
So that’s erlang syntax if I’m not mistaken. So how do I modify to listen on the proper port?
Or should I say to hell with rabbitmq 2.1.1 and install 2.2?
Also I imagine we should be using a custom user and not guest guest, right?
LikeLike
Ignore this. I was looking at rabbitmq.config not rabbitmq.conf. Damn ig.
Works like a charm.. Now onto the user account.
LikeLike
hi,
I just installed rabbitmq-server-2.3.1-1.noarch.rpm and I had problems making rabbit_stomp listen to 6163. It kept listening to 61613 ( default ). I had placed this statement
SERVER_START_ARGS=”-rabbit_stomp listeners [{“0.0.0.0″,61613}]” in /etc/rabbitmq/rabbitmq.conf
So in the end I got it to work by creating the file /etc/rabbitmq/rabbitmq.config and putting this in
[
{rabbit_stomp, [{tcp_listeners, [6163]} ]}
].
in accordance to the info in the stomp plugin readme. Now this worked. Note that the . period after ] is required. Hope this info helps some other folks struggling with this problem. cheers
LikeLike
For RabbitMQ 2.3.1 and mCollective 1.0.1 I used the following configuration file to get started. This also binds to all interfaces.
SERVER_START_ARGS=”-rabbit_stomp tcp_listeners [6163]”
netstat -nlp | grep 6163; will verify if the beam process is bound to the correct port or not.
LikeLike
>I’ve found (as with so many of these things!) if the package is available as an
> RPM it’s probably easier to create your own YUM Repository on a
> webserver somewhere and point a yum.repo.d config file at it – that way
> you can let YUM pull in the dependencies instead of sinking into rpm-hell!
you can also use the ‘localinstall’ action to install an rpm with yum, eg:
# yum localinstall rabbitmq.rpm
LikeLike
Adding the following to /etc/rabbitmq/rabbitmq.config has done the trick for me.
[
{rabbitmq_stomp, [{tcp_listeners, [6163]} ]}
].
LikeLike
If you don’t want the default guest user the following has worked for me
rabbitmqctl delete_user guest
rabbitmqctl add_user myuser mypass
rabbitmqctl set_permissions myuser “.*” “.*” “.*”
Found at
http://swik.net/Gentoo/Planet+Gentoo/Sune+Kloppenborg+Jeppesen%3A+MCollective+on+Gentoo/e47ov
LikeLike
Just wanted to say that Puppetlabs (now?) provides a yum repository which includes macollective, rabbitmq + stomp plugin etc. RPM to install the puppetlabs repo on CentOS/RHEL
LikeLike
Sorry, here’s the link to install the puppetlabs repo
LikeLike