HiveMQ
HiveMQ
1. Introduction
HiveMQ is a high-performance MQTT message broker designed for the Internet of Things (IoT), supporting the MQTT 3.1.1 and 5.0 protocols. It can handle massive concurrent device connections and provide millisecond-level low-latency communication. Its core features include TLS-encrypted secure transmission, clustered high-availability deployment, and seamless integration with Kafka and databases. It is well suited for scenarios that require reliable real-time communication, such as the Internet of Vehicles (IoV) and Industry 4.0. The Community Edition is free, while the Enterprise Edition supports hundreds of millions of devices.
The hivemq-iotdb-extension plugin provided by IoTDB enables real-time writing of message data (including timestamps, topics, and content) published to HiveMQ into the IoTDB database. It supports automatic creation of IoTDB databases and table schemas, asynchronous batch writing, customizable field mapping, exception handling, and logging.
2. Usage Steps
2.1 Environment Requirements
| Software | Version Requirement | Installation |
|---|---|---|
| IoTDB | >= 2.0.5.1 | Quick Start |
| HiveMQ | > 4.4 | Official Documentation |
Note: The JDK version must be compatible with the HiveMQ version.
2.2 Configuration Procedure
Contact Timecho Team to obtain the
hivemq-iotdb-extensioninstallation package, and extract it to theextensionsdirectory of HiveMQ.Modify the configuration file
/HiveMQ_HOME/extensions/hive-iotdb-extension/conf.properties
# IoTDB Connection Configuration
iotdb.urls=127.0.0.1:6667
iotdb.username=root
iotdb.password=root
iotdb.sessionPool.maxSize=50
# Data Structure Configuration
iotdb.database=hivemq
iotdb.table=hive_mqtt
iotdb.tagName=topic_name # Column name for storing MQTT topics
iotdb.fieldName=payload # Column name for storing message content
iotdb.fieldType=string # Data type
# Batch Processing Configuration
default.batch.queue.size=1000
default.flush.interval.ms=500
# MQTT Authentication
mqtt.username=admin
mqtt.password=hivemq- Start HiveMQ
# Windows
.\bin\run.bat
# Linux/macOS
./bin/run.sh- Publish message data to HiveMQ.
2.3 Verification Test
Query data through the IoTDB CLI to verify that the data has been written successfully.
IoTDB> use hivemq
Msg: The statement is executed successfully.
IoTDB:hivemq> show tables
+---------+-------+
|TableName|TTL(ms)|
+---------+-------+
|hive_mqtt| INF|
+---------+-------+
Total line number = 1
It costs 0.006s
IoTDB:hivemq> desc hive_mqtt
+----------+---------+--------+
|ColumnName| DataType|Category|
+----------+---------+--------+
| time|TIMESTAMP| TIME|
|topic_name| STRING| TAG|
| payload| DOUBLE| FIELD|
+----------+---------+--------+
Total line number = 3
It costs 0.005s
IoTDB:hivemq> select * from hive_mqtt
+-----------------------------+-----------+-------+
| time| topic_name|payload|
+-----------------------------+-----------+-------+
|2025-08-14T11:48:35.889+08:00|temperature| 28.5|
|2025-08-14T11:48:45.972+08:00| humidity| 56.0|
+-----------------------------+-----------+-------+
Total line number = 2
It costs 0.040s