An experiment in creating clusters and distributing loads with Raspberry Pis

Dynamic Aspects

Before continuing with the cluster setup, it makes sense to take a quick tour through the world of the dynamic DNS. Remote access is difficult with a standard DSL connection because it will always receive a different IP address from a pool of addresses. This is where dynamic DNS comes into play. With dynamic DNS, the cluster04 computer shares its IP address on its own with a suitable network provider. As a result, the computer becomes accessible under a permanent name, even if the IP address changes.

The following directions show an example of how to set up a dynamic DNS entry with Strato DynDNS. Strato offers a DNS entry for EUR 0.49 per month (~$0.60), which can be ordered and configured using instructions provided over the company website. Similar services can be found in your country costing from $0 to $2.00 per month.

Next, you should get everything ready on the Rasp Pi and install the client software:

sudo apt-get install ddclient

When queried during installation, you should select other, not enter anything else, then confirm everything, because it is easier to modify the configuration by hand after installation.

After the changes, the file should look like Listing 2, although the parts in angle brackets should be changed according to your setup. After saving the file, you should make sure everything works using the command shown in Listing 3. The output should definitely include SUCCESS as a result. Now, if the IP address changes, the software will automatically communicate this change to the provider.

Listing 2

ddclient

01 pid=/var/run/ddclient.pid
02 protocol=dyndns2
03 use=web
04 ssl=yes
05 server=dyndns.strato.com/nic/update
06 login=<Login Name>
07 password="<Password>"
08 <mydns.net>

Listing 3

Checking Client Configuration

$ sudo ddclient -daemon=0 -debug -verbose -noquiet
SUCCESS:  updating mmirhome.de: good: IP address set to 94.219.219.231

Setting Up Storage

You should use the space remaining on the SD cards for the cluster experiment. The first step will be to partition each card.

The new partition is needed on all four computers and will later contain the clustered filesystem. You can use a command-line tool like cfdisk or GParted [2], which has a graphical interface. After changing all partition tables for each node of the cluster, you should reboot the computers before continuing.

Using the commands from Listing 4, you can create the filesystems on the new partitions and mount them. You should enter the filesystems in the filesystem table so that they will mount after the next reboot. Execute the command from the last line as root because sudo does not work here.

Listing 4

Mounting Filesystems

$ sudo mkfs.ext4 /dev/mmcblk0p3
$ sudo mkdir /export/
$ sudo mount /dev/mmcblk0p3 /export/
$ sudo mkdir /export/brick
# echo "/dev/mmcblk0p3 /export/ ext4 defaults 0 0"  >> /etc/fstab

By way of preparation, you should install the flex and bison tools and the libssl-dev package from the Raspbian repositories. My tests were unsuccessful when I installed GlusterFS from the distribution packages, so I installed from source (Listing 5). The approach I took also ensures that each computer participating in the experiment has the same executable version of the filesystem.

Listing 5

Installing GlusterFS

01 $ wget http://download.gluster.org/pub/gluster/glusterfs/3.6/3.6.1/glusterfs-3.6.1.tar.gz
02 $ tar -xzvf glusterfs-3.6.1.tar.gz
03 $ cd glusterfs-3.6.1/
04 $ ./configure && make
05 $ sudo make install
06 $ sudo ldconfig
07 $ sudo /etc/init.d/glusterd start

First, you should get a current version of GlusterFS (line 1), unpack the archive (line 2), and then configure and build the software (lines 3 and 4). The commands in lines 5 and 6 then install the software. To start the GlusterFS server, enter the command in line 7.

Buy this article as PDF

Express-Checkout as PDF

Pages: 6

Price $2.95
(incl. VAT)

Buy Raspberry Pi Geek

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

US / Canada

Get it on Google Play

UK / Australia

Related content