Deployment

First of all, the hardware:
  • Few Raspberry Pi devices: we used 5 of Raspberry Pi 3b
  • Each Pi requires a micro SD card to run an OS
  • A network switch
  • A router
  • Power source
  • Network cables to connect everything together
The Fridge

The Fridge constructed in INRIA, later used for the deployment of the Flink stack

Preparing the Pi cluster

  1. Install the Operating System on SD cards

Download the latest version of Raspbian Buster Lite and burn the image on SD cards using Etcher .

Etcher Screenshot
  1. Enable SSH

Create an empty file named ssh on the SD card to enable SSH.

$touch /Volumes/boot/ssh
  1. Setup the Pis

Plug the SD cards into Raspberries, SSH into it. Default host name would be raspberrypi.local and default password is raspberry.

$ssh pi@raspberrypi.local

Additionally you can use tools like Angry IP scanner to find out the correct host names of each Pis.

Set the hostname as you prefer by editing in:

$sudo raspi-config

And set the static IP address by editing /etc/dhcpcd.conf file

$interface eth0
$static ip_address= preferred IP
$static routers= router IP
$static domain_name_servers= preferred DNS, or you can set it as 8.8.8.8

Note

You might want to clean up some entries in ~/.ssh/known_hosts file on your machine.

This process should be replicated on each Pis.

Creating Docker Swarm

Now we can move on to creating Docker Swarm on a Cluster.

  1. Install Docker on each node:
$curl -fsSL https://get.docker.com | sh
  1. Create Swarm and join nodes

Initialize the Swarm cluster on one node using its IP. This node will act as a leader

$sudo docker swarm init --advertise-addr 192.168.0.104

The result will print the output, also you can run the following command to see the token for the Swarm.

$docker swarm join-token worker

And copy the result on other nodes to join the Swarm

$docker swarm join --token SWMTKN-1-4y0h8i1aktttxxpuyk8844jk8rd1nt3k9oxdrfujg97z4va39d-0fnsq9ayei2s88xeuim7jdosz 192.168.1.104:2377

Check on the Leader node whether if the swarm is working

$docker node ls

If the swarm initialization was successful, it should look like this. Now we’re ready to deploy Flink.

Docker Swarm CLI

Additionally, you can deploy the visualizer service on a manager node to monitor the cluster on the browser.

docker service create \
 --name=viz \
 --publish=8080:[Your preferred port, 9999 for example]/tcp \
 --constraint=node.role==manager \
 --mount=type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock \
alexellis2/visualizer-arm:latest
Docker Swarm on browser

Next step

Please find the whole repository here. You can run your own Flink job on a Jobmanager node using the web browser or the following command.

$JOBMANAGER_CONTAINER=$(docker ps --filter name=jobmanager --format={{.ID}})
$docker cp path/to/jar "$JOBMANAGER_CONTAINER":/job.jar
$docker exec -t -i "$JOBMANAGER_CONTAINER" flink run /job.jar