Building a Beowulf Cluster in Ubuntu 12.04 LTS

To build a Beowulf cluster, we set up a system as Master node and others as slave nodes.

And by others, I mean we need at least two or more systems to build a cluster.

(Remember that we are making one of them as Master node and rest slaves)

Follow the steps given below in Ubuntu terminal

Add the hosts to the node files.

–  To know the hosts, Type ifconfig in terminal n see the ip address (i.e your host address)

Do the same on slave system and note the ip address host file for all the nodes( master and slave ) as

sudo gedit /etc/hosts

127.0.0.1      localhost

192.168.1.6    master

192.168.1.7    node1

192.168.1.8    node2

192.168.1.9    node3

Make  sure it doesn’t look like this:

127.0.0.1      localhost
127.0.1.1      master
192.168.1.7    node1
192.168.1.8    node2
192.168.1.9    node3

Save the host file after editing

Once saved ,you can use the host name to connect to the other nodes

As:

-ping master (type this command on slave node)

Or

-ping node1 (this on master node)

You should get a response similar to this:

PING master (192.168.1.6) 56(84) bytes of data.
64 bytes from master (192.168.1.6): icmp_req=1 ttl=64 time=0.606 ms
64 bytes from master (192.168.1.6): icmp_req=2 ttl=64 time=0.552 ms
64 bytes from master (192.168.1.6): icmp_req=3 ttl=64 time=0.549 ms

Defining a user for running MPI jobs

Enter the below command:

sudo adduser mpiuser --uid 999

You can give any name instead of mpiuser and a user id below 100, but make sure that the name and id is the same on all nodes.

This will create a folder name mpiuser in your home folder.

Now we need to set up Network File System (NFS) in order to access files among master and slave nodes

Enter following command on master node :

master:~$ sudo apt-get install nfs-kernel-server

And in order to make it possible to mount a Network File System on the compute nodes, the nfs-common package needs to be installed on all slave  nodes:

$ sudo apt-get install nfs-common

We will use NFS to share the MPI user’s home directory (i.e. /home/mpiuser) with the compute nodes.

Enter these commands on master node:

master:~$ ls -l /home/ | grep mpiuser
master:~$ sudo chown mpiuser:mpiuser /path/to/shared/dir

To share the directory of master node with all other slave nodes ,we need to edit /etc/ exports file on master node by adding the following line to it:

/home/mpiuser *(rw,sync,no_subtree_check)

After the first install you may need to restart the NFS daemon on master node:

master:~$ sudo service nfs-kernel-server restart

The /home/mpiuser directory should now be shared through NFS. In order to test this, you can run the following command from a compute node:

showmount -e master

Now, Reboot the compute nodes and list the contents of the /home/mpiuser directory on each compute node to check if you have access to the data on the master node.

ls /home/mpiuser

This should lists the files from the /home/mpiuser directory of the master node. If it doesn’t immediately, wait a few seconds and try again. It might take some time for the system to initialize the connection with the master node.

References:

  1. Byobu.info
  2.  Kerry D. Wong. A Simple Beowulf Cluster.
  3. Linux.com. Building a Beowulf Cluster in just 13 steps.
Advertisements

One comment

Leave a Reply

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

WordPress.com Logo

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

Google+ photo

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

Twitter picture

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

Facebook photo

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

Connecting to %s