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 (ham0.home.annexia.org) down ham1 (ham1.home.annexia.org) down ham2 (ham2.home.annexia.org) down ham3 (ham3.home.annexia.org) down $ mclu wake --all $ mclu status ham0 (ham0.home.annexia.org) up ssh: OK libvirt: OK ham1 (ham1.home.annexia.org) up ssh: OK libvirt: OK ham2 (ham2.home.annexia.org) up ssh: OK libvirt: OK ham3 (ham3.home.annexia.org) 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)
9 responses to “Mini-cluster (mclu) command line tool”
Nice job, just started something similar
Yeah a “top”-like tool (multi virt-top?) was on my list too.
That would be great!
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: https://ttboj.wordpress.com/2013/12/21/vagrant-vsftp-and-other-tricks/
I like reading about this though 🙂 Keep it up!
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 listpings 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.
Doesn’t ansible fit the bill? (Curious, I’m a puppet user by trade, but I like ansible’s concepts)
Yes, ansible could probably do it (how does it handle offline hosts though?) Coincidentally I was reading a good introduction to ansible here:
Pingback: Mini-cluster (mclu) rewritten to use ansible | Richard WM Jones
Pingback: Mini Cloud/Cluster v2.0 | Richard WM Jones