2017. március 14., kedd

Building a Raspberry Pi cluster - First Steps

3:58 Posted by Juhász Sándor No comments

Back in February 12th while browsing the net on Docker containers I found articles, YouTube videos from enthusiasts building their own Raspberry Pi clusters and experimenting with servers-side technologies. I decided to build my own cluster as a hobby project. This post is the summary of the past 1-month from the inception to the working blinking stack of Pi boards.

To build a Raspberry Pi cluster, you will need Pi boards, micros SDHC memory cards, a power supply, some networking hardware and a stack-able case. You can buy the whole package at https://www.picocluster.com or you can buy everything separately. To spare some money and to experience the thrill of building the whole tower from scratch, I ordered the parts from various web shops. It took exactly four weeks to select, order and get everything delivered, and my cluster was ready by March 11th.

It sounds easy, but selecting the right hardware may be a bit tricky. Fortunately there is a wealth of information on which hardware works and which does not. The source I used the most were Jeff Geerling's blog posts, YouTube videos and Raspberry Pi Dramble website.

As it turns out from Jeff's benchmarks, selecting the memory cards is maybe the trickiest decision. Don't be fooled by the numbers on the cards, the specifications list read/write speeds for most common use cases, namely recording HD video or taking photos with cameras. There is one or two orders of magnitude difference between the read/write speeds of various cards, especially for small-block I/O: the exact thing a Pi running MySQL does most of the time. Just to illustrate the difference, consider that the best performing card reads 4k blocks at 8 MB/s and writes at 3 MB/s due to the limitations of the platforms, even though the cards are all high-speed SDHC cards.

If you browse pictures online, most Pi clusters are powered through a USB hub. Selecting the right one is not trivial though. The 5.1V Pi-s consume 2.5A at its peak load, so I needed a power supply capable of delivering 51W of power. Many builds use the Anker 60W 6-Port wall charger, so I selected this one with 1 ft Anker USB cables. Many cheap USB cables are designed for data transfer and may not deliver the full 2.5 A to your device.

Even though the Pi 3 comes with on-board WiFi, I chose to connect the nodes with 100 MB/s wired Ethernet using a minimalist TP-Link switch. Regarding the rest of the hardware, I liked the design of the GeauxRobot stack so I ordered that from EBay. You can buy similar cheaper cases from China or if you are really purist, you can always use Mouser M3 20 mm spacers.

Assembling the hardware was very easy, less than 2 hours. All components are very high quality and everything fit together perfectly.

I flashed stock Raspbian Jessie with Pixel for node 1, and Jessie Lite for the rest of the nodes. I was glad to see how well-integrated the default Raspbian distribution and the whole ecosystem is around it . The https://www.raspberrypi.org homepage is very clean and well written, I have download and flashed the images in minutes. The system is ready to be used in seconds after booting it up, with Chrome, LibreOffice, Java 8, Python 2 and 3 and various other software development tools. Even Wolfram Mathematica is included for personal use! If you wish to read ideas on tinkering projects, check out the official MagPi magazine. https://www.raspberrypi.org/magpi/

Booting up the nodes the first day they arrived.

The nodes joined my LAN with DHCP right away. After setting up host names and fixed IPs for the nodes, the cluster was ready to be used. SSH and VNC are disabled by default but they can be easily enabled from the settings menu. But please change your pi password as malicious SSH connections are pretty frequent in the wild - I'm speaking from experience, but this is the topic of another post.

SSH, VNC up and running.
The total build cost was a bit more than 400 USD, see the full shopping list below.

Shopping list





0 megjegyzés:

Megjegyzés küldése