Administering virtual machines with MLN

Defining Virtual Clusters

Virtualization is also an effective way of using a cluster of physical machines. A cluster can essentially act as a server farm for virtualization; in fact, the student networks described previously could run on the various nodes in a cluster. The physical cluster can serve as physical hardware for one or more virtual clusters. Listing 6 shows a project file that automatically creates a virtual cluster of 36 nodes.

Listing 6

Creating a Virtual Cluster

01 global {
02    project bioinfo
03    autoenum {   Plugin to auto assign IP address and service host.
04       superclass cluster-node
05       numhosts 36       Number of VMs to create.
06       address auto      Assign IP addresses ...
07       addresses_begin 150       ... starting with this host number ...
08       net 128.39.73.0   ... on this subnet.
09       service_hosts {   Service hosts to use for VMs ...
10          #include /bio/servers.txt      ... in this case, stored in an external file.
11       }
12    }
13    $gateway_ip = 192.168.33.211
14 }
15
16 superclass cluster-node {
17    template ubuntu_mpi.ext3
18    memory 312M
19    free_space 1G        Required free space in the storage filesystem.
20    network eth0 {
21       gateway $gateway_ip       Default gateway setting.
22    }
23 }

This project uses the autoenum plugin (included with MLN) to automatically generate virtual machines with successive IP addresses and service hosts taken from the list specified in the plugin's service_hosts substanza.

Listing 6 creates 36 hosts on the basis of the settings in the cluster-node superclass, and the list of service hosts comes from an external file referenced with the #include directive.

The superclass definition also introduces two more configuration file entries that specify the required amount of free space within the filesystem in which the VM image will be stored (another way of specifying its size) and the default gateway (router) IP for a network interface.

Plugins for Special-Purpose Configuration Options

The preceding example illustrated the use of a plugin designed for a specific configuration task: in this case, assigning sequential IP addresses and service hosts.

The MLN configuration language has an open architecture that simplifies the task of writing plugins. MLN plugins are Perl routines that are invoked within the global stanza of a project file.

Listing 7 shows two more examples of plugins. One (apache) sets various configuration parameters for the Apache web server within a virtual machine. Another (sshkey) installs the specified SSH key file(s) into the designated user account. This technique is very practical because it allows you to build virtual machines that can be automatically accessed from other systems, such as by a monitoring tool like Nagios.

Listing 7

Plugins

01 global {
02    project webserv
03    apache {
04       doc_root /var/www
05       }
06    sshkey {
07       nagios /home/nagios/.ssh/pubkey.outgoing
08    }
09 }
10
11 host web14 {
12    ...
13    apache {
14       max_connections 300
15    }
16 }

The apache plugin will cause MLN to set the Apache document root location and the maximum number of simultaneous connections (once again, the directives in the global stanza and the host stanza are merged).

The sshkey plugin will copy the public key from the local nagios user account to the .ssh/authorized_keys file in the home directory of the user nagios in the virtual machine web14 (creating the file and directory as needed).

Configuring MLN Defaults

Within the main configuration file, /etc/mln/mln.conf, you can set many MLN defaults. The installed version of this file contains extensive comments documenting the available entries. Some of the most useful and important settings are shown in Table 2.

Note that the -P, -T, and -F options to the mln command, which override default directory locations, appear before the desired subcommand (for example, mln -P /mln/projects start ldaptest).

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Linux Integration Services

    Microsoft provides a collection of tools for faster and more efficient Linux virtualization in the Hyper-V environment.

  • Networking with VirtualBox

    Tour the VirtualBox virtualization tool, a free and easy environment for virtual versions of Linux, Unix, and Windows.

  • Virtualization Intro

    Good tools are half the battle – even if you are just managing virtual machines. This month we take a practical look at virtualization, and we show you a new threat to watch for in the virtual future.

  • VMware Monitoring

    Dynamic resource allocation and migration of virtual machines between hosts mean that VMware environments pose new monitoring challenges. A new version of the free OpenNMS network management tool now includes an option for monitoring VMware-based infrastructures.

  • oVirt

    The days when administrators were forced to manage virtual machines at the console are gone. Competitors of VMware and Citrix now offer equally sophisticated GUIs. One promising alternative is Red Hat’s oVirt – a free Java interface for Libvirt.

comments powered by Disqus

Direct Download

Read full article as PDF:

022-030_mln.pdf  (750.70 kB)

News