This advanced tutorial reuqires a Raspberry Pi and a local installation of your collector cluster running on Kubernetes.
Checkout the basic versino at: “IoT Mirroring - Edge VM to Cloud”.
Raspberry Pi to Local Cluster
This section will use Raspberry Pi v3 running Ubuntu 32-bit as the edge device and our local machine for the target cluster.
Let’s start with installing and configuring the target cluster.
Install Target Cluster on Local Machine
Installing the target cluster on Linux or Mac requires Kubernetes. Use the following instructions to set up Kubernetes on your local machine.
RemoteCluster RemoteType Paired Status Last Seen
edge1 mirror-edge - - -
edge2 mirror-edge - - -
Generate Metadata for Edge Clusters
Each edge cluster requires a unique metadata file that gives the edge cluster the information to connect to the upstream cluster and the topic/mirror where the data is synchronized.
Generate a metadata file for each cluster:
Edge 1:
The target edge device is a Virtual Machine emulating an IoT device:
We’ll transfer these files to edge devices in the following sections.
Install Edge Cluster on Raspberry Pi (optional)
We’ll use the same procedure as before to mirror from Raspberry Pi to the same upstream cluster.
The test below was performed on a Raspberry Pi v3 running Ubuntu 32-bit image.
Download metadata file
We’ll use the metadata file edge2.json that we’ve exported above to provision this device.
Using the upstream terminal, let’s scp the edge2.json file to the edge device:
We’ll use the metadata file to start the edge cluster on the Raspberry Pi:
fluvio cluster start --read-only edge2.json
Let’s check the partitions:
fluvio partition list
The edge device should show the following partition::
TOPIC PARTITION LEADER MIRROR REPLICAS RESOLUTION SIZE HW LEO LRS FOLLOWER OFFSETS
edge-topic 05001 Source:upstream:5001 [] Online 0 B 1111110[]
Test 1: Mirror from Raspberry Pi Edge to Upstream
Let’s produce on the Raspberry Pi and consume from the upstream cluster.
Produce to edge cluster
Produce on the pi terminal:
fluvio produce edge-topic
> A
Ok!
> B
Ok!
Consume from upstream
Consume on the upstream terminal:
fluvio consume edge-topic --mirror edge2 -B
A
B
Mirror test is successful.
Test2: Upstream Cluster Offline
Shutdown the upstream cluster and check that the edge cluster can continue receiving records. Then, resume the upstream cluster and ensure the data is synchronized and can consumed on both sides.