From 5b01095345c764b82f8706b35269192d315f39ef Mon Sep 17 00:00:00 2001 From: Bo Ding Date: Tue, 22 Mar 2022 15:30:45 +0800 Subject: [PATCH] adjust new docs structure (#10897) * adjust doc structure * adjust doc structure * modify sample code path --- docs-cn/04-connect/_connect_go.mdx | 22 +--------- docs-cn/04-connect/_connect_java.mdx | 26 +---------- docs-cn/04-connect/_connect_rust.mdx | 23 +--------- .../{01-sql-writing.md => 01-sql-writing.mdx} | 20 ++++++--- docs-cn/06-insert-data/02-influxdb-line.mdx | 7 +++ docs-cn/06-insert-data/02-stmt.mdx | 18 -------- docs-cn/06-insert-data/03-opentsdb-telnet.mdx | 7 +++ docs-cn/06-insert-data/03-schemaless.md | 15 ------- docs-cn/06-insert-data/04-opentsdb-json.mdx | 7 +++ docs-cn/06-insert-data/08-other.md | 33 -------------- docs-cn/07-query-data/07-query-data.mdx | 18 ++------ .../02-prometheus.md} | 4 +- .../03-telegraf.md} | 4 +- .../05-collectd.md} | 4 +- .../06-statsd.md} | 6 +-- docs-cn/09-third-party/07-icinga2.md | 18 ++++++++ docs-cn/09-third-party/08-tcollector.md | 12 ++++++ docs-cn/09-third-party/09-emq-broder.md | 7 +++ docs-cn/09-third-party/10-hive-mq-broker.md | 7 +++ .../02-restful-api.mdx} | 43 +++++++++++-------- .../02-restful-api/_category_.yml | 1 + .../03-connector.mdx} | 26 ++++++----- .../_category_.yml | 0 .../_linux_install.mdx | 0 .../_varify_linux.mdx | 0 .../_varify_windows.mdx | 0 .../_windows_install.mdx | 0 .../{02-connector => 03-connector}/cpp.mdx | 0 .../{02-connector => 03-connector}/cshapr.mdx | 0 .../{02-connector => 03-connector}/go.mdx | 0 .../{02-connector => 03-connector}/java.mdx | 0 .../{02-connector => 03-connector}/node.mdx | 0 .../{02-connector => 03-connector}/python.mdx | 0 .../{02-connector => 03-connector}/rust.mdx | 0 .../01-taosAdapter.md | 0 .../02-taosdump.md | 0 .../03-taosBenchmark.md | 0 .../04-taosKeeper.md | 0 .../_category_.yml | 0 .../08-server-config.md} | 0 .../08-server-config/_category_.yml | 1 + .../09-client-config.md} | 0 .../09-client-config/_category_.yml | 1 + docs-cn/14-reference/09-config/_category_.yml | 1 - .../13-schemaless.md} | 0 .../_category_.yml | 0 46 files changed, 139 insertions(+), 192 deletions(-) rename docs-cn/06-insert-data/{01-sql-writing.md => 01-sql-writing.mdx} (89%) create mode 100644 docs-cn/06-insert-data/02-influxdb-line.mdx delete mode 100644 docs-cn/06-insert-data/02-stmt.mdx create mode 100644 docs-cn/06-insert-data/03-opentsdb-telnet.mdx delete mode 100644 docs-cn/06-insert-data/03-schemaless.md create mode 100644 docs-cn/06-insert-data/04-opentsdb-json.mdx delete mode 100644 docs-cn/06-insert-data/08-other.md rename docs-cn/{06-insert-data/04-prometheus.md => 09-third-party/02-prometheus.md} (90%) rename docs-cn/{06-insert-data/05-telegraf.md => 09-third-party/03-telegraf.md} (92%) rename docs-cn/{06-insert-data/06-collectd.md => 09-third-party/05-collectd.md} (88%) rename docs-cn/{06-insert-data/07-statsd.md => 09-third-party/06-statsd.md} (90%) create mode 100644 docs-cn/09-third-party/07-icinga2.md create mode 100644 docs-cn/09-third-party/08-tcollector.md create mode 100644 docs-cn/09-third-party/09-emq-broder.md create mode 100644 docs-cn/09-third-party/10-hive-mq-broker.md rename docs-cn/14-reference/{02-connector/restful.mdx => 02-restful-api/02-restful-api.mdx} (94%) create mode 100644 docs-cn/14-reference/02-restful-api/_category_.yml rename docs-cn/14-reference/{02-connector/02-connector.mdx => 03-connector/03-connector.mdx} (75%) rename docs-cn/14-reference/{02-connector => 03-connector}/_category_.yml (100%) rename docs-cn/14-reference/{02-connector => 03-connector}/_linux_install.mdx (100%) rename docs-cn/14-reference/{02-connector => 03-connector}/_varify_linux.mdx (100%) rename docs-cn/14-reference/{02-connector => 03-connector}/_varify_windows.mdx (100%) rename docs-cn/14-reference/{02-connector => 03-connector}/_windows_install.mdx (100%) rename docs-cn/14-reference/{02-connector => 03-connector}/cpp.mdx (100%) rename docs-cn/14-reference/{02-connector => 03-connector}/cshapr.mdx (100%) rename docs-cn/14-reference/{02-connector => 03-connector}/go.mdx (100%) rename docs-cn/14-reference/{02-connector => 03-connector}/java.mdx (100%) rename docs-cn/14-reference/{02-connector => 03-connector}/node.mdx (100%) rename docs-cn/14-reference/{02-connector => 03-connector}/python.mdx (100%) rename docs-cn/14-reference/{02-connector => 03-connector}/rust.mdx (100%) rename docs-cn/14-reference/{03-components-and-tools => 04-components-and-tools}/01-taosAdapter.md (100%) rename docs-cn/14-reference/{03-components-and-tools => 04-components-and-tools}/02-taosdump.md (100%) rename docs-cn/14-reference/{03-components-and-tools => 04-components-and-tools}/03-taosBenchmark.md (100%) rename docs-cn/14-reference/{03-components-and-tools => 04-components-and-tools}/04-taosKeeper.md (100%) rename docs-cn/14-reference/{03-components-and-tools => 04-components-and-tools}/_category_.yml (100%) rename docs-cn/14-reference/{09-config/01-server.md => 08-server-config/08-server-config.md} (100%) create mode 100644 docs-cn/14-reference/08-server-config/_category_.yml rename docs-cn/14-reference/{09-config/02-client.md => 09-client-config/09-client-config.md} (100%) create mode 100644 docs-cn/14-reference/09-client-config/_category_.yml delete mode 100644 docs-cn/14-reference/09-config/_category_.yml rename docs-cn/14-reference/{09-schemaless/09-schemaless.md => 13-schemaless/13-schemaless.md} (100%) rename docs-cn/14-reference/{09-schemaless => 13-schemaless}/_category_.yml (100%) diff --git a/docs-cn/04-connect/_connect_go.mdx b/docs-cn/04-connect/_connect_go.mdx index cd8e92d944..8146e07d6e 100644 --- a/docs-cn/04-connect/_connect_go.mdx +++ b/docs-cn/04-connect/_connect_go.mdx @@ -1,23 +1,5 @@ ```go -package main - -import ( - "database/sql" - "fmt" - - _ "github.com/taosdata/driver-go/v2/taosRestful" -) - -func main() { - var taosDSN = "root:taosdata@http(localhost:6041)/test" - taos, err := sql.Open("taosRestful", taosDSN) - if err != nil { - fmt.Println("failed to connect TDengine, err:", err) - return - } - fmt.Println("Connected") - defer taos.Close() -} +{{#include docs-examples/go/connect/restexample/main.go}} ``` -[查看完整程序](https://github.com/taosdata/docs.taosdata.com/blob/master/examples/go/connect/restexample/main.go) +[查看完整程序](https://github.com/taosdata/TDengine/blob/develop/docs-examples/go/connect/restexample/main.go) diff --git a/docs-cn/04-connect/_connect_java.mdx b/docs-cn/04-connect/_connect_java.mdx index a62e478d69..7bb1807f03 100644 --- a/docs-cn/04-connect/_connect_java.mdx +++ b/docs-cn/04-connect/_connect_java.mdx @@ -1,29 +1,7 @@ ```java -package com.taos.example; - -import com.taosdata.jdbc.TSDBDriver; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.SQLException; -import java.util.Properties; - -public class RESTConnectExample { - - - public static void main(String[] args) throws SQLException { - String jdbcUrl = "jdbc:TAOS-RS://localhost:6041?user=root&password=taosdata"; - Properties connProps = new Properties(); - connProps.setProperty(TSDBDriver.PROPERTY_KEY_CHARSET, "UTF-8"); - connProps.setProperty(TSDBDriver.PROPERTY_KEY_LOCALE, "en_US.UTF-8"); - connProps.setProperty(TSDBDriver.PROPERTY_KEY_TIME_ZONE, "UTC-8"); - Connection conn = DriverManager.getConnection(jdbcUrl, connProps); - System.out.println("Connected"); - conn.close(); - } -} +{{#include docs-examples/java/src/main/java/com/taos/example/RESTConnectExample.java}} ``` -[查看完整程序](https://github.com/taosdata/docs.taosdata.com/blob/master/examples/java/src/main/java/com/taos/example/RESTConnectExample.java) +[查看完整程序](https://github.com/taosdata/TDengine/blob/develop/docs-examples/java/src/main/java/com/taos/example/RESTConnectExample.java) diff --git a/docs-cn/04-connect/_connect_rust.mdx b/docs-cn/04-connect/_connect_rust.mdx index 0bc9420d78..a2ebf33542 100644 --- a/docs-cn/04-connect/_connect_rust.mdx +++ b/docs-cn/04-connect/_connect_rust.mdx @@ -1,24 +1,5 @@ ```rust -use libtaos::*; - -fn taos_connect() -> Result { - TaosCfgBuilder::default() - .ip("127.0.0.1") - .user("root") - .pass("taosdata") - .db("log") - .port(6030u16) - .build() - .expect("ToasCfg builder error") - .connect() -} - -fn main() { - #[allow(unused_variables)] - let taos = taos_connect().unwrap(); - println!("Connected") -} - +{{#include docs-examples/rust/restexample/examples/connect.rs}} ``` -[查看完整程序](https://github.com/taosdata/docs.taosdata.com/blob/master/examples/rust/restexample/examples/connect.rs) +[查看完整程序](https://github.com/taosdata/TDengine/blob/develop/docs-examples/rust/restexample/examples/connect.rs) diff --git a/docs-cn/06-insert-data/01-sql-writing.md b/docs-cn/06-insert-data/01-sql-writing.mdx similarity index 89% rename from docs-cn/06-insert-data/01-sql-writing.md rename to docs-cn/06-insert-data/01-sql-writing.mdx index 7525c68acb..6e5605c75c 100644 --- a/docs-cn/06-insert-data/01-sql-writing.md +++ b/docs-cn/06-insert-data/01-sql-writing.mdx @@ -1,4 +1,4 @@ -# 普通写入 +# SQL 写入 import Tabs from "@theme/Tabs"; import TabItem from "@theme/TabItem"; @@ -34,17 +34,25 @@ INSERT INTO d1001 VALUES (1538548685000, 10.3, 219, 0.31) (1538548695000, 12.6, ::: -## RESTful +## 示例程序 - - +### 普通 SQL 写入 + + + + - + + -## 本地驱动 +### 动态绑定写入 + +(补充介绍) + +### 示例代码 diff --git a/docs-cn/06-insert-data/02-influxdb-line.mdx b/docs-cn/06-insert-data/02-influxdb-line.mdx new file mode 100644 index 0000000000..9076b5bad4 --- /dev/null +++ b/docs-cn/06-insert-data/02-influxdb-line.mdx @@ -0,0 +1,7 @@ +--- +sidebar_label: InfluxDB Line 协议 +--- + +# InfluxDB Line 协议 + +## 示例代码 diff --git a/docs-cn/06-insert-data/02-stmt.mdx b/docs-cn/06-insert-data/02-stmt.mdx deleted file mode 100644 index faf14f1aab..0000000000 --- a/docs-cn/06-insert-data/02-stmt.mdx +++ /dev/null @@ -1,18 +0,0 @@ -# 动态绑定写入 - -import Tabs from "@theme/Tabs"; -import TabItem from "@theme/TabItem"; - -(补充介绍) - -## 示例代码 - - - - - - - - - - diff --git a/docs-cn/06-insert-data/03-opentsdb-telnet.mdx b/docs-cn/06-insert-data/03-opentsdb-telnet.mdx new file mode 100644 index 0000000000..0bb8b33c8e --- /dev/null +++ b/docs-cn/06-insert-data/03-opentsdb-telnet.mdx @@ -0,0 +1,7 @@ +--- +sidebar_label: OpentsDB Telnet 协议 +--- + +# OpentsDB Telnet 协议 + +## 示例代码 \ No newline at end of file diff --git a/docs-cn/06-insert-data/03-schemaless.md b/docs-cn/06-insert-data/03-schemaless.md deleted file mode 100644 index a3bb554a9c..0000000000 --- a/docs-cn/06-insert-data/03-schemaless.md +++ /dev/null @@ -1,15 +0,0 @@ -# Schemaless 写入 - -## 前言 - -在物联网应用中,常会采集比较多的数据项,用于实现智能控制、业务分析、设备监控等。由于应用逻辑的版本升级,或者设备自身的硬件调整等原因,数据采集项就有可能比较频繁地出现变动。为了在这种情况下方便地完成数据记录工作,TDengine -从 2.2.0.0 版本开始,提供调用 Schemaless 写入方式,可以免于预先创建超级表/子表的步骤,随着数据写入接口能够自动创建与数据对应的存储结构。并且在必要时,Schemaless -将自动增加必要的数据列,保证用户写入的数据可以被正确存储。 - -无模式写入方式建立的超级表及其对应的子表与通过 SQL 直接建立的超级表和子表完全没有区别,你也可以通过,SQL 语句直接向其中写入数据。需要注意的是,通过无模式写入方式建立的表,其表名是基于标签值按照固定的映射规则生成,所以无法明确地进行表意,缺乏可读性。 - -## 无模式写入行协议 - -TDengine 的无模式写入的行协议兼容 InfluxDB 的 行协议(Line Protocol)、OpenTSDB 的 telnet 行协议、OpenTSDB 的 JSON 格式协议。但是使用这三种协议的时候,需要在 API 中指定输入内容使用解析协议的标准。 - -## 示例代码 diff --git a/docs-cn/06-insert-data/04-opentsdb-json.mdx b/docs-cn/06-insert-data/04-opentsdb-json.mdx new file mode 100644 index 0000000000..99c62d56cd --- /dev/null +++ b/docs-cn/06-insert-data/04-opentsdb-json.mdx @@ -0,0 +1,7 @@ +--- +sidebar_label: OpentsDB JSON 格式协议 +--- + +# OpentsDB JSON 格式协议 + +## 示例代码 diff --git a/docs-cn/06-insert-data/08-other.md b/docs-cn/06-insert-data/08-other.md deleted file mode 100644 index d2f31b2e1c..0000000000 --- a/docs-cn/06-insert-data/08-other.md +++ /dev/null @@ -1,33 +0,0 @@ -# 其它写入方式 - -## icinga2 直接写入(通过 taosAdapter) - -- 参考链接 `https://icinga.com/docs/icinga-2/latest/doc/14-features/#opentsdb-writer` 使能 opentsdb-writer -- 使能 taosAdapter 配置项 opentsdb_telnet.enable -- 修改配置文件 /etc/icinga2/features-enabled/opentsdb.conf - -``` -object OpenTsdbWriter "opentsdb" { - host = "host to taosAdapter" - port = 6048 -} -``` - -taosAdapter 相关配置参数请参考 taosadapter --help 命令输出以及相关文档。 - -## TCollector 直接写入(通过 taosAdapter) - -TCollector 是一个在客户侧收集本地收集器并发送数据到 OpenTSDB 的进程,taosAdaapter 可以支持接收 TCollector 的数据并写入到 TDengine 中。 - -使能 taosAdapter 配置项 opentsdb_telnet.enable -修改 TCollector 配置文件,修改 OpenTSDB 宿主机地址为 taosAdapter 被部署的地址,并修改端口号为 taosAdapter 使用的端口(默认 6049)。 - -taosAdapter 相关配置参数请参考 taosadapter --help 命令输出以及相关文档。 - -## EMQ Broker 直接写入 - -MQTT 是流行的物联网数据传输协议,[EMQ](https://github.com/emqx/emqx)是一开源的 MQTT Broker 软件,无需任何代码,只需要在 EMQ Dashboard 里使用“规则”做简单配置,即可将 MQTT 的数据直接写入 TDengine。EMQ X 支持通过 发送到 Web 服务的方式保存数据到 TDEngine,也在企业版上提供原生的 TDEngine 驱动实现直接保存。详细使用方法请参考 [EMQ 官方文档](https://docs.emqx.io/broker/latest/cn/rule/rule-example.html#%E4%BF%9D%E5%AD%98%E6%95%B0%E6%8D%AE%E5%88%B0-tdengine)。 - -## HiveMQ Broker 直接写入 - -[HiveMQ](https://www.hivemq.com/) 是一个提供免费个人版和企业版的 MQTT 代理,主要用于企业和新兴的机器到机器 M2M 通讯和内部传输,满足可伸缩性、易管理和安全特性。HiveMQ 提供了开源的插件开发包。可以通过 HiveMQ extension - TDengine 保存数据到 TDengine。详细使用方法请参考 [HiveMQ extension - TDengine 说明文档](https://github.com/huskar-t/hivemq-tdengine-extension/blob/b62a26ecc164a310104df57691691b237e091c89/README.md)。 diff --git a/docs-cn/07-query-data/07-query-data.mdx b/docs-cn/07-query-data/07-query-data.mdx index 00a7634ab9..f253b13b0d 100644 --- a/docs-cn/07-query-data/07-query-data.mdx +++ b/docs-cn/07-query-data/07-query-data.mdx @@ -103,18 +103,7 @@ Query OK, 5 row(s) in set (0.001521s) ## 示例代码 -### RESTful - - - - - - - - -### 本地驱动 - -#### 同步查询 +### 同步查询 @@ -126,10 +115,9 @@ Query OK, 5 row(s) in set (0.001521s) -#### 异步查询 +### 异步查询 - - + diff --git a/docs-cn/06-insert-data/04-prometheus.md b/docs-cn/09-third-party/02-prometheus.md similarity index 90% rename from docs-cn/06-insert-data/04-prometheus.md rename to docs-cn/09-third-party/02-prometheus.md index 53ca80d163..605fe817fe 100644 --- a/docs-cn/06-insert-data/04-prometheus.md +++ b/docs-cn/09-third-party/02-prometheus.md @@ -1,8 +1,8 @@ --- -sidebar_label: Prometheus 直接写入 +sidebar_label: Prometheus --- -# Prometheus 直接写入(通过 taosAdapter) +# Prometheus 写入 remote_read 和 remote_write 是 Prometheus 数据读写分离的集群方案。 只需要将 remote_read 和 remote_write url 指向 taosAdapter 对应的 url 同时设置 Basic 验证即可使用。 diff --git a/docs-cn/06-insert-data/05-telegraf.md b/docs-cn/09-third-party/03-telegraf.md similarity index 92% rename from docs-cn/06-insert-data/05-telegraf.md rename to docs-cn/09-third-party/03-telegraf.md index 86b610580a..191193b426 100644 --- a/docs-cn/06-insert-data/05-telegraf.md +++ b/docs-cn/09-third-party/03-telegraf.md @@ -1,8 +1,8 @@ --- -sidebar_label: Telegraf 直接写入 +sidebar_label: Telegraf --- -# Telegraf 直接写入(通过 taosAdapter) +# Telegraf 写入 安装 Telegraf 请参考[官方文档](https://portal.influxdata.com/downloads/)。 diff --git a/docs-cn/06-insert-data/06-collectd.md b/docs-cn/09-third-party/05-collectd.md similarity index 88% rename from docs-cn/06-insert-data/06-collectd.md rename to docs-cn/09-third-party/05-collectd.md index c26616eae0..c94dd8cb97 100644 --- a/docs-cn/06-insert-data/06-collectd.md +++ b/docs-cn/09-third-party/05-collectd.md @@ -1,8 +1,8 @@ --- -sidebar_label: collectd 直接写入 +sidebar_label: collectd --- -# collectd 直接写入(通过 taosAdapter) +# collectd 写入 安装 collectd,请参考[官方文档](https://collectd.org/download.shtml)。 diff --git a/docs-cn/06-insert-data/07-statsd.md b/docs-cn/09-third-party/06-statsd.md similarity index 90% rename from docs-cn/06-insert-data/07-statsd.md rename to docs-cn/09-third-party/06-statsd.md index 9f25a76314..b1bf4b06e4 100644 --- a/docs-cn/06-insert-data/07-statsd.md +++ b/docs-cn/09-third-party/06-statsd.md @@ -1,8 +1,8 @@ --- -sidebar_label: StatsD 直接写入 +sidebar_label: StatsD --- -# StatsD 直接写入(通过 taosAdapter) +# StatsD 直接写入 安装 StatsD 请参考[官方文档](https://github.com/statsd/statsd)。 @@ -28,4 +28,4 @@ port: 8125 taosAdapter 相关配置参数请参考 taosadapter --help 命令输出以及相关文档。 -icinga2 可以收集监控和性能数据并写入 OpenTSDB,taosAdapter 可以支持接收 icinga2 的数据并写入到 TDengine 中。 \ No newline at end of file +icinga2 可以收集监控和性能数据并写入 OpenTSDB,taosAdapter 可以支持接收 icinga2 的数据并写入到 TDengine 中。 diff --git a/docs-cn/09-third-party/07-icinga2.md b/docs-cn/09-third-party/07-icinga2.md new file mode 100644 index 0000000000..d83e4fcd30 --- /dev/null +++ b/docs-cn/09-third-party/07-icinga2.md @@ -0,0 +1,18 @@ +--- +sidebar_label: icinga2 +--- + +# icinga2 写入 + +- 参考链接 `https://icinga.com/docs/icinga-2/latest/doc/14-features/#opentsdb-writer` 使能 opentsdb-writer +- 使能 taosAdapter 配置项 opentsdb_telnet.enable +- 修改配置文件 /etc/icinga2/features-enabled/opentsdb.conf + +``` +object OpenTsdbWriter "opentsdb" { + host = "host to taosAdapter" + port = 6048 +} +``` + +taosAdapter 相关配置参数请参考 taosadapter --help 命令输出以及相关文档。 \ No newline at end of file diff --git a/docs-cn/09-third-party/08-tcollector.md b/docs-cn/09-third-party/08-tcollector.md new file mode 100644 index 0000000000..70ae0762ee --- /dev/null +++ b/docs-cn/09-third-party/08-tcollector.md @@ -0,0 +1,12 @@ +--- +sidebar_label: TCollector +--- + +# TCollector 写入 + +TCollector 是一个在客户侧收集本地收集器并发送数据到 OpenTSDB 的进程,taosAdaapter 可以支持接收 TCollector 的数据并写入到 TDengine 中。 + +使能 taosAdapter 配置项 opentsdb_telnet.enable +修改 TCollector 配置文件,修改 OpenTSDB 宿主机地址为 taosAdapter 被部署的地址,并修改端口号为 taosAdapter 使用的端口(默认 6049)。 + +taosAdapter 相关配置参数请参考 taosadapter --help 命令输出以及相关文档。 diff --git a/docs-cn/09-third-party/09-emq-broder.md b/docs-cn/09-third-party/09-emq-broder.md new file mode 100644 index 0000000000..0d2bd4d2f9 --- /dev/null +++ b/docs-cn/09-third-party/09-emq-broder.md @@ -0,0 +1,7 @@ +--- +sidebar_label: EMQ Broker +--- + +# EMQ Broker 写入 + +MQTT 是流行的物联网数据传输协议,[EMQ](https://github.com/emqx/emqx)是一开源的 MQTT Broker 软件,无需任何代码,只需要在 EMQ Dashboard 里使用“规则”做简单配置,即可将 MQTT 的数据直接写入 TDengine。EMQ X 支持通过 发送到 Web 服务的方式保存数据到 TDEngine,也在企业版上提供原生的 TDEngine 驱动实现直接保存。详细使用方法请参考 [EMQ 官方文档](https://docs.emqx.io/broker/latest/cn/rule/rule-example.html#%E4%BF%9D%E5%AD%98%E6%95%B0%E6%8D%AE%E5%88%B0-tdengine)。 diff --git a/docs-cn/09-third-party/10-hive-mq-broker.md b/docs-cn/09-third-party/10-hive-mq-broker.md new file mode 100644 index 0000000000..81657da100 --- /dev/null +++ b/docs-cn/09-third-party/10-hive-mq-broker.md @@ -0,0 +1,7 @@ +--- +sidebar_label: HiveMQ Broker +--- + +# HiveMQ Broker 写入 + +[HiveMQ](https://www.hivemq.com/) 是一个提供免费个人版和企业版的 MQTT 代理,主要用于企业和新兴的机器到机器 M2M 通讯和内部传输,满足可伸缩性、易管理和安全特性。HiveMQ 提供了开源的插件开发包。可以通过 HiveMQ extension - TDengine 保存数据到 TDengine。详细使用方法请参考 [HiveMQ extension - TDengine 说明文档](https://github.com/huskar-t/hivemq-tdengine-extension/blob/b62a26ecc164a310104df57691691b237e091c89/README.md)。 diff --git a/docs-cn/14-reference/02-connector/restful.mdx b/docs-cn/14-reference/02-restful-api/02-restful-api.mdx similarity index 94% rename from docs-cn/14-reference/02-connector/restful.mdx rename to docs-cn/14-reference/02-restful-api/02-restful-api.mdx index 7a99923e69..6173c3215a 100644 --- a/docs-cn/14-reference/02-connector/restful.mdx +++ b/docs-cn/14-reference/02-restful-api/02-restful-api.mdx @@ -1,18 +1,14 @@ ---- -sidebar_position: 7 ---- - -# RESTful Connector +# RESTful API 为支持各种不同类型平台的开发,TDengine 提供符合 REST 设计标准的 API,即 RESTful API。为最大程度降低学习成本,不同于其他数据库 RESTful API 的设计方法,TDengine 直接通过 HTTP POST 请求 BODY 中包含的 SQL 语句来操作数据库,仅需要一个 URL。RESTful 连接器的使用参见[视频教程](https://www.taosdata.com/blog/2020/11/11/1965.html)。 注意:与原生连接器的一个区别是,RESTful 接口是无状态的,因此 `USE db_name` 指令没有效果,所有对表名、超级表名的引用都需要指定数据库名前缀。(从 2.2.0.0 版本开始,支持在 RESTful url 中指定 db_name,这时如果 SQL 语句中没有指定数据库名前缀的话,会使用 url 中指定的这个 db_name。从 2.4.0.0 版本开始,RESTful 默认由 taosAdapter 提供,要求必须在 url 中指定 db_name。) -### 安装 +## 安装 RESTful 接口不依赖于任何 TDengine 的库,因此客户端不需要安装任何 TDengine 的库,只要客户端的开发语言支持 HTTP 协议即可。 -### 验证 +## 验证 在已经安装 TDengine 服务器端的情况下,可以按照如下方式进行验证。 @@ -74,9 +70,9 @@ h1.taosdata.com:6041/rest/sql } ``` -### RESTful 连接器的使用 +## RESTful 连接器的使用 -#### HTTP 请求格式 +### HTTP 请求格式 ``` http://:/rest/sql/[db_name] @@ -120,7 +116,7 @@ curl -u username:password -d '' :/rest/sql/[db_name] 其中,`TOKEN` 为 `{username}:{password}` 经过 Base64 编码之后的字符串,例如 `root:taosdata` 编码后为 `cm9vdDp0YW9zZGF0YQ==` -### HTTP 返回格式 +## HTTP 返回格式 返回值为 JSON 格式,如下: @@ -145,11 +141,20 @@ curl -u username:password -d '' :/rest/sql/[db_name] - data: 具体返回的数据,一行一行的呈现,如果不返回结果集,那么就仅有 [[affected_rows]]。data 中每一行的数据列顺序,与 column_meta 中描述数据列的顺序完全一致。 - rows: 表明总共多少行数据。 -column_meta 中的列类型说明: * 1:BOOL * 2:TINYINT -* 3:SMALLINT * 4:INT * 5:BIGINT * 6:FLOAT * 7:DOUBLE * 8:BINARY * 9:TIMESTAMP -* 10:NCHAR +column_meta 中的列类型说明: + +- 1:BOOL +- 2:TINYINT +- 3:SMALLINT +- 4:INT +- 5:BIGINT +- 6:FLOAT +- 7:DOUBLE +- 8:BINARY +- 9:TIMESTAMP +- 10:NCHAR -### 自定义授权码 +## 自定义授权码 HTTP 请求中需要带有授权码 ``,用于身份识别。授权码通常由管理员提供,可简单的通过发送 `HTTP GET` 请求来获取授权码,操作如下: @@ -181,7 +186,7 @@ curl http://192.168.0.1:6041/rest/login/root/taosdata } ``` -### 使用示例 +## 使用示例 - 在 demo 库里查询表 d1001 的所有记录: @@ -227,9 +232,9 @@ curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d 'create database demo' 19 } ``` -### 其他用法 +## 其他用法 -#### 结果集采用 Unix 时间戳 +### 结果集采用 Unix 时间戳 HTTP 请求 URL 采用 `sqlt` 时,返回结果集的时间戳将采用 Unix 时间戳格式表示,例如 @@ -257,7 +262,7 @@ curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d 'select * from demo.d1001 } ``` -#### 结果集采用 UTC 时间字符串 +### 结果集采用 UTC 时间字符串 HTTP 请求 URL 采用 `sqlutc` 时,返回结果集的时间戳将采用 UTC 时间字符串表示,例如 @@ -285,7 +290,7 @@ HTTP 请求 URL 采用 `sqlutc` 时,返回结果集的时间戳将采用 UTC } ``` -### 重要配置项 +## 重要配置项 下面仅列出一些与 RESTful 接口有关的配置参数,其他系统参数请看配置文件里的说明。(注意:配置修改后,需要重启 taosd 服务才能生效) diff --git a/docs-cn/14-reference/02-restful-api/_category_.yml b/docs-cn/14-reference/02-restful-api/_category_.yml new file mode 100644 index 0000000000..736836846e --- /dev/null +++ b/docs-cn/14-reference/02-restful-api/_category_.yml @@ -0,0 +1 @@ +label: RESTful API diff --git a/docs-cn/14-reference/02-connector/02-connector.mdx b/docs-cn/14-reference/03-connector/03-connector.mdx similarity index 75% rename from docs-cn/14-reference/02-connector/02-connector.mdx rename to docs-cn/14-reference/03-connector/03-connector.mdx index a39d1e53aa..2036a591ff 100644 --- a/docs-cn/14-reference/02-connector/02-connector.mdx +++ b/docs-cn/14-reference/03-connector/03-connector.mdx @@ -4,22 +4,26 @@ TDengine 提供了丰富的应用程序开发接口,其中包括 C/C++、Java ![image-connecotr](/img/connector.png) +## 支持的系统 + 目前 TDengine 的连接器可支持的平台广泛,包括:X64/X86/ARM64/ARM32/MIPS/Alpha 等硬件平台,以及 Linux/Win64/Win32 等开发环境。对照矩阵如下: -| **CPU** | **OS** | **JDBC** | **Python** | **Go** | **Node.js** | **C#** | **Rust** | **RESTful** | -| ------------- | --------- | -------- | ---------- | ------ | ----------- | ------ | -------- | ----------- | -| **X86 64bit** | **Linux** | ● | ● | ● | ● | ● | ● | ● | -| **X86 64bit** | **Win64** | ● | ● | ● | ● | ● | ● | ● | -| **X86 64bit** | **Win32** | ● | ● | ● | ● | ○ | ○ | ● | -| **X86 32bit** | **Win32** | ○ | ○ | ○ | ○ | ○ | ○ | ● | -| **ARM64** | **Linux** | ● | ● | ● | ● | ○ | ○ | ● | -| **ARM32** | **Linux** | ● | ● | ● | ● | ○ | ○ | ● | -| **MIPS龙芯** | **Linux** | ○ | ○ | ○ | ○ | ○ | ○ | ○ | -| **Alpha申威** | **Linux** | ○ | ○ | -- | -- | -- | -- | ○ | -| **X86 海光** | **Linux** | ○ | ○ | ○ | -- | -- | -- | ○ | +| **CPU** | **OS** | **JDBC** | **Python** | **Go** | **Node.js** | **C#** | **Rust** | **RESTful** | +| -------------- | --------- | -------- | ---------- | ------ | ----------- | ------ | -------- | ----------- | +| **X86 64bit** | **Linux** | ● | ● | ● | ● | ● | ● | ● | +| **X86 64bit** | **Win64** | ● | ● | ● | ● | ● | ● | ● | +| **X86 64bit** | **Win32** | ● | ● | ● | ● | ○ | ○ | ● | +| **X86 32bit** | **Win32** | ○ | ○ | ○ | ○ | ○ | ○ | ● | +| **ARM64** | **Linux** | ● | ● | ● | ● | ○ | ○ | ● | +| **ARM32** | **Linux** | ● | ● | ● | ● | ○ | ○ | ● | +| **MIPS 龙芯** | **Linux** | ○ | ○ | ○ | ○ | ○ | ○ | ○ | +| **Alpha 申威** | **Linux** | ○ | ○ | -- | -- | -- | -- | ○ | +| **X86 海光** | **Linux** | ○ | ○ | ○ | -- | -- | -- | ○ | 其中 ● 表示官方测试验证通过,○ 表示非官方测试验证通过,-- 表示未经验证。 +## 特性矩阵 + 连接器对 TDengine 特性的支持对照矩阵如下[1]: | **Feature** | **Java** | **Python** | **Go** | **C#** | **Node.js** | **Rust** | diff --git a/docs-cn/14-reference/02-connector/_category_.yml b/docs-cn/14-reference/03-connector/_category_.yml similarity index 100% rename from docs-cn/14-reference/02-connector/_category_.yml rename to docs-cn/14-reference/03-connector/_category_.yml diff --git a/docs-cn/14-reference/02-connector/_linux_install.mdx b/docs-cn/14-reference/03-connector/_linux_install.mdx similarity index 100% rename from docs-cn/14-reference/02-connector/_linux_install.mdx rename to docs-cn/14-reference/03-connector/_linux_install.mdx diff --git a/docs-cn/14-reference/02-connector/_varify_linux.mdx b/docs-cn/14-reference/03-connector/_varify_linux.mdx similarity index 100% rename from docs-cn/14-reference/02-connector/_varify_linux.mdx rename to docs-cn/14-reference/03-connector/_varify_linux.mdx diff --git a/docs-cn/14-reference/02-connector/_varify_windows.mdx b/docs-cn/14-reference/03-connector/_varify_windows.mdx similarity index 100% rename from docs-cn/14-reference/02-connector/_varify_windows.mdx rename to docs-cn/14-reference/03-connector/_varify_windows.mdx diff --git a/docs-cn/14-reference/02-connector/_windows_install.mdx b/docs-cn/14-reference/03-connector/_windows_install.mdx similarity index 100% rename from docs-cn/14-reference/02-connector/_windows_install.mdx rename to docs-cn/14-reference/03-connector/_windows_install.mdx diff --git a/docs-cn/14-reference/02-connector/cpp.mdx b/docs-cn/14-reference/03-connector/cpp.mdx similarity index 100% rename from docs-cn/14-reference/02-connector/cpp.mdx rename to docs-cn/14-reference/03-connector/cpp.mdx diff --git a/docs-cn/14-reference/02-connector/cshapr.mdx b/docs-cn/14-reference/03-connector/cshapr.mdx similarity index 100% rename from docs-cn/14-reference/02-connector/cshapr.mdx rename to docs-cn/14-reference/03-connector/cshapr.mdx diff --git a/docs-cn/14-reference/02-connector/go.mdx b/docs-cn/14-reference/03-connector/go.mdx similarity index 100% rename from docs-cn/14-reference/02-connector/go.mdx rename to docs-cn/14-reference/03-connector/go.mdx diff --git a/docs-cn/14-reference/02-connector/java.mdx b/docs-cn/14-reference/03-connector/java.mdx similarity index 100% rename from docs-cn/14-reference/02-connector/java.mdx rename to docs-cn/14-reference/03-connector/java.mdx diff --git a/docs-cn/14-reference/02-connector/node.mdx b/docs-cn/14-reference/03-connector/node.mdx similarity index 100% rename from docs-cn/14-reference/02-connector/node.mdx rename to docs-cn/14-reference/03-connector/node.mdx diff --git a/docs-cn/14-reference/02-connector/python.mdx b/docs-cn/14-reference/03-connector/python.mdx similarity index 100% rename from docs-cn/14-reference/02-connector/python.mdx rename to docs-cn/14-reference/03-connector/python.mdx diff --git a/docs-cn/14-reference/02-connector/rust.mdx b/docs-cn/14-reference/03-connector/rust.mdx similarity index 100% rename from docs-cn/14-reference/02-connector/rust.mdx rename to docs-cn/14-reference/03-connector/rust.mdx diff --git a/docs-cn/14-reference/03-components-and-tools/01-taosAdapter.md b/docs-cn/14-reference/04-components-and-tools/01-taosAdapter.md similarity index 100% rename from docs-cn/14-reference/03-components-and-tools/01-taosAdapter.md rename to docs-cn/14-reference/04-components-and-tools/01-taosAdapter.md diff --git a/docs-cn/14-reference/03-components-and-tools/02-taosdump.md b/docs-cn/14-reference/04-components-and-tools/02-taosdump.md similarity index 100% rename from docs-cn/14-reference/03-components-and-tools/02-taosdump.md rename to docs-cn/14-reference/04-components-and-tools/02-taosdump.md diff --git a/docs-cn/14-reference/03-components-and-tools/03-taosBenchmark.md b/docs-cn/14-reference/04-components-and-tools/03-taosBenchmark.md similarity index 100% rename from docs-cn/14-reference/03-components-and-tools/03-taosBenchmark.md rename to docs-cn/14-reference/04-components-and-tools/03-taosBenchmark.md diff --git a/docs-cn/14-reference/03-components-and-tools/04-taosKeeper.md b/docs-cn/14-reference/04-components-and-tools/04-taosKeeper.md similarity index 100% rename from docs-cn/14-reference/03-components-and-tools/04-taosKeeper.md rename to docs-cn/14-reference/04-components-and-tools/04-taosKeeper.md diff --git a/docs-cn/14-reference/03-components-and-tools/_category_.yml b/docs-cn/14-reference/04-components-and-tools/_category_.yml similarity index 100% rename from docs-cn/14-reference/03-components-and-tools/_category_.yml rename to docs-cn/14-reference/04-components-and-tools/_category_.yml diff --git a/docs-cn/14-reference/09-config/01-server.md b/docs-cn/14-reference/08-server-config/08-server-config.md similarity index 100% rename from docs-cn/14-reference/09-config/01-server.md rename to docs-cn/14-reference/08-server-config/08-server-config.md diff --git a/docs-cn/14-reference/08-server-config/_category_.yml b/docs-cn/14-reference/08-server-config/_category_.yml new file mode 100644 index 0000000000..262ef6c5ed --- /dev/null +++ b/docs-cn/14-reference/08-server-config/_category_.yml @@ -0,0 +1 @@ +label: 服务的配置 \ No newline at end of file diff --git a/docs-cn/14-reference/09-config/02-client.md b/docs-cn/14-reference/09-client-config/09-client-config.md similarity index 100% rename from docs-cn/14-reference/09-config/02-client.md rename to docs-cn/14-reference/09-client-config/09-client-config.md diff --git a/docs-cn/14-reference/09-client-config/_category_.yml b/docs-cn/14-reference/09-client-config/_category_.yml new file mode 100644 index 0000000000..ad6e70b96d --- /dev/null +++ b/docs-cn/14-reference/09-client-config/_category_.yml @@ -0,0 +1 @@ +label: 客户端配置 diff --git a/docs-cn/14-reference/09-config/_category_.yml b/docs-cn/14-reference/09-config/_category_.yml deleted file mode 100644 index 9da8734a16..0000000000 --- a/docs-cn/14-reference/09-config/_category_.yml +++ /dev/null @@ -1 +0,0 @@ -label: 配置手册 diff --git a/docs-cn/14-reference/09-schemaless/09-schemaless.md b/docs-cn/14-reference/13-schemaless/13-schemaless.md similarity index 100% rename from docs-cn/14-reference/09-schemaless/09-schemaless.md rename to docs-cn/14-reference/13-schemaless/13-schemaless.md diff --git a/docs-cn/14-reference/09-schemaless/_category_.yml b/docs-cn/14-reference/13-schemaless/_category_.yml similarity index 100% rename from docs-cn/14-reference/09-schemaless/_category_.yml rename to docs-cn/14-reference/13-schemaless/_category_.yml -- GitLab