A few weeks ago I was at UKUUG and met an intriguing project (and it’s owner) called mcollective.

MCollective is a system that enables you to run queries across multiple servers in real time and have the responses come back to you in a speed you would only expect if you were physically at the console.  In other words:- it’s f**king quick!

This post sets out to show you how to install it on Ubuntu Server (the instructions should apply to both 9.10 and 10.04 RC), the next set in the series will help you get it up and running across multiple machines!

Before I get started, I feel it’s only fair I’ve tried to install this on Centos  5.4 and Debian Lenny as well as Ubuntu with serious issues.

Debian Lenny works, but you need to install a load of dependencies via GEM and update rubygems to the latest version or install it from source.

Centos 5? Let’s not even go there.  Rubygems aren’t in any of the usual repos, Ruby isn’t up to date in any of the usual repos and if you install ruby and rubygems from source, the MCollective RPMs don’t work because they rely on dependencies in the repos which aren’t up to date enough…see where I’m going here?  I have managed to get it to work on a Centos 5.4 server, but only by installing Ruby, RubyGems and MCollective from source. It isn’t what I would call “fun” and makes a nightmare of managing the entire system through puppet.

Getting Started

If you haven’t already, visit the mcollective website and watch the videos, especially the one on Exim Mail Queues.  Now that your brain has started to generate possibilities at the speed of light, we can continue!

One piece of advice that I felt wasn’t 100% clear on the MCollective Website, you only need to run the MCollective “Client” on the system(s) you wish to use as your administration servers.  Install the “Server” and “Common” packages on all the nodes you wish to monitor/manage and the “Client” and “Common” packages on your “master” computer. I hope I’ve explained that clearly, if not, drop a comment in the box below and I’ll try and explain further.

Once you’ve done that, download the .deb files to your test machine (surely no-one runs test code in production environments now do they?) and execute the following commands:

  • aptitude install ruby rubygems irb
  • gem install stomp
  • dpkg -i mcollective*.deb

You will need a STOMP Server available.  The MCollective website recommends ActiveMQ, however as that’s a large, unwieldy Java-based server (I really don’t like Java! :P) I tried a ruby based stomp server by installing it as follows:

  • aptitude install stompserver

but it only appears to allow one connection at a time.  So we do need to install ActiveMQ. </sigh>

Follow the excellent documentation written by RI at the mcollective website and you can have the server up and running in no time.  When I get a moment, I’ll also post the init-script I wrote to turn activemq into a service you can stop and start properly.

Testing the setup

Once you’ve installed and configured STOMP and MCollective, run the following command:

mc-find-hosts

it should come back very quickly with the local host name.

If you’ve got this far, congratulations! It’s up and running.

Next time, I’ll take you though adding an agent.