diff --git a/src/.vuepress/public/img/mqtt-table-1.png b/src/.vuepress/public/img/mqtt-table-1.png new file mode 100644 index 000000000..8594b9641 Binary files /dev/null and b/src/.vuepress/public/img/mqtt-table-1.png differ diff --git a/src/.vuepress/public/img/mqtt-table-2.png b/src/.vuepress/public/img/mqtt-table-2.png new file mode 100644 index 000000000..902228f5c Binary files /dev/null and b/src/.vuepress/public/img/mqtt-table-2.png differ diff --git a/src/.vuepress/public/img/mqtt-table-en-1.png b/src/.vuepress/public/img/mqtt-table-en-1.png new file mode 100644 index 000000000..834f2c546 Binary files /dev/null and b/src/.vuepress/public/img/mqtt-table-en-1.png differ diff --git a/src/.vuepress/public/img/mqtt-table-en-2.png b/src/.vuepress/public/img/mqtt-table-en-2.png new file mode 100644 index 000000000..a8203ecf9 Binary files /dev/null and b/src/.vuepress/public/img/mqtt-table-en-2.png differ diff --git a/src/.vuepress/sidebar/V2.0.x/en-Table.ts b/src/.vuepress/sidebar/V2.0.x/en-Table.ts index 8d6c619ca..be7a34431 100644 --- a/src/.vuepress/sidebar/V2.0.x/en-Table.ts +++ b/src/.vuepress/sidebar/V2.0.x/en-Table.ts @@ -134,6 +134,7 @@ export const enSidebar = { { text: 'C++ Native API', link: 'Programming-Cpp-Native-API' }, { text: 'C# Native API', link: 'Programming-CSharp-Native-API' }, { text: 'JDBC', link: 'Programming-JDBC_apache' }, + { text: 'MQTT Protocol', link: 'Programming-MQTT' }, { text: 'RESTAPI V1 ', link: 'RestAPI-V1' }, ], }, diff --git a/src/.vuepress/sidebar/V2.0.x/zh-Table.ts b/src/.vuepress/sidebar/V2.0.x/zh-Table.ts index 852124052..37085a9b0 100644 --- a/src/.vuepress/sidebar/V2.0.x/zh-Table.ts +++ b/src/.vuepress/sidebar/V2.0.x/zh-Table.ts @@ -124,6 +124,7 @@ export const zhSidebar = { { text: 'C++原生接口', link: 'Programming-Cpp-Native-API' }, { text: 'C#原生接口', link: 'Programming-CSharp-Native-API' }, { text: 'JDBC', link: 'Programming-JDBC_apache' }, + { text: 'MQTT协议', link: 'Programming-MQTT' }, { text: 'RESTAPI V1 ', link: 'RestServiceV1' }, ], }, diff --git a/src/.vuepress/sidebar_timecho/V2.0.x/en-Table.ts b/src/.vuepress/sidebar_timecho/V2.0.x/en-Table.ts index ad4412918..5a5063139 100644 --- a/src/.vuepress/sidebar_timecho/V2.0.x/en-Table.ts +++ b/src/.vuepress/sidebar_timecho/V2.0.x/en-Table.ts @@ -139,6 +139,7 @@ export const enSidebar = { { text: 'C++ Native API', link: 'Programming-Cpp-Native-API' }, { text: 'C# Native API', link: 'Programming-CSharp-Native-API' }, { text: 'JDBC', link: 'Programming-JDBC_timecho' }, + { text: 'MQTT Protocol', link: 'Programming-MQTT' }, { text: 'RESTAPI V1 ', link: 'RestAPI-V1' }, ], }, diff --git a/src/.vuepress/sidebar_timecho/V2.0.x/zh-Table.ts b/src/.vuepress/sidebar_timecho/V2.0.x/zh-Table.ts index dfb4f34a5..29b7d0d33 100644 --- a/src/.vuepress/sidebar_timecho/V2.0.x/zh-Table.ts +++ b/src/.vuepress/sidebar_timecho/V2.0.x/zh-Table.ts @@ -128,6 +128,7 @@ export const zhSidebar = { { text: 'C++原生接口', link: 'Programming-Cpp-Native-API' }, { text: 'C#原生接口', link: 'Programming-CSharp-Native-API' }, { text: 'JDBC', link: 'Programming-JDBC_timecho' }, + { text: 'MQTT协议', link: 'Programming-MQTT' }, { text: 'RESTAPI V1 ', link: 'RestServiceV1' }, ], }, diff --git a/src/UserGuide/Master/Table/API/Programming-MQTT.md b/src/UserGuide/Master/Table/API/Programming-MQTT.md new file mode 100644 index 000000000..e20b3cad4 --- /dev/null +++ b/src/UserGuide/Master/Table/API/Programming-MQTT.md @@ -0,0 +1,90 @@ + +# MQTT Protocol + +## 1. Overview + +MQTT (Message Queuing Telemetry Transport) is a lightweight messaging protocol designed for IoT and low-bandwidth environments. It operates on a Publish/Subscribe (Pub/Sub) model, enabling efficient and reliable bidirectional communication between devices. Its core objectives are low power consumption, minimal bandwidth usage, and high real-time performance, making it ideal for unstable networks or resource-constrained scenarios (e.g., sensors, mobile devices). + +IoTDB provides deep integration with the MQTT protocol, fully compliant with MQTT v3.1 (OASIS International Standard). The IoTDB server includes a built-in high-performance MQTT Broker module, eliminating the need for third-party middleware. Devices can directly write time-series data into the IoTDB storage engine via MQTT messages. + +![](/img/mqtt-table-en-1.png) + + +## 2. Configuration + +By default, the IoTDB MQTT service loads configurations from `${IOTDB_HOME}/${IOTDB_CONF}/iotdb-system.properties`. + +| **Property** | **Description** | **Default** | +| ------------------------ | ---------------------------------------------------------------------------------------------------------------------- | ------------------- | +| `enable_mqtt_service` | Enable/ disable the MQTT service. | FALSE | +| `mqtt_host` | Host address bound to the MQTT service. | 127.0.0.1 | +| `mqtt_port` | Port bound to the MQTT service. | 1883 | +| `mqtt_handler_pool_size` | Thread pool size for processing MQTT messages. | 1 | +| **`mqtt_payload_formatter`** | **Formatting method for MQTT message payloads. ​**​**Options: `json` (tree model), `line` (table model).** | **json** | +| `mqtt_max_message_size` | Maximum allowed MQTT message size (bytes). | 1048576 | + +## 3. Write Protocol + +* Line Protocol Syntax + +```JavaScript +[,=[,=]][ =[,=]] =[,=] [] +``` + +* Example + +```JavaScript +myMeasurement,tag1=value1,tag2=value2 attr1=value1,attr2=value2 fieldKey="fieldValue" 1556813561098000000 +``` + +![](/img/mqtt-table-en-2.png) + +## 4. Naming Conventions + +* Database Name + +The first segment of the MQTT topic (split by `/`) is used as the database name. + +```Properties +topic: stock/Legacy +databaseName: stock + + +topic: stock/Legacy/# +databaseName:stock +``` + +* Table Name + +The table name is derived from the `` in the line protocol. + +* Type Identifiers + +| Filed Value | IoTDB Data Type | +|--------------------------------------------------------------------| ----------------- | +| 1
1.12 | DOUBLE | +| 1`f`
1.12`f` | FLOAT | +| 1`i`
123`i` | INT64 | +| 1`u`
123`u` | INT64 | +| 1`i32`
123`i32` | INT32 | +| `"xxx"` | TEXT | +| `t`,`T`,`true`,`True`,`TRUE`
`f`,`F`,`false`,`False`,`FALSE` | BOOLEAN | diff --git a/src/UserGuide/latest-Table/API/Programming-MQTT.md b/src/UserGuide/latest-Table/API/Programming-MQTT.md new file mode 100644 index 000000000..e20b3cad4 --- /dev/null +++ b/src/UserGuide/latest-Table/API/Programming-MQTT.md @@ -0,0 +1,90 @@ + +# MQTT Protocol + +## 1. Overview + +MQTT (Message Queuing Telemetry Transport) is a lightweight messaging protocol designed for IoT and low-bandwidth environments. It operates on a Publish/Subscribe (Pub/Sub) model, enabling efficient and reliable bidirectional communication between devices. Its core objectives are low power consumption, minimal bandwidth usage, and high real-time performance, making it ideal for unstable networks or resource-constrained scenarios (e.g., sensors, mobile devices). + +IoTDB provides deep integration with the MQTT protocol, fully compliant with MQTT v3.1 (OASIS International Standard). The IoTDB server includes a built-in high-performance MQTT Broker module, eliminating the need for third-party middleware. Devices can directly write time-series data into the IoTDB storage engine via MQTT messages. + +![](/img/mqtt-table-en-1.png) + + +## 2. Configuration + +By default, the IoTDB MQTT service loads configurations from `${IOTDB_HOME}/${IOTDB_CONF}/iotdb-system.properties`. + +| **Property** | **Description** | **Default** | +| ------------------------ | ---------------------------------------------------------------------------------------------------------------------- | ------------------- | +| `enable_mqtt_service` | Enable/ disable the MQTT service. | FALSE | +| `mqtt_host` | Host address bound to the MQTT service. | 127.0.0.1 | +| `mqtt_port` | Port bound to the MQTT service. | 1883 | +| `mqtt_handler_pool_size` | Thread pool size for processing MQTT messages. | 1 | +| **`mqtt_payload_formatter`** | **Formatting method for MQTT message payloads. ​**​**Options: `json` (tree model), `line` (table model).** | **json** | +| `mqtt_max_message_size` | Maximum allowed MQTT message size (bytes). | 1048576 | + +## 3. Write Protocol + +* Line Protocol Syntax + +```JavaScript +[,=[,=]][ =[,=]] =[,=] [] +``` + +* Example + +```JavaScript +myMeasurement,tag1=value1,tag2=value2 attr1=value1,attr2=value2 fieldKey="fieldValue" 1556813561098000000 +``` + +![](/img/mqtt-table-en-2.png) + +## 4. Naming Conventions + +* Database Name + +The first segment of the MQTT topic (split by `/`) is used as the database name. + +```Properties +topic: stock/Legacy +databaseName: stock + + +topic: stock/Legacy/# +databaseName:stock +``` + +* Table Name + +The table name is derived from the `` in the line protocol. + +* Type Identifiers + +| Filed Value | IoTDB Data Type | +|--------------------------------------------------------------------| ----------------- | +| 1
1.12 | DOUBLE | +| 1`f`
1.12`f` | FLOAT | +| 1`i`
123`i` | INT64 | +| 1`u`
123`u` | INT64 | +| 1`i32`
123`i32` | INT32 | +| `"xxx"` | TEXT | +| `t`,`T`,`true`,`True`,`TRUE`
`f`,`F`,`false`,`False`,`FALSE` | BOOLEAN | diff --git a/src/zh/UserGuide/Master/Table/API/Programming-MQTT.md b/src/zh/UserGuide/Master/Table/API/Programming-MQTT.md new file mode 100644 index 000000000..1ba71f7f0 --- /dev/null +++ b/src/zh/UserGuide/Master/Table/API/Programming-MQTT.md @@ -0,0 +1,93 @@ + +# MQTT 协议 + +## 1. 概述 + +MQTT 是一种专为物联网(IoT)和低带宽环境设计的轻量级消息传输协议,基于发布/订阅(Pub/Sub)模型,支持设备间高效、可靠的双向通信。其核心目标是低功耗、低带宽消耗和高实时性,尤其适合网络不稳定或资源受限的场景(如传感器、移动设备)。 + +IoTDB 深度集成了 MQTT 协议能力,完整兼容 MQTT v3.1(OASIS 国际标准协议)。IoTDB 服务器内置高性能 MQTT Broker 服务模块,无需第三方中间件,支持设备通过 MQTT 报文将时序数据直接写入 IoTDB 存储引擎。 + +![](/img/mqtt-table-1.png) + +## 2. 配置方式 + +默认情况下,IoTDB MQTT 服务通过`${IOTDB_HOME}/${IOTDB_CONF}/iotdb-system.properties`加载配置。 + +具体配置项如下: + +| **名称** | **描述** | **默认** | +|---------------------------| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------- | +| `enable_mqtt_service` | 是否启用 mqtt 服务 | FALSE | +| `mqtt_host` | mqtt 服务绑定主机 | 127.0.0.1 | +| `mqtt_port` | mqtt 服务绑定端口 | 1883 | +| `mqtt_handler_pool_size` | 处理 mqtt 消息的处理程序池大小 | 1 | +| **`mqtt_payload_formatter`** | **mqtt**​**​ 消息有效负载格式化程序。**​**可选项:**​​**`json`**​**:仅适用于树模型。**​​**`line`**​**:仅适用于表模型。** | **json** | +| `mqtt_max_message_size` | mqtt 消息最大长度(字节) | 1048576 | + +## 3. 写入协议 + +* 行协议语法格式 + +```JavaScript +[,=[,=]][ =[,=]] =[,=] [] +``` + +* 示例 + +```JavaScript +myMeasurement,tag1=value1,tag2=value2 attr1=value1,attr2=value2 fieldKey="fieldValue" 1556813561098000000 +``` + +![](/img/mqtt-table-2.png) + + +## 4. 命名约定 + +* 数据库名称 + +MQTT topic 名称用 `/` 分割后, 第一串内容作为数据库名称。 + +```Properties +topic: stock/Legacy +databaseName: stock + + +topic: stock/Legacy/# +databaseName:stock +``` + +* 表名称 + +表名称使用行协议中的 ``。 + +* 类型标识 + +| Filed 内容 | IoTDB 数据类型 | +|--------------------------------------------------------------| ---------------- | +| 1
1.12 | DOUBLE | +| 1`f`
1.12`f` | FLOAT | +| 1`i`
123`i` | INT64 | +| 1`u`
123`u` | INT64| +| 1`i32`
123`i32` | INT32 | +| `"xxx"` | TEXT | +| `t`,`T`,`true`,`True`,`TRUE`
`f`,`F`,`false`,`False`,`FALSE` | BOOLEAN | + diff --git a/src/zh/UserGuide/latest-Table/API/Programming-MQTT.md b/src/zh/UserGuide/latest-Table/API/Programming-MQTT.md new file mode 100644 index 000000000..1ba71f7f0 --- /dev/null +++ b/src/zh/UserGuide/latest-Table/API/Programming-MQTT.md @@ -0,0 +1,93 @@ + +# MQTT 协议 + +## 1. 概述 + +MQTT 是一种专为物联网(IoT)和低带宽环境设计的轻量级消息传输协议,基于发布/订阅(Pub/Sub)模型,支持设备间高效、可靠的双向通信。其核心目标是低功耗、低带宽消耗和高实时性,尤其适合网络不稳定或资源受限的场景(如传感器、移动设备)。 + +IoTDB 深度集成了 MQTT 协议能力,完整兼容 MQTT v3.1(OASIS 国际标准协议)。IoTDB 服务器内置高性能 MQTT Broker 服务模块,无需第三方中间件,支持设备通过 MQTT 报文将时序数据直接写入 IoTDB 存储引擎。 + +![](/img/mqtt-table-1.png) + +## 2. 配置方式 + +默认情况下,IoTDB MQTT 服务通过`${IOTDB_HOME}/${IOTDB_CONF}/iotdb-system.properties`加载配置。 + +具体配置项如下: + +| **名称** | **描述** | **默认** | +|---------------------------| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------- | +| `enable_mqtt_service` | 是否启用 mqtt 服务 | FALSE | +| `mqtt_host` | mqtt 服务绑定主机 | 127.0.0.1 | +| `mqtt_port` | mqtt 服务绑定端口 | 1883 | +| `mqtt_handler_pool_size` | 处理 mqtt 消息的处理程序池大小 | 1 | +| **`mqtt_payload_formatter`** | **mqtt**​**​ 消息有效负载格式化程序。**​**可选项:**​​**`json`**​**:仅适用于树模型。**​​**`line`**​**:仅适用于表模型。** | **json** | +| `mqtt_max_message_size` | mqtt 消息最大长度(字节) | 1048576 | + +## 3. 写入协议 + +* 行协议语法格式 + +```JavaScript +[,=[,=]][ =[,=]] =[,=] [] +``` + +* 示例 + +```JavaScript +myMeasurement,tag1=value1,tag2=value2 attr1=value1,attr2=value2 fieldKey="fieldValue" 1556813561098000000 +``` + +![](/img/mqtt-table-2.png) + + +## 4. 命名约定 + +* 数据库名称 + +MQTT topic 名称用 `/` 分割后, 第一串内容作为数据库名称。 + +```Properties +topic: stock/Legacy +databaseName: stock + + +topic: stock/Legacy/# +databaseName:stock +``` + +* 表名称 + +表名称使用行协议中的 ``。 + +* 类型标识 + +| Filed 内容 | IoTDB 数据类型 | +|--------------------------------------------------------------| ---------------- | +| 1
1.12 | DOUBLE | +| 1`f`
1.12`f` | FLOAT | +| 1`i`
123`i` | INT64 | +| 1`u`
123`u` | INT64| +| 1`i32`
123`i32` | INT32 | +| `"xxx"` | TEXT | +| `t`,`T`,`true`,`True`,`TRUE`
`f`,`F`,`false`,`False`,`FALSE` | BOOLEAN | +