Monday, February 14, 2011

Running MCollective with RabbitMQ on CentOS

Most MCollective examples use ActiveMQ as the queueing system. However, I find ActiveMQ to difficult to manage. This is because of my two main hates: Java and XML. To resolve this I setup RabbitMQ as my queueing system on CentOS.

Step 1)
Install RabbitMQ:

root@server:~ rpm -i http://www.rabbitmq.com/releases/rabbitmq-server/v2.3.1/rabbitmq-server-2.3.1-1.noarch.rpm

Step 2)
Install MCollective

root@server:~ yum install mcollective-client mcollective

or get the RPMs from here: http://www.puppetlabs.com/downloads/mcollective/

Step 3)
Install stomp and amqp

The ruby gems works just fine

root@server:~ gem install stomp amqp

Step 4)
Configure MCollective

Put the following in /etc/mcollective/server.cfg replacing the identity with your server's FQDN. Skip if you already have mcollective configured.
# main config
topicprefix = /topic/mcollective
libdir = /usr/libexec/mcollective
logfile = /var/log/mcollective.log
daemonize = 1
keeplogs = 1
max_log_size = 10240
loglevel = debug
identity = server.mydomain.com
registerinterval = 300
classesfile = /var/lib/puppet/state/classes.txt

# connector plugin config
connector = stomp
plugin.stomp.host = server.mydomain.com
plugin.stomp.port = 6163
plugin.stomp.user = mcollective
plugin.stomp.password = marionette

# facts
factsource = facter
plugin.yaml = /etc/mcollective/facts.yaml

# security plugin config
securityprovider = psk
plugin.psk = abcdefghj

Step 5)
Configure RabbitMQ

Step 5.1)
Setup rabbitmq.config

Create the file /etc/rabbitmq/rabbitmq.config with the following contents

[ {rabbit_stomp, [{tcp_listeners, [6163]} ]} ].

Step 5.2)
Add mcollective user

The following command will create the mcollective user with password marionette.

root@server:~ rabbitmqctl add_user mcollective marionette

Step 5.3)
Set mcollective permissions

root@server:~ rabbitmqctl set_permissions -p / mcollective "^amq.gen-.*" ".*" ".*"

Step 6)
Install rabbitmq stomp plugin

root@server:~ cd /usr/lib/rabbitmq/lib/rabbitmq_server-2.3.1/plugins
root@server:~ wget http://www.rabbitmq.com/releases/plugins/v2.3.1/amqp_client-2.3.1.ez
root@server:~ wget http://www.rabbitmq.com/releases/plugins/v2.3.1/rabbit_stomp-2.3.1.ez

Step 7)
Start RabbitMQ

root@server:~ service rabbitmq-server start

0 comments: