Building a NanoPi Cluster - Part 2
Now the hardware for the NanoPi-Datacenter is done, its time for the system setup. I chose Armbian 5.25 stable as base system for the master and the worker nodes since this is based on a Debian 8 (Jessie) with a 4.9.4 Kernel version.
The Debian image is available at armbian
Preparing the SD-Card
All nodes should have the same base image and default configuration, so the following steps are equal to all five SD-Cards execpt of the network configuration.
After inserting the SD-Card, dmesg | tail
displays the most recent system
messages which contains information about the name of the SD-Card device.
In my case the name is /dev/mmcblk0
To be sure that the SD-Card is not mounted I checked the output of df -h
.
The following command writes the image to the SD-Card:
$ dd -if=./Armbian_5.25_Nanopineo_Debian_jessie_dev_4.9.4.img of=/dev/mmcblk0 bs=4M
Once the image is written to the SD-Card, I inserted the Card into one of the NanoPis to boot the System once. This is necessary because Armbian does some initializations like preparing the partions etc. After that, I configured the network connections.
My internal network is 192.168.230.0/24 and the external address for the master comes via dhcp.
The easiest way to perform this task is to mount the Card on the laptop again and do the following steps:
Mount the SD-Card
$ mount /dev/mmcblk0p1 /mnt/sdcard
Edit network settings
$ vim /mnt/sdcard/etc/network/interfaces
Change content to
#for master:
iface eth0 inet static
address 192.168.230.1
netmask 255.255.255.0
network 192.168.230.0
broadcast 192.168.230.255
iface eth1 inet dhcp
# for worker
iface eth0 inet static
address 192.168.230.2 // .3; .4; .5 for the other nodes
netmask 255.255.255.0
gateway 192.168.230.1
Now the base system is ready, bootable and accessible on every cluster node. All futher configurations can now be done after the nodes are up and running!
Node configuration
Using the nodes in a cluster requires a bit more configuration on each node. Things like setting the hostname and adding ssh-keys make it easier to work on the cluster and bridging the network on the master node is required to make the internet available to the worker.
When connecting to an Armbian system for the first time it asks to change the root password, a new user and a hostname. I entered ‘raimund’ as user and
huiwaina
as masters hostnamewahi-0[1-4]
as workers hostname
To be continued…