Skip to content

Commit c0b5a54

Browse files
committed
Update contents
1 parent 1d9d282 commit c0b5a54

File tree

4 files changed

+100
-43
lines changed

4 files changed

+100
-43
lines changed
Loading
Loading

en_US/data-integration/data-bridge-tdengine.md

Lines changed: 65 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,13 @@ This section describes the preparations you must complete before you start creat
4848
- Knowledge about EMQX data integration [rules](./rules.md)
4949
- Knowledge about [data integration](./data-bridges.md)
5050

51-
### Install TDengine
51+
### Start TDengine and Create a Database
5252

53-
Install TDengine via Docker, and then run the docker image.
53+
You can use the following two methods to start the TDengine or connect to a TDengine service and create a database.
54+
55+
:::: tabs
56+
57+
::: tab Docker
5458

5559
```bash
5660
# To start the TDengine docker image
@@ -68,9 +72,29 @@ CREATE DATABASE mqtt;
6872
use mqtt;
6973
```
7074

75+
:::
76+
77+
::: tab TDengine Cloud
78+
79+
If you are using [TDengine Cloud](https://cloud.tdengine.com/), simply login to the console, select your Instance, and click **Explorer** on the left to enter the SQL execution page. Then, execute the following statement to create a database:
80+
81+
```bash
82+
# Create and select database
83+
84+
CREATE DATABASE mqtt;
85+
86+
use mqtt;
87+
```
88+
89+
![create database](./assets/tdengine_cloud_create_db.jpg)
90+
91+
:::
92+
93+
::::
94+
7195
### Create Data Tables in TDengine
7296

73-
Before you create data bridges for TDengine, you need to create two data tables in TDengine database for message storage and status recording.
97+
You need to create two data tables in TDengine database for message storage and status recording.
7498

7599
1. Use the following SQL statements to create data table `t_mqtt_msg` in TDengine database. The data table stores the client ID, topic, payload, and creation time of every message.
76100

@@ -99,22 +123,54 @@ Before you create data bridges for TDengine, you need to create two data tables
99123

100124
This section demonstrates how to create a Connector to connect the Sink to the TDengine server.
101125

102-
The following steps assume that you run both EMQX and TDengine on the local machine. If you have TDengine and EMQX running remotely, adjust the settings accordingly.
103-
104126
1. Enter the EMQX Dashboard and click **Integration** -> **Connectors**.
127+
105128
2. Click **Create** in the top right corner of the page.
129+
106130
3. On the **Create Connector** page, select **TDengine** and then click **Next**.
107-
4. In the **Configuration** step, configure the following information:
131+
132+
4. In the **Configuration** step, configure the following information based on what you connect to:
133+
134+
::: tabs
135+
136+
::: tab Connect to TDengine
137+
138+
The following configuration assume that you run both EMQX and TDengine on the local machine. If you have TDengine and EMQX running remotely, adjust the settings accordingly.
139+
108140
- **Connector name**: Enter a name for the connector, which should be a combination of upper and lower case letters and numbers, for example: `my_tdengine`.
109141
- **Server Host**: Enter `http://127.0.0.1:6041`, or the actual URL if the TDengine server is running remotely.
110142
- **Database Name**: Enter `mqtt`.
111143
- **Username**: Enter `root`.
112144
- **Password**: Enter `taosdata`.
113-
- **Token**: If you are connecting to TDengine Cloud, you must provide a valid authentication token.
114-
- When specified, this token will take precedence over the **Username** and **Password** authentication method.
115-
- If left empty, the connector will attempt to authenticate using the **Username** and **Password** credentials.
145+
- **Token**: Left empty. The connector will attempt to authenticate using the **Username** and **Password** credentials.
146+
147+
:::
148+
149+
::: tab Connect to TDengine Cloud
150+
151+
1. Select the correct **Instance** on the TDengine Cloud console page.
152+
153+
2. Navigate to **Programming** on the left, then select the **REST API** connection method. As shown in the image below, you will obtain the corresponding connection URL and Token:
154+
155+
![url and token](./assets/tdengine_cloud_url_and_token.png)
156+
157+
3. Enter the following connector configuration information:
158+
159+
- **Connector name**: Enter a name for the connector, which should be a combination of upper and lower case letters and numbers, for example: `my_tdengine`.
160+
- **Server Host**: Enter the value of `TDENGINE_CLOUD_URL` provided by the TDengine Cloud. In this demonstration, it is `https://gw.***.cloud.tdengine.com`.
161+
- **Database Name**: Enter `mqtt`.
162+
- **Username**: Left empty
163+
- **Password**: Left empty
164+
- **Token**: Enter the value of `TDENGINE_CLOUD_TOKEN` provided by the TDengine Cloud. In this demonstration, it is `a2ba69cc6****f0c18cd`.
165+
166+
:::
167+
168+
::::
169+
116170
5. Advanced settings (optional): For details, see [Features of Sink](./data-bridges.md#features-of-sink).
171+
117172
6. Before clicking **Create**, you can click **Test Connectivity** to test if the connector can connect to the TDengine server.
173+
118174
7. Click the **Create** button at the bottom to complete the creation of the connector. In the pop-up dialog, you can click **Back to Connector List** or click **Create Rule** to continue creating rules with Sinks to specify the data to be forwarded to TDengine and to record client events. For detailed steps, see [Create a Rule with TDengine Sink for Message Storage](#create-a-rule-with-tdengine-sink-for-message-storage) and [Create a Rule with TDengine Sink for Events Recording](#create-a-rule-with-tdengine-sink-for-events-recording).
119175

120176
## Create a Rule with TDengine Sink for Message Storage

zh_CN/data-integration/data-bridge-tdengine.md

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ TDengine 数据集成为您的业务带来了以下功能和优势:
4848
- 了解[规则](./rules.md)
4949
- 了解[数据集成](./data-bridges.md)
5050

51-
### 安装 TDengine
51+
### 启动 TDengine 并创建数据库
5252

53-
我们可以通过以下两种方式来启动或连接到一个 TDengine 服务
53+
您可以通过以下两种方式来启动 TDengine 或连接到一个 TDengine 服务,并创建数据库
5454

5555
:::: tabs
5656

@@ -77,11 +77,7 @@ use mqtt;
7777

7878
::: tab TDengine Cloud
7979

80-
如果您使用的为 [TDengine Cloud](https://cloud.tdengine.com/) 则只需要登录到控制台后选中您所使用的 Instance,点击左侧 Explorer 进入到 SQL 执行页面:
81-
82-
![create database](./assets/tdengine_cloud_create_db.jpg)
83-
84-
执行以下语句创建数据库:
80+
如果您使用的是 [TDengine Cloud](https://cloud.tdengine.com/), 则只需要登录到控制台后选中您所使用的 Instance,点击左侧 Explorer 进入到 SQL 执行页面。执行以下语句创建数据库:
8581

8682
```bash
8783
# 创建并选择数据库
@@ -91,11 +87,13 @@ CREATE DATABASE mqtt;
9187
use mqtt;
9288
```
9389

90+
![create database](./assets/tdengine_cloud_create_db.jpg)
91+
9492
:::
9593

9694
::::
9795

98-
然后在 TDengine 中创建两张表:
96+
### TDengine 中创建数据表
9997

10098
数据表 `t_mqtt_msg`,用于存储每条消息的发布者客户端 ID、主题、Payload 以及发布时间:
10199

@@ -125,49 +123,52 @@ CREATE TABLE emqx_client_events (
125123
在创建 TDengine Sink 之前,您需要创建一个 TDengine 连接器,以便 EMQX 与 TDengine 服务建立连接。
126124

127125

128-
1. 转到 Dashboard **集成** -> **连接器** 页面。点击页面右上角的**创建**
126+
1. 转到 Dashboard**集成** -> **连接器**页面。点击页面右上角的**创建**
127+
129128
2. 在连接器类型中选择 **TDengine**,点击**下一步**,进入到连接器配置页面。
130-
3. 对于连接到 TDengine 和 TDengine Cloud 的配置分别为:
131129

132-
:::: tabs
130+
3. 根据您连接到 TDengine 或 TDengine Cloud 填写连接器配置信息:
133131

134-
::: tab 连接到 TDengine
132+
:::: tabs
135133

136-
以下示例假定您在本地机器上同时运行 EMQX 和 TDengine。如果您在远程运行 TDengine 和 EMQX,请相应地调整设置。
134+
::: tab 连接到 TDengine
137135

138-
**配置** 步骤,配置以下信息:
136+
以下配置示例假定您在本地机器上同时运行 EMQX 和 TDengine。如果您在远程运行 TDengine 和 EMQX,请相应地调整设置。
139137

140-
- **连接器名称**:应为大写和小写字母及数字的组合,例如:`my_tdenginedb`
141-
- **主机列表**:填写 `127.0.0.1:6041`
142-
- **数据库**:填写 `mqtt`
143-
- **用户名**:填写 `root`
144-
- **密码**:填写 `taosdata`
145-
- **Token**:保持为空,连接器将尝试使用**用户名****密码**进行身份验证。
146-
:::
138+
- **连接器名称**:应为大写和小写字母及数字的组合,例如:`my_tdenginedb`
139+
- **主机列表**:填写 `127.0.0.1:6041`
140+
- **数据库**:填写 `mqtt`
141+
- **用户名**:填写 `root`
142+
- **密码**:填写 `taosdata`
143+
- **Token**:保持为空,连接器将尝试使用**用户名****密码**进行身份验证。
144+
:::
147145

148-
::: tab 连接到 TDengine Cloud
146+
::: tab 连接到 TDengine Cloud
149147

150-
首先,我们需要通过 TDengine Cloud 的控制台页面拿到连接地址和 Token。确保选中正确的 Instance,然后进入到左侧的 Programming 选项页,选中最末尾的 **REST API** 连接方式,如下图所示,可得到对应的连接地址和 Token:
148+
1. 在 TDengine Cloud 的控制台页面中选中正确的 Instance。
151149

152-
![url and token](./assets/tdengine_cloud_url_and_token.png)
150+
2. 进入左侧的 Programming 选项页,选中 **REST API** 连接方式,如下图所示,可得到对应的连接地址和 Token:
153151

154-
- **连接器名称**:应为大写和小写字母及数字的组合,例如:`my_tdenginedb`
155-
- **主机列表**:填写 TDengine Cloud 给出的 `TDENGINE_CLOUD_URL` 的值。即:`https://gw.***.cloud.tdengine.com`
156-
- **数据库**:填写 `mqtt`
157-
- **用户名**:保持为空。
158-
- **密码**:保持为空。
159-
- **Token**:填写 TDengine Cloud 给出的 `TDENGINE_CLOUD_TOKEN` 的值。即:`a2ba69cc6****f0c18cd`
160-
:::
152+
![url and token](./assets/tdengine_cloud_url_and_token.png)
161153

162-
::::
154+
3. 填写以下连接器配置信息:
155+
156+
- **连接器名称**:应为大写和小写字母及数字的组合,例如:`my_tdenginedb`
157+
- **主机列表**:填写 TDengine Cloud 给出的 `TDENGINE_CLOUD_URL` 的值。即:`https://gw.***.cloud.tdengine.com`
158+
- **数据库**:填写 `mqtt`
159+
- **用户名**:保持为空。
160+
- **密码**:保持为空。
161+
- **Token**:填写 TDengine Cloud 给出的 `TDENGINE_CLOUD_TOKEN` 的值。即:`a2ba69cc6****f0c18cd`
162+
163+
:::
164+
165+
::::
163166

164167
4. 高级配置(可选):详细请参考 [Sink 的特性](./data-bridges.md#sink-的特性)
165168
5. 在点击**创建**之前,您可以点击**测试连接**来测试连接器是否能连接到 TDengine 服务器。
166169
6. 点击**创建**按钮完成连接器创建。
167170
7. 在弹出的**创建成功**对话框中您可以点击**创建规则**,继续创建规则以指定需要写入 TDEngine 的数据和需要记录的客户端事件。您也可以按照[创建消息存储 Sink 规则](#创建消息存储-sink-规则)[创建事件记录 Sink 规则](#创建事件记录-sink-规则)章节的步骤来创建规则。
168171

169-
170-
171172
## 创建消息存储 Sink 规则
172173

173174
本节演示了如何在 Dashboard 中创建一条规则,用于处理来自源 MQTT 主题 `t/#` 的消息,并通过配置的 Sink 将处理后的结果写入到 TDengine 的数据表 `t_mqtt_msg` 中。

0 commit comments

Comments
 (0)