1

Currently, I am doing some R&D on Thingsboard IOT platform. I am planning to deploy it in cluster mode.

When it is deployed, how two Thingsboard servers communicate with each other?

I got this problem in my mind because a particular device can send a message to one Thingsboard server (A) but actually, the message might need to be transferred to another server (B) since a node in the B server is processing that particular device's messages (As I know Thingsboard nodes uses a device hash to handle messages).

How Kafka stream forward that message accordingly when in a cluster?

I read the official documentation and did some googling. But couldn't find exact answers.

diyath.nelaka
  • 193
  • 14

1 Answers1

0

Thingsboard uses Zookeeper as a service discovery.

Each Thingsboard microservice knows what other services run somewhere in the cluster. All communications perform through message queues (Kafka is a good choice). Each topic has several partitions. Each partition will be assigned to the respective node.

Message for device will be hashed by originator id and always pushed to the constant partition number. There is no direct communication between nodes.

In the case of some nodes crash or simply scaled up/down, Zookeeper will fire the repartition event on each node. And existing partitions will be reassigned according to the line node count. The device service will follow the same logic.

That is all magic. Simple and effective. Hope it helps with the Thingsboard cluster architure.