Mini-cluster (mclu) command line tool

After setting up my virtualization cluster I was disappointed by the available cluster management tools. You can either “go large” (Openstack) with all the associated trauma of setting that up, or go with various GUIs. Or you can run ssh & virsh commands, which gets tedious quickly.

Therefore I wrote some simple scripts to help perform common cluster operations on small clusters (up to about 10 nodes). It’s only 1000 lines of code, and the advantage is you only need sshd and libvirtd on each node, which you almost certainly have already.

You can download them from this git repository.

Get cluster status:

$ mclu status
ham0 ( down
ham1 ( down
ham2 ( down
ham3 ( down
$ mclu wake --all
$ mclu status
ham0 ( up ssh: OK libvirt: OK
ham1 ( up ssh: OK libvirt: OK
ham2 ( up ssh: OK libvirt: OK
ham3 ( up ssh: OK libvirt: OK

Build a new VM (using virt-builder):

$ mclu build --size=20G -- \
   ham0:tmp-f20-1 fedora-20 \
   --root-password password:123456

List running VMs, live-migrate the new one around:

Note that wildcards can be used when starting, stopping and migrating VMs:

$ mclu list
ham0:tmp-f20-1	running
$ mclu migrate \* ham2:
$ mclu list
ham2:tmp-f20-1	running
$ mclu stop ham2:*
$ mclu list
tmp-f20-1	inactive

Open a console

$ mclu start ham3:tmp-f20-1
$ mclu console tmp-f20-1
Connected to domain tmp-f20-1
Escape character is ^]
$ mclu viewer tmp-f20-1
(graphical window opens)


Filed under Uncategorized

9 responses to “Mini-cluster (mclu) command line tool

  1. Cute, but this almost feels like an NIH solution.

    Apart from the fun/diy factor, before building a cluster of hosts, I would have probably used vagrant + vagrant-libvirt + some of the vagrant add ons I’ve developed. Cheap plug:

    I like reading about this though 🙂 Keep it up!

    • rich

      The real trick that mclu does, which I don’t think puppet or plain virsh solves, is dealing with nodes which are normally switched off.

      mclu list pings each node in the cluster, before initiating libvirt-over-ssh connections to each one which is up to list its running VMs.

      If there was software which did this (which didn’t require installing daemons / Java / GUIs / etc) then I didn’t find it in quite a lot of searching.

  2. Stijn Hoop

    Doesn’t ansible fit the bill? (Curious, I’m a puppet user by trade, but I like ansible’s concepts)

  3. Pingback: Mini-cluster (mclu) rewritten to use ansible | Richard WM Jones

  4. Pingback: Mini Cloud/Cluster v2.0 | Richard WM Jones

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.