Merge pull request #24121 from taosdata/fix/liaohj
other: merge main into 3.0
|
@ -45,7 +45,7 @@ TDengine 目前可以在 Linux、 Windows、macOS 等平台上安装和运行。
|
|||
|
||||
TDengine 还提供一组辅助工具软件 taosTools,目前它包含 taosBenchmark(曾命名为 taosdemo)和 taosdump 两个软件。默认 TDengine 编译不包含 taosTools, 您可以在编译 TDengine 时使用`cmake .. -DBUILD_TOOLS=true` 来同时编译 taosTools。
|
||||
|
||||
为了构建TDengine, 请使用 [CMake](https://cmake.org/) 3.0.2 或者更高版本。
|
||||
为了构建TDengine, 请使用 [CMake](https://cmake.org/) 3.13.0 或者更高版本。
|
||||
|
||||
## 安装工具
|
||||
|
||||
|
@ -124,7 +124,7 @@ brew install argp-standalone gflags pkgconfig
|
|||
|
||||
TDengine 包含数个使用 Go 语言开发的组件,比如taosAdapter, 请参考 golang.org 官方文档设置 go 开发环境。
|
||||
|
||||
请使用 1.14 及以上版本。对于中国用户,我们建议使用代理来加速软件包下载。
|
||||
请使用 1.20 及以上版本。对于中国用户,我们建议使用代理来加速软件包下载。
|
||||
|
||||
```
|
||||
go env -w GO111MODULE=on
|
||||
|
|
|
@ -53,7 +53,7 @@ You can choose to install through source code, [container](https://docs.tdengine
|
|||
|
||||
TDengine provide a few useful tools such as taosBenchmark (was named taosdemo) and taosdump. They were part of TDengine. By default, TDengine compiling does not include taosTools. You can use `cmake .. -DBUILD_TOOLS=true` to make them be compiled with TDengine.
|
||||
|
||||
To build TDengine, use [CMake](https://cmake.org/) 3.0.2 or higher versions in the project directory.
|
||||
To build TDengine, use [CMake](https://cmake.org/) 3.13.0 or higher versions in the project directory.
|
||||
|
||||
## Install build tools
|
||||
|
||||
|
@ -131,7 +131,7 @@ brew install argp-standalone gflags pkgconfig
|
|||
|
||||
TDengine includes a few components like taosAdapter developed by Go language. Please refer to golang.org official documentation for golang environment setup.
|
||||
|
||||
Please use version 1.14+. For the user in China, we recommend using a proxy to accelerate package downloading.
|
||||
Please use version 1.20+. For the user in China, we recommend using a proxy to accelerate package downloading.
|
||||
|
||||
```
|
||||
go env -w GO111MODULE=on
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
cmake_minimum_required(VERSION 3.0)
|
||||
set(CMAKE_VERBOSE_MAKEFILE TRUE)
|
||||
set(CMAKE_VERBOSE_MAKEFILE FALSE)
|
||||
set(TD_BUILD_TAOSA_INTERNAL FALSE)
|
||||
|
||||
#set output directory
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# taosadapter
|
||||
ExternalProject_Add(taosadapter
|
||||
GIT_REPOSITORY https://github.com/taosdata/taosadapter.git
|
||||
GIT_TAG 3.0
|
||||
GIT_TAG main
|
||||
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosadapter"
|
||||
BINARY_DIR ""
|
||||
#BUILD_IN_SOURCE TRUE
|
||||
|
|
|
@ -19,7 +19,9 @@ TDengine uses ubiquitous SQL as its query language, which greatly reduces learni
|
|||
|
||||
If you are a system administrator who cares about installation, upgrade, fault tolerance, disaster recovery, data import, data export, system configuration, how to monitor whether TDengine is running healthily, and how to improve system performance, please refer to, and thoroughly read the [Administration](./operation) section.
|
||||
|
||||
If you want to know more about TDengine tools, the REST API, and connectors for various programming languages, please see the [Reference](./reference) chapter.
|
||||
If you want to know more about TDengine tools and the REST API, please see the [Reference](./reference) chapter.
|
||||
|
||||
For information about connecting to TDengine with different programming languages, see [Client Libraries](./client-libraries/).
|
||||
|
||||
If you are very interested in the internal design of TDengine, please read the chapter [Inside TDengine](./tdinternal), which introduces the cluster design, data partitioning, sharding, writing, and reading processes in detail. If you want to study TDengine code or even contribute code, please read this chapter carefully.
|
||||
|
||||
|
|
|
@ -37,27 +37,26 @@ The major features are listed below:
|
|||
- Provides an interactive [Command Line Interface (CLI)](../reference/taos-shell) for management, maintenance and ad-hoc queries.
|
||||
- Provides a tool [taosBenchmark](../reference/taosbenchmark/) for testing the performance of TDengine.
|
||||
10. Programming
|
||||
- Provides [connectors](../reference/connector/) for [C/C++](../reference/connector/cpp), [Java](../reference/connector/java), [Python](../reference/connector/python), [Go](../reference/connector/go), [Rust](../reference/connector/rust), [Node.js](../reference/connector/node) and other programming languages.
|
||||
- Provides [client libraries](../client-libraries/) for [C/C++](../client-libraries/cpp), [Java](../client-libraries/java), [Python](../client-libraries/python), [Go](../client-libraries/go), [Rust](../client-libraries/rust), [Node.js](../client-libraries/node) and other programming languages.
|
||||
- Provides a [REST API](../reference/rest-api/).
|
||||
|
||||
For more details on features, please read through the entire documentation.
|
||||
|
||||
## Competitive Advantages
|
||||
|
||||
By making full use of [characteristics of time series data](https://tdengine.com/tsdb/characteristics-of-time-series-data/), TDengine differentiates itself from other [time series databases](https://tdengine.com/tsdb/), with the following advantages.
|
||||
By making full use of [characteristics of time series data](https://tdengine.com/characteristics-of-time-series-data/), TDengine differentiates itself from other time series databases with the following advantages.
|
||||
|
||||
- **[High-Performance](https://tdengine.com/tdengine/high-performance-time-series-database/)**: TDengine is the only time-series database to solve the high cardinality issue to support billions of data collection points while out performing other time-series databases for data ingestion, querying and data compression.
|
||||
- **[High-Performance](https://tdengine.com/high-performance/)**: TDengine is the only time-series database to solve the high cardinality issue to support billions of data collection points while out performing other time-series databases for data ingestion, querying and data compression.
|
||||
|
||||
- **[Simplified Solution](https://tdengine.com/tdengine/simplified-time-series-data-solution/)**: Through built-in caching, stream processing and data subscription features, TDengine provides a simplified solution for time-series data processing. It reduces system design complexity and operation costs significantly.
|
||||
- **[Simplified Solution](https://tdengine.com/comprehensive-industrial-data-solution/)**: Through built-in caching, stream processing and data subscription features, TDengine provides a simplified solution for time-series data processing. It reduces system design complexity and operation costs significantly.
|
||||
|
||||
- **[Cloud Native](https://tdengine.com/tdengine/cloud-native-time-series-database/)**: Through native distributed design, sharding and partitioning, separation of compute and storage, RAFT, support for Kubernetes deployment and full observability, TDengine is a cloud native Time-series Database and can be deployed on public, private or hybrid clouds.
|
||||
- **[Cloud Native](https://tdengine.com/cloud-native/)**: Through native distributed design, sharding and partitioning, separation of compute and storage, RAFT, support for Kubernetes deployment and full observability, TDengine is a cloud native Time-series Database and can be deployed on public, private or hybrid clouds.
|
||||
|
||||
- **[Ease of Use](https://tdengine.com/tdengine/easy-time-series-data-platform/)**: For administrators, TDengine significantly reduces the effort to[
|
||||
](https://tdengine.com/tdengine/easy-time-series-data-platform/) deploy and maintain. For developers, it provides a simple interface, simplified solution and seamless integrations for third party tools. For data users, it gives easy data access.
|
||||
- **[Ease of Use](https://tdengine.com/easy-to-use/)**: For administrators, TDengine significantly reduces the effort to deploy and maintain. For developers, it provides a simple interface, simplified solution and seamless integrations for third party tools. For data users, it gives easy data access.
|
||||
|
||||
- **[Easy Data Analytics](https://tdengine.com/tdengine/time-series-data-analytics-made-easy/)**: Through super tables, storage and compute separation, data partitioning by time interval, pre-computation and other means, TDengine makes it easy to explore, format, and get access to data in a highly efficient way.
|
||||
- **[Easy Data Analytics](https://tdengine.com/simplifying-time-series-analysis-for-data-scientists/)**: Through super tables, storage and compute separation, data partitioning by time interval, pre-computation and other means, TDengine makes it easy to explore, format, and get access to data in a highly efficient way.
|
||||
|
||||
- **[Open Source](https://tdengine.com/tdengine/open-source-time-series-database/)**: TDengine's core modules, including cluster feature, are all available under open source licenses. It has gathered over 19k stars on GitHub. There is an active developer community, and over 140k running instances worldwide.
|
||||
- **[Open Source](https://tdengine.com/open-source/)**: TDengine's core modules, including cluster feature, are all available under open source licenses. It has gathered over 22k stars on GitHub. There is an active developer community, and over 400k running instances worldwide.
|
||||
|
||||
With TDengine, the total cost of ownership of your time-series data platform can be greatly reduced.
|
||||
|
||||
|
@ -125,16 +124,9 @@ As a high-performance, scalable and SQL supported time-series database, TDengine
|
|||
|
||||
- [TDengine vs. InfluxDB](https://tdengine.com/tsdb-comparison-influxdb-vs-tdengine/)
|
||||
- [TDengine vs. TimescaleDB](https://tdengine.com/tsdb-comparison-timescaledb-vs-tdengine/)
|
||||
- [TDengine vs. OpenTSDB](https://tdengine.com/performance-tdengine-vs-opentsdb/)
|
||||
- [TDengine vs. Cassandra](https://tdengine.com/performance-tdengine-vs-cassandra/)
|
||||
|
||||
## More readings
|
||||
- [Introduction to Time-Series Database](https://tdengine.com/tsdb/)
|
||||
- [Introduction to TDengine competitive advantages](https://tdengine.com/tdengine/)
|
||||
|
||||
|
||||
## Products
|
||||
|
||||
There are two products offered by TDengine: TDengine Enterprise and TDengine Cloud, for details please refer to
|
||||
- [TDengine Enterprise](https://www.taosdata.com/tdengine-pro)
|
||||
- [TDengine Cloud](https://cloud.taosdata.com/?utm_source=menu&utm_medium=webcn)
|
||||
For information about our paid offerings, see:
|
||||
- [TDengine Enterprise](https://tdengine.com/enterprise/)
|
||||
- [TDengine Cloud](https://cloud.tdengine.com)
|
|
@ -30,7 +30,7 @@ And then run the following command:
|
|||
docker run -d -p 6030:6030 -p 6041:6041 -p 6043-6049:6043-6049 -p 6043-6049:6043-6049/udp tdengine/tdengine
|
||||
```
|
||||
|
||||
Note that TDengine Server 3.0 uses TCP port 6030. Port 6041 is used by taosAdapter for the REST API service. Ports 6043 through 6049 are used by taosAdapter for other connectors. You can open these ports as needed.
|
||||
Note that TDengine Server 3.0 uses TCP port 6030. Port 6041 is used by taosAdapter for the REST API service. Ports 6043 through 6049 are used by taosAdapter for other connections. You can open these ports as needed.
|
||||
|
||||
If you need to persist data to a specific directory on your local machine, please run the following command:
|
||||
```shell
|
||||
|
|
|
@ -14,9 +14,9 @@ This document describes how to install TDengine on Linux/Windows/macOS and perfo
|
|||
- To get started with TDengine on Docker, see [Quick Install on Docker](../../get-started/docker).
|
||||
- If you want to view the source code, build TDengine yourself, or contribute to the project, see the [TDengine GitHub repository](https://github.com/taosdata/TDengine).
|
||||
|
||||
The full package of TDengine includes the TDengine Server (`taosd`), TDengine Client (`taosc`), taosAdapter for connecting with third-party systems and providing a RESTful interface, a command-line interface (CLI, taos), and some tools. Note that taosAdapter supports Linux only. In addition to connectors for multiple languages, TDengine also provides a [REST API](../../reference/rest-api) through [taosAdapter](../../reference/taosadapter).
|
||||
The full package of TDengine includes the TDengine Server (`taosd`), TDengine Client (`taosc`), taosAdapter for connecting with third-party systems and providing a RESTful interface, a command-line interface (CLI, taos), and some tools. Note that taosAdapter supports Linux only. In addition to client libraries for multiple languages, TDengine also provides a [REST API](../../reference/rest-api) through [taosAdapter](../../reference/taosadapter).
|
||||
|
||||
The standard server installation package includes `taos`, `taosd`, `taosAdapter`, `taosBenchmark`, and sample code. You can also download the Lite package that includes only `taosd` and the C/C++ connector.
|
||||
The standard server installation package includes `taos`, `taosd`, `taosAdapter`, `taosBenchmark`, and sample code. You can also download the Lite package that includes only `taosd` and the C/C++ client library.
|
||||
|
||||
TDengine OSS is released as Deb and RPM packages. The Deb package can be installed on Debian, Ubuntu, and derivative systems. The RPM package can be installed on CentOS, RHEL, SUSE, and derivative systems. A .tar.gz package is also provided for enterprise customers, and you can install TDengine over `apt-get` as well. The .tar.tz package includes `taosdump` and the TDinsight installation script. If you want to use these utilities with the Deb or RPM package, download and install taosTools separately. TDengine can also be installed on x64 Windows and x64/m1 macOS.
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ import PkgList from "/components/PkgList";
|
|||
|
||||
TDengine is easy to download and install.
|
||||
|
||||
The standard server installation package includes `taos`, `taosd`, `taosAdapter`, `taosBenchmark`, and sample code. You can also download a lite package that includes only `taosd` and the C/C++ connector.
|
||||
The standard server installation package includes `taos`, `taosd`, `taosAdapter`, `taosBenchmark`, and sample code. You can also download a lite package that includes only `taosd` and the C/C++ client library.
|
||||
|
||||
You can download the TDengine installation package in .rpm, .deb, or .tar.gz format. The .tar.tz package includes `taosdump` and the TDinsight installation script. If you want to use these utilities with the .deb or .rpm package, download and install taosTools separately.
|
||||
|
||||
|
@ -10,7 +10,7 @@ Between official releases, beta versions may be released that contain new featur
|
|||
|
||||
<PkgList type={0}/>
|
||||
|
||||
For information about installing TDengine, see [Install and Uninstall](../../operation/pkg-install).
|
||||
For information about installing TDengine, see [Install and Uninstall](../operation/pkg-install).
|
||||
|
||||
For information about TDengine releases, see [All Downloads](https://tdengine.com/all-downloads)
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import StackOverflowSVG from './stackoverflow.svg'
|
|||
|
||||
You can install and run TDengine on Linux/Windows/macOS machines as well as Docker containers. You can also deploy TDengine as a managed service with TDengine Cloud.
|
||||
|
||||
The full package of TDengine includes the TDengine Server (`taosd`), TDengine Client (`taosc`), taosAdapter for connecting with third-party systems and providing a RESTful interface, a command-line interface, and some tools. In addition to connectors for multiple languages, TDengine also provides a [RESTful interface](../reference/rest-api) through [taosAdapter](../reference/taosadapter).
|
||||
The full package of TDengine includes the TDengine Server (`taosd`), TDengine Client (`taosc`), taosAdapter for connecting with third-party systems and providing a RESTful interface, a command-line interface, and some tools. In addition to client libraries for multiple languages, TDengine also provides a [RESTful interface](../reference/rest-api) through [taosAdapter](../reference/taosadapter).
|
||||
|
||||
```mdx-code-block
|
||||
import DocCardList from '@theme/DocCardList';
|
||||
|
|
|
@ -12,4 +12,4 @@ When using REST connection, the feature of bulk pulling can be enabled if the si
|
|||
{{#include docs/examples/java/src/main/java/com/taos/example/WSConnectExample.java:main}}
|
||||
```
|
||||
|
||||
More configuration about connection, please refer to [Java Connector](../../reference/connector/java)
|
||||
More configuration about connection, please refer to [Java Client Library](../../client-libraries/java)
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
```
|
||||
|
||||
:::note
|
||||
For Rust connector, the connection depends on the feature being used. If "rest" feature is enabled, then only the implementation for "rest" is compiled and packaged.
|
||||
For Rust client library, the connection depends on the feature being used. If "rest" feature is enabled, then only the implementation for "rest" is compiled and packaged.
|
||||
|
||||
:::
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
title: Connect to TDengine
|
||||
sidebar_label: Connect
|
||||
description: This document describes how to establish connections to TDengine and how to install and use TDengine connectors.
|
||||
description: This document describes how to establish connections to TDengine and how to install and use TDengine client libraries.
|
||||
---
|
||||
|
||||
import Tabs from "@theme/Tabs";
|
||||
|
@ -15,28 +15,28 @@ import ConnCSNative from "./_connect_cs.mdx";
|
|||
import ConnC from "./_connect_c.mdx";
|
||||
import ConnR from "./_connect_r.mdx";
|
||||
import ConnPHP from "./_connect_php.mdx";
|
||||
import InstallOnLinux from "../../14-reference/03-connector/_linux_install.mdx";
|
||||
import InstallOnWindows from "../../14-reference/03-connector/_windows_install.mdx";
|
||||
import InstallOnMacOS from "../../14-reference/03-connector/_macos_install.mdx";
|
||||
import VerifyLinux from "../../14-reference/03-connector/_verify_linux.mdx";
|
||||
import VerifyWindows from "../../14-reference/03-connector/_verify_windows.mdx";
|
||||
import VerifyMacOS from "../../14-reference/03-connector/_verify_macos.mdx";
|
||||
import InstallOnLinux from "../../08-client-libraries/_linux_install.mdx";
|
||||
import InstallOnWindows from "../../08-client-libraries/_windows_install.mdx";
|
||||
import InstallOnMacOS from "../../08-client-libraries/_macos_install.mdx";
|
||||
import VerifyLinux from "../../08-client-libraries/_verify_linux.mdx";
|
||||
import VerifyWindows from "../../08-client-libraries/_verify_windows.mdx";
|
||||
import VerifyMacOS from "../../08-client-libraries/_verify_macos.mdx";
|
||||
|
||||
Any application running on any platform can access TDengine through the REST API provided by TDengine. For information, see [REST API](../../reference/rest-api/). Applications can also use the connectors for various programming languages, including C/C++, Java, Python, Go, Node.js, C#, and Rust, to access TDengine. These connectors support connecting to TDengine clusters using both native interfaces (taosc). Some connectors also support connecting over a REST interface. Community developers have also contributed several unofficial connectors, such as the ADO.NET connector, the Lua connector, and the PHP connector.
|
||||
Any application running on any platform can access TDengine through the REST API provided by TDengine. For information, see [REST API](../../reference/rest-api/). Applications can also use the client libraries for various programming languages, including C/C++, Java, Python, Go, Node.js, C#, and Rust, to access TDengine. These client libraries support connecting to TDengine clusters using both native interfaces (taosc). Some client libraries also support connecting over a REST interface. Community developers have also contributed several unofficial client libraries, such as the ADO.NET, Lua, and PHP libraries.
|
||||
|
||||
## Establish Connection
|
||||
|
||||
There are two ways for a connector to establish connections to TDengine:
|
||||
There are two ways for a client library to establish connections to TDengine:
|
||||
|
||||
1. REST connection through the REST API provided by the taosAdapter component.
|
||||
2. Native connection through the TDengine client driver (taosc).
|
||||
|
||||
For REST and native connections, connectors provide similar APIs for performing operations and running SQL statements on your databases. The main difference is the method of establishing the connection, which is not visible to users.
|
||||
For REST and native connections, client libraries provide similar APIs for performing operations and running SQL statements on your databases. The main difference is the method of establishing the connection, which is not visible to users.
|
||||
|
||||
Key differences:
|
||||
|
||||
3. The REST connection is more accessible with cross-platform support, however it results in a 30% performance downgrade.
|
||||
1. The TDengine client driver (taosc) has the highest performance with all the features of TDengine like [Parameter Binding](../../reference/connector/cpp#parameter-binding-api), [Subscription](../../reference/connector/cpp#subscription-and-consumption-api), etc.
|
||||
1. The TDengine client driver (taosc) has the highest performance with all the features of TDengine like [Parameter Binding](../../client-libraries/cpp#parameter-binding-api), [Subscription](../../client-libraries/cpp#subscription-and-consumption-api), etc.
|
||||
|
||||
## Install Client Driver taosc
|
||||
|
||||
|
@ -72,7 +72,7 @@ After the above installation and configuration are done and making sure TDengine
|
|||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
## Install Connectors
|
||||
## Install Client Library
|
||||
|
||||
<Tabs groupId="lang">
|
||||
<TabItem label="Java" value="java">
|
||||
|
@ -131,7 +131,7 @@ libtaos = { version = "0.4.2"}
|
|||
```
|
||||
|
||||
:::info
|
||||
Rust connector uses different features to distinguish the way to establish connection. To establish REST connection, please enable `rest` feature.
|
||||
Rust client library uses different features to distinguish the way to establish connection. To establish REST connection, please enable `rest` feature.
|
||||
|
||||
```toml
|
||||
libtaos = { version = "*", features = ["rest"] }
|
||||
|
@ -142,9 +142,9 @@ libtaos = { version = "*", features = ["rest"] }
|
|||
</TabItem>
|
||||
<TabItem label="Node.js" value="node">
|
||||
|
||||
Node.js connector provides different ways of establishing connections by providing different packages.
|
||||
Node.js client library provides different ways of establishing connections by providing different packages.
|
||||
|
||||
1. Install Node.js Native Connector
|
||||
1. Install Node.js Native Client Library
|
||||
|
||||
```
|
||||
npm install @tdengine/client
|
||||
|
@ -154,7 +154,7 @@ npm install @tdengine/client
|
|||
It's recommend to use Node whose version is between `node-v12.8.0` and `node-v13.0.0`.
|
||||
:::
|
||||
|
||||
2. Install Node.js REST Connector
|
||||
2. Install Node.js REST Client Library
|
||||
|
||||
```
|
||||
npm install @tdengine/rest
|
||||
|
@ -207,7 +207,7 @@ install.packages("RJDBC")
|
|||
</TabItem>
|
||||
<TabItem label="C" value="c">
|
||||
|
||||
If the client driver (taosc) is already installed, then the C connector is already available.
|
||||
If the client driver (taosc) is already installed, then the C client library is already available.
|
||||
<br/>
|
||||
|
||||
</TabItem>
|
||||
|
|
|
@ -24,7 +24,7 @@ import PhpStmt from "./_php_stmt.mdx";
|
|||
|
||||
## Introduction
|
||||
|
||||
Application programs can execute `INSERT` statement through connectors to insert rows. The TDengine CLI can also be used to manually insert data.
|
||||
Application programs can execute `INSERT` statement through client libraries to insert rows. The TDengine CLI can also be used to manually insert data.
|
||||
|
||||
### Insert Single Row
|
||||
The below SQL statement is used to insert one row into table "d1001".
|
||||
|
|
|
@ -377,7 +377,7 @@ SQLWriter class encapsulates the logic of composing SQL and writing data. Please
|
|||
|
||||
- TDengine client driver has been installed
|
||||
- Python3 has been installed, the the version >= 3.8
|
||||
- TDengine Python connector `taospy` has been installed
|
||||
- TDengine Python client library `taospy` has been installed
|
||||
|
||||
2. Install faster-fifo to replace python builtin multiprocessing.Queue
|
||||
|
||||
|
@ -434,7 +434,7 @@ SQLWriter class encapsulates the logic of composing SQL and writing data. Please
|
|||
</details>
|
||||
|
||||
:::note
|
||||
Don't establish connection to TDengine in the parent process if using Python connector in multi-process way, otherwise all the connections in child processes are blocked always. This is a known issue.
|
||||
Don't establish connection to TDengine in the parent process if using Python client library in multi-process way, otherwise all the connections in child processes are blocked always. This is a known issue.
|
||||
|
||||
:::
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: Query Data
|
||||
description: This document describes how to query data in TDengine and how to perform synchronous and asynchronous queries using connectors.
|
||||
description: This document describes how to query data in TDengine and how to perform synchronous and asynchronous queries using client libraries.
|
||||
---
|
||||
|
||||
import Tabs from "@theme/Tabs";
|
||||
|
@ -19,7 +19,7 @@ import CAsync from "./_c_async.mdx";
|
|||
|
||||
## Introduction
|
||||
|
||||
SQL is used by TDengine as its query language. Application programs can send SQL statements to TDengine through REST API or connectors. TDengine's CLI `taos` can also be used to execute ad hoc SQL queries. Here is the list of major query functionalities supported by TDengine:
|
||||
SQL is used by TDengine as its query language. Application programs can send SQL statements to TDengine through REST API or client libraries. TDengine's CLI `taos` can also be used to execute ad hoc SQL queries. Here is the list of major query functionalities supported by TDengine:
|
||||
|
||||
- Query on single column or multiple columns
|
||||
- Filter on tags or data columns: >, <, =, <\>, like
|
||||
|
|
|
@ -23,7 +23,7 @@ By subscribing to a topic, a consumer can obtain the latest data in that topic i
|
|||
|
||||
To implement these features, TDengine indexes its write-ahead log (WAL) file for fast random access and provides configurable methods for replacing and retaining this file. You can define a retention period and size for this file. For information, see the CREATE DATABASE statement. In this way, the WAL file is transformed into a persistent storage engine that remembers the order in which events occur. However, note that configuring an overly long retention period for your WAL files makes database compression inefficient. TDengine then uses the WAL file instead of the time-series database as its storage engine for queries in the form of topics. TDengine reads the data from the WAL file; uses a unified query engine instance to perform filtering, transformations, and other operations; and finally pushes the data to consumers.
|
||||
|
||||
The following are some explanations about data subscription, which require some understanding of the architecture of TDengine and the use of various language linker interfaces.
|
||||
The following are some explanations about data subscription, which require some understanding of the architecture of TDengine and the use of various language linker interfaces(you can learn it when you need it).
|
||||
- A consumption group consumes all data under the same topic, and different consumption groups are independent of each other;
|
||||
- A consumption group consumes all vgroups of the same topic, which can be composed of multiple consumers, but a vgroup is only consumed by one consumer. If the number of consumers exceeds the number of vgroups, the excess consumers do not consume data;
|
||||
- On the server side, only one offset is saved for each vgroup, and the offsets for each vgroup are monotonically increasing, but not necessarily continuous. There is no correlation between the offsets of various vgroups;
|
||||
|
@ -45,12 +45,13 @@ The following are some explanations about data subscription, which require some
|
|||
|
||||
This document does not provide any further introduction to the knowledge of message queues themselves. If you need to know more, please search for it yourself.
|
||||
|
||||
Note:
|
||||
Starting from version 3.2.0.0, data subscription supports vnode migration and splitting.
|
||||
Due to the dependence of data subscription on wal files, wal does not synchronize during vnode migration and splitting. Therefore, after migration or splitting, wal data that has not been consumed before cannot be consumed. So please ensure that all data has been consumed before proceeding with vnode migration or splitting, otherwise data loss may occur during consumption.
|
||||
|
||||
## Data Schema and API
|
||||
|
||||
The related schemas and APIs in various languages are described as follows:
|
||||
The related schemas and APIs in various languages are described as follows(Note that the consumer structure is not thread safe. When using a consumer on one thread, do not close the consumer on another thread):
|
||||
|
||||
<Tabs defaultValue="java" groupId="lang">
|
||||
<TabItem value="c" label="C">
|
||||
|
|
|
@ -5,7 +5,7 @@ description: This document describes how to use the various components of TDengi
|
|||
|
||||
Before creating an application to process time-series data with TDengine, consider the following:
|
||||
|
||||
1. Choose the method to connect to TDengine. TDengine offers a REST API that can be used with any programming language. It also has connectors for a variety of languages.
|
||||
1. Choose the method to connect to TDengine. TDengine offers a REST API that can be used with any programming language. It also has client libraries for a variety of languages.
|
||||
2. Design the data model based on your own use cases. Consider the main [concepts](../concept/) of TDengine, including "one table per data collection point" and the supertable. Learn about static labels, collected metrics, and subtables. Depending on the characteristics of your data and your requirements, you decide to create one or more databases and design a supertable schema that fit your data.
|
||||
3. Decide how you will insert data. TDengine supports writing using standard SQL, but also supports schemaless writing, so that data can be written directly without creating tables manually.
|
||||
4. Based on business requirements, find out what SQL query statements need to be written. You may be able to repurpose any existing SQL.
|
||||
|
@ -14,7 +14,7 @@ Before creating an application to process time-series data with TDengine, consid
|
|||
7. In many use cases (such as fleet management), the application needs to obtain the latest status of each data collection point. It is recommended that you use the cache function of TDengine instead of deploying Redis separately.
|
||||
8. If you find that the SQL functions of TDengine cannot meet your requirements, then you can use user-defined functions to solve the problem.
|
||||
|
||||
This section is organized in the order described above. For ease of understanding, TDengine provides sample code for each supported programming language for each function. If you want to learn more about the use of SQL, please read the [SQL manual](../taos-sql/). For a more in-depth understanding of the use of each connector, please read the [Connector Reference Guide](../reference/connector/). If you also want to integrate TDengine with third-party systems, such as Grafana, please refer to the [third-party tools](../third-party/).
|
||||
This section is organized in the order described above. For ease of understanding, TDengine provides sample code for each supported programming language for each function. If you want to learn more about the use of SQL, please read the [SQL manual](../taos-sql/). For a more in-depth understanding of the use of each client library, please read the [Client Library Reference Guide](../client-libraries/). If you also want to integrate TDengine with third-party systems, such as Grafana, please refer to the [third-party tools](../third-party/).
|
||||
|
||||
If you encounter any problems during the development process, please click ["Submit an issue"](https://github.com/taosdata/TDengine/issues/new/choose) at the bottom of each page and submit it on GitHub right away.
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
---
|
||||
title: C/C++ Connector
|
||||
title: C/C++ Client Library
|
||||
sidebar_label: C/C++
|
||||
description: This document describes the TDengine C/C++ connector.
|
||||
description: This document describes the TDengine C/C++ client library.
|
||||
---
|
||||
|
||||
C/C++ developers can use TDengine's client driver and the C/C++ connector, to develop their applications to connect to TDengine clusters for data writing, querying, and other functions. To use the C/C++ connector you must include the TDengine header file _taos.h_, which lists the function prototypes of the provided APIs. The application also needs to link to the corresponding dynamic libraries on the platform where it is located.
|
||||
C/C++ developers can use TDengine's client driver and the C/C++ client library, to develop their applications to connect to TDengine clusters for data writing, querying, and other functions. To use the C/C++ client library you must include the TDengine header file _taos.h_, which lists the function prototypes of the provided APIs. The application also needs to link to the corresponding dynamic libraries on the platform where it is located.
|
||||
|
||||
```c
|
||||
#include <taos.h>
|
||||
|
@ -263,7 +263,7 @@ typedef struct taosField {
|
|||
Get the reason for the last API call failure. The return value is the error code.
|
||||
|
||||
:::note
|
||||
TDengine version 2.0 and above recommends that each thread of a database application create a separate connection or a connection pool based on threads. It is not recommended to pass the connection (TAOS\*) structure to different threads for shared use in the application. Queries, writes, and other operations issued that are based on TAOS structures are multi-thread safe, but state quantities such as the "USE statement" may interfere between threads. In addition, the C connector can dynamically create new database-oriented connections on demand (this procedure is not visible to the user), and it is recommended that `taos_close()` be called only at the final exit of the program to close the connection.
|
||||
TDengine version 2.0 and above recommends that each thread of a database application create a separate connection or a connection pool based on threads. It is not recommended to pass the connection (TAOS\*) structure to different threads for shared use in the application. Queries, writes, and other operations issued that are based on TAOS structures are multi-thread safe, but state quantities such as the "USE statement" may interfere between threads. In addition, the C client library can dynamically create new database-oriented connections on demand (this procedure is not visible to the user), and it is recommended that `taos_close()` be called only at the final exit of the program to close the connection.
|
||||
|
||||
:::
|
||||
|
||||
|
@ -394,7 +394,7 @@ The specific functions related to the interface are as follows (see also the [pr
|
|||
|
||||
### Schemaless Writing API
|
||||
|
||||
In addition to writing data using the SQL method or the parameter binding API, writing can also be done using schemaless writing, which eliminates the need to create a super table/data sub-table structure in advance and writes the data directly. The TDengine system automatically creates and maintains the required table structure based on the written data content. The use of schemaless writing is described in the chapter [Schemaless Writing](../../schemaless/), and the C/C++ API used with it is described here.
|
||||
In addition to writing data using the SQL method or the parameter binding API, writing can also be done using schemaless writing, which eliminates the need to create a super table/data sub-table structure in advance and writes the data directly. The TDengine system automatically creates and maintains the required table structure based on the written data content. The use of schemaless writing is described in the chapter [Schemaless Writing](../../reference/schemaless/), and the C/C++ API used with it is described here.
|
||||
|
||||
- `TAOS_RES* taos_schemaless_insert(TAOS* taos, const char* lines[], int numLines, int protocol, int precision)`
|
||||
|
|
@ -1,16 +1,16 @@
|
|||
---
|
||||
title: TDengine Java Connector
|
||||
title: TDengine Java Client Library
|
||||
sidebar_label: Java
|
||||
description: This document describes the TDengine Java Connector.
|
||||
description: This document describes the TDengine Java client library.
|
||||
toc_max_heading_level: 4
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
`taos-jdbcdriver` is the official Java connector for TDengine. Java developers can use it to develop applications that access data in TDengine. `taos-jdbcdriver` implements standard JDBC driver interfaces and two connection methods: One is **native connection**, which connects to TDengine instances natively through the TDengine client driver (taosc), supporting data writing, querying, subscriptions, schemaless writing, and bind interface. The second is **REST connection** which is implemented through taosAdapter. The set of features implemented by the REST connection differs slightly from those implemented by the native connection.
|
||||
`taos-jdbcdriver` is the official Java client library for TDengine. Java developers can use it to develop applications that access data in TDengine. `taos-jdbcdriver` implements standard JDBC driver interfaces and two connection methods: One is **native connection**, which connects to TDengine instances natively through the TDengine client driver (taosc), supporting data writing, querying, subscriptions, schemaless writing, and bind interface. The second is **REST connection** which is implemented through taosAdapter. The set of features implemented by the REST connection differs slightly from those implemented by the native connection.
|
||||
|
||||

|
||||

|
||||
|
||||
The preceding figure shows the two ways in which a Java application can access TDengine.
|
||||
|
||||
|
@ -72,7 +72,7 @@ try (Statement statement = connection.createStatement()) {
|
|||
}
|
||||
```
|
||||
|
||||
There are four types of error codes that the JDBC connector can report:
|
||||
There are four types of error codes that the JDBC client library can report:
|
||||
|
||||
- Error code of the JDBC driver itself (error code between 0x2301 and 0x2350),
|
||||
- Error code of the native connection method (error code between 0x2351 and 0x2360)
|
||||
|
@ -123,7 +123,7 @@ For specific error codes, please refer to.
|
|||
| 0x2379 | seek offset must not be a negative number | The seek interface parameter cannot be negative. Use the correct parameter |
|
||||
| 0x237a | vGroup not found in result set | subscription is not bound to the VGroup due to the rebalance mechanism |
|
||||
|
||||
- [TDengine Java Connector](https://github.com/taosdata/taos-connector-jdbc/blob/main/src/main/java/com/taosdata/jdbc/TSDBErrorNumbers.java)
|
||||
- [TDengine Java client library](https://github.com/taosdata/taos-connector-jdbc/blob/main/src/main/java/com/taosdata/jdbc/TSDBErrorNumbers.java)
|
||||
<!-- - [TDengine_ERROR_CODE](../error-code) -->
|
||||
|
||||
## TDengine DataType vs. Java DataType
|
||||
|
@ -148,21 +148,21 @@ TDengine currently supports timestamp, number, character, Boolean type, and the
|
|||
|
||||
**Note**: Only TAG supports JSON types
|
||||
Due to historical reasons, the BINARY type data in TDengine is not truly binary data and is no longer recommended for use. Please use VARBINARY type instead.
|
||||
GEOMETRY type is binary data in little endian byte order, which complies with the WKB specification. For detailed information, please refer to [Data Type](../../../taos-sql/data-type/)
|
||||
For WKB specifications, please refer to [Well Known Binary (WKB)]( https://libgeos.org/specifications/wkb/ )
|
||||
For Java connector, the jts library can be used to easily create GEOMETRY type objects, serialize them, and write them to TDengine. Here is an example [Geometry example](https://github.com/taosdata/TDengine/blob/3.0/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/GeometryDemo.java)
|
||||
GEOMETRY type is binary data in little endian byte order, which complies with the WKB specification. For detailed information, please refer to [Data Type](../../taos-sql/data-type/)
|
||||
For WKB specifications, please refer to [Well Known Binary (WKB)](https://libgeos.org/specifications/wkb/)
|
||||
For Java connector, the jts library can be used to easily create GEOMETRY type objects, serialize them, and write them to TDengine. Here is an example [Geometry example](https://github.com/taosdata/TDengine/blob/3.0/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/GeometryDemo.java)
|
||||
|
||||
|
||||
## Installation Steps
|
||||
|
||||
### Pre-installation preparation
|
||||
|
||||
Before using Java Connector to connect to the database, the following conditions are required.
|
||||
Before using Java client library to connect to the database, the following conditions are required.
|
||||
|
||||
- Java 1.8 or above runtime environment and Maven 3.6 or above installed
|
||||
- TDengine client driver installed (required for native connections, not required for REST connections), please refer to [Installing Client Driver](../#Install-Client-Driver)
|
||||
|
||||
### Install the connectors
|
||||
### Install the client library
|
||||
|
||||
<Tabs defaultValue="maven">
|
||||
<TabItem value="maven" label="Install via Maven">
|
||||
|
@ -186,7 +186,7 @@ Add following dependency in the `pom.xml` file of your Maven project:
|
|||
</TabItem>
|
||||
<TabItem value="source" label="Build from source code">
|
||||
|
||||
You can build Java connector from source code after cloning the TDengine project:
|
||||
You can build Java client library from source code after cloning the TDengine project:
|
||||
|
||||
```shell
|
||||
git clone https://github.com/taosdata/taos-connector-jdbc.git
|
||||
|
@ -269,7 +269,7 @@ In the above example, JDBC uses the client's configuration file to establish a c
|
|||
|
||||
In TDengine, as long as one node in firstEp and secondEp is valid, the connection to the cluster can be established normally.
|
||||
|
||||
The configuration file here refers to the configuration file on the machine where the application that calls the JDBC Connector is located, the default path is `/etc/taos/taos.cfg` on Linux, the default path is `C://TDengine/cfg/taos.cfg` on Windows, and the default path is `/etc/taos/taos.cfg` on macOS.
|
||||
The configuration file here refers to the configuration file on the machine where the application that calls the JDBC client library is located, the default path is `/etc/taos/taos.cfg` on Linux, the default path is `C://TDengine/cfg/taos.cfg` on Windows, and the default path is `/etc/taos/taos.cfg` on macOS.
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="rest" label="REST connection">
|
||||
|
@ -368,7 +368,7 @@ The configuration parameters in properties are as follows.
|
|||
- TSDBDriver.PROPERTY_KEY_MESSAGE_WAIT_TIMEOUT: message transmission timeout in milliseconds, the default value is 60000 ms. It only takes effect when using JDBC REST connection and batchfetch is true.
|
||||
- TSDBDriver.PROPERTY_KEY_USE_SSL: connecting Securely Using SSL. true: using SSL connection, false: not using SSL connection. It only takes effect when using JDBC REST connection.
|
||||
- TSDBDriver.HTTP_POOL_SIZE: size of REST concurrent requests. The default value is 20.
|
||||
For JDBC native connections, you can specify other parameters, such as log level, SQL length, etc., by specifying URL and Properties. For more detailed configuration, please refer to [Client Configuration](../../config/#Client-Only).
|
||||
For JDBC native connections, you can specify other parameters, such as log level, SQL length, etc., by specifying URL and Properties. For more detailed configuration, please refer to [Client Configuration](../../reference/config/#Client-Only).
|
||||
|
||||
### Priority of configuration parameters
|
||||
|
||||
|
@ -977,7 +977,7 @@ public void setTagGeometry(int index, byte[] value)
|
|||
|
||||
### Schemaless Writing
|
||||
|
||||
TDengine supports schemaless writing. It is compatible with InfluxDB's Line Protocol, OpenTSDB's telnet line protocol, and OpenTSDB's JSON format protocol. For more information, see [Schemaless Writing](../../schemaless).
|
||||
TDengine supports schemaless writing. It is compatible with InfluxDB's Line Protocol, OpenTSDB's telnet line protocol, and OpenTSDB's JSON format protocol. For more information, see [Schemaless Writing](../../reference/schemaless/).
|
||||
|
||||
<Tabs defaultValue="native">
|
||||
<TabItem value="native" label="native connection">
|
||||
|
@ -1057,7 +1057,7 @@ writer.write(lineDemo, SchemalessProtocolType.LINE, SchemalessTimestampType.NANO
|
|||
|
||||
### Data Subscription
|
||||
|
||||
The TDengine Java Connector supports subscription functionality with the following application API.
|
||||
The TDengine Java client library supports subscription functionality with the following application API.
|
||||
|
||||
#### Create a Topic
|
||||
|
||||
|
@ -1094,7 +1094,7 @@ TaosConsumer consumer = new TaosConsumer<>(config);
|
|||
- httpConnectTimeout: WebSocket connection timeout in milliseconds, the default value is 5000 ms. It only takes effect when using WebSocket type.
|
||||
- messageWaitTimeout: socket timeout in milliseconds, the default value is 10000 ms. It only takes effect when using WebSocket type.
|
||||
- httpPoolSize: Maximum number of concurrent requests on the a connection。It only takes effect when using WebSocket type.
|
||||
- For more information, see [Consumer Parameters](../../../develop/tmq). Note that the default value of auto.offset.reset in data subscription on the TDengine server has changed since version 3.2.0.0.
|
||||
- For more information, see [Consumer Parameters](../../develop/tmq). Note that the default value of auto.offset.reset in data subscription on the TDengine server has changed since version 3.2.0.0.
|
||||
|
||||
#### Subscribe to consume data
|
||||
|
||||
|
@ -1172,14 +1172,14 @@ consumer.unsubscribe();
|
|||
consumer.close()
|
||||
```
|
||||
|
||||
For more information, see [Data Subscription](../../../develop/tmq).
|
||||
For more information, see [Data Subscription](../../develop/tmq).
|
||||
|
||||
#### Full Sample Code
|
||||
|
||||
<Tabs defaultValue="native">
|
||||
<TabItem value="native" label="native connection">
|
||||
|
||||
In addition to the native connection, the Java Connector also supports subscribing via websocket.
|
||||
In addition to the native connection, the Java client library also supports subscribing via websocket.
|
||||
|
||||
```java
|
||||
public abstract class ConsumerLoop {
|
||||
|
@ -1461,7 +1461,7 @@ The source code of the sample application is under `TDengine/examples/JDBC`:
|
|||
|
||||
**Solution**: Use taos-jdbcdriver 3.0.2.
|
||||
|
||||
For additional troubleshooting, see [FAQ](../../../train-faq/faq).
|
||||
For additional troubleshooting, see [FAQ](../../train-faq/faq).
|
||||
|
||||
## API Reference
|
||||
|
|
@ -1,20 +1,20 @@
|
|||
---
|
||||
title: TDengine Go Connector
|
||||
title: TDengine Go Client Library
|
||||
sidebar_label: Go
|
||||
description: This document describes the TDengine Go connector.
|
||||
description: This document describes the TDengine Go client library.
|
||||
toc_max_heading_level: 4
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
import GoInsert from "../../07-develop/03-insert-data/_go_sql.mdx"
|
||||
import GoInfluxLine from "../../07-develop/03-insert-data/_go_line.mdx"
|
||||
import GoOpenTSDBTelnet from "../../07-develop/03-insert-data/_go_opts_telnet.mdx"
|
||||
import GoOpenTSDBJson from "../../07-develop/03-insert-data/_go_opts_json.mdx"
|
||||
import GoQuery from "../../07-develop/04-query-data/_go.mdx"
|
||||
import GoInsert from "../07-develop/03-insert-data/_go_sql.mdx"
|
||||
import GoInfluxLine from "../07-develop/03-insert-data/_go_line.mdx"
|
||||
import GoOpenTSDBTelnet from "../07-develop/03-insert-data/_go_opts_telnet.mdx"
|
||||
import GoOpenTSDBJson from "../07-develop/03-insert-data/_go_opts_json.mdx"
|
||||
import GoQuery from "../07-develop/04-query-data/_go.mdx"
|
||||
|
||||
`driver-go` is the official Go language connector for TDengine. It implements the [database/sql](https://golang.org/pkg/database/sql/) package, the generic Go language interface to SQL databases. Go developers can use it to develop applications that access TDengine cluster data.
|
||||
`driver-go` is the official Go language client library for TDengine. It implements the [database/sql](https://golang.org/pkg/database/sql/) package, the generic Go language interface to SQL databases. Go developers can use it to develop applications that access TDengine cluster data.
|
||||
|
||||
`driver-go` provides two ways to establish connections. One is **native connection**, which connects to TDengine instances natively through the TDengine client driver (taosc), supporting data writing, querying, subscriptions, schemaless writing, and bind interface. The other is the **REST connection**, which connects to TDengine instances via the REST interface provided by taosAdapter. The set of features implemented by the REST connection differs slightly from those implemented by the native connection.
|
||||
|
||||
|
@ -81,7 +81,7 @@ Configure the environment variables and check the command.
|
|||
* ```go env```
|
||||
* ```gcc -v```
|
||||
|
||||
### Install the connectors
|
||||
### Install the client library
|
||||
|
||||
1. Initialize the project with the `go mod` command.
|
||||
|
||||
|
@ -222,11 +222,11 @@ func main() {
|
|||
|
||||
### Specify the URL and Properties to get the connection
|
||||
|
||||
The Go connector does not support this feature
|
||||
The Go client library does not support this feature
|
||||
|
||||
### Priority of configuration parameters
|
||||
|
||||
The Go connector does not support this feature
|
||||
The Go client library does not support this feature
|
||||
|
||||
## Usage examples
|
||||
|
||||
|
@ -769,7 +769,7 @@ You can get the unique id by `common.GetReqID()`.
|
|||
|
||||
### Data Subscription
|
||||
|
||||
The TDengine Go Connector supports subscription functionality with the following application API.
|
||||
The TDengine Go client library supports subscription functionality with the following application API.
|
||||
|
||||
#### Create a Topic
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
title: TDengine Rust Connector
|
||||
title: TDengine Rust Client Library
|
||||
sidebar_label: Rust
|
||||
description: This document describes the TDengine Rust connector.
|
||||
description: This document describes the TDengine Rust client library.
|
||||
toc_max_heading_level: 4
|
||||
---
|
||||
|
||||
|
@ -9,18 +9,18 @@ import Tabs from '@theme/Tabs';
|
|||
import TabItem from '@theme/TabItem';
|
||||
|
||||
import Preparition from "./_preparation.mdx"
|
||||
import RustInsert from "../../07-develop/03-insert-data/_rust_sql.mdx"
|
||||
import RustBind from "../../07-develop/03-insert-data/_rust_stmt.mdx"
|
||||
import RustSml from "../../07-develop/03-insert-data/_rust_schemaless.mdx"
|
||||
import RustQuery from "../../07-develop/04-query-data/_rust.mdx"
|
||||
import RustInsert from "../07-develop/03-insert-data/_rust_sql.mdx"
|
||||
import RustBind from "../07-develop/03-insert-data/_rust_stmt.mdx"
|
||||
import RustSml from "../07-develop/03-insert-data/_rust_schemaless.mdx"
|
||||
import RustQuery from "../07-develop/04-query-data/_rust.mdx"
|
||||
|
||||
[](https://crates.io/crates/taos)  [](https://docs.rs/taos)
|
||||
|
||||
`taos` is the official Rust connector for TDengine. Rust developers can develop applications to access the TDengine instance data.
|
||||
`taos` is the official Rust client library for TDengine. Rust developers can develop applications to access the TDengine instance data.
|
||||
|
||||
`taos` provides two ways to establish connections. One is the **Native Connection**, which connects to TDengine instances via the TDengine client driver (taosc). The other is the **WebSocket connection**, which connects to TDengine instances via the WebSocket interface provided by taosAdapter. You can specify a connection type with Cargo features. By default, both types are supported. The Websocket connection can be used on any platform. The native connection can be used on any platform that the TDengine Client supports.
|
||||
|
||||
The source code for the Rust connectors is located on [GitHub](https://github.com/taosdata/taos-connector-rust).
|
||||
The source code for the Rust client library is located on [GitHub](https://github.com/taosdata/taos-connector-rust).
|
||||
|
||||
## Supported platforms
|
||||
|
||||
|
@ -37,7 +37,7 @@ Websocket connections are supported on all platforms that can run Go.
|
|||
| v0.7.6 | 3.0.3.0 | Support req_id in query. |
|
||||
| v0.6.0 | 3.0.0.0 | Base features. |
|
||||
|
||||
The Rust Connector is still under rapid development and is not guaranteed to be backward compatible before 1.0. We recommend using TDengine version 3.0 or higher to avoid known issues.
|
||||
The Rust client library is still under rapid development and is not guaranteed to be backward compatible before 1.0. We recommend using TDengine version 3.0 or higher to avoid known issues.
|
||||
|
||||
## Handling exceptions
|
||||
|
||||
|
@ -82,7 +82,7 @@ Note: Only TAG supports JSON types
|
|||
* Install the Rust development toolchain
|
||||
* If using the native connection, please install the TDengine client driver. Please refer to [install client driver](../#install-client-driver)
|
||||
|
||||
### Install the connectors
|
||||
### Install the client library
|
||||
|
||||
Depending on the connection method, add the [taos][taos] dependency in your Rust project as follows:
|
||||
|
||||
|
@ -154,8 +154,8 @@ The structure of the DSN description string is as follows:
|
|||
|
||||
The parameters are described as follows:
|
||||
|
||||
- **driver**: Specify a driver name so that the connector can choose which method to use to establish the connection. Supported driver names are as follows:
|
||||
- **taos**: Table names use the TDengine connector driver.
|
||||
- **driver**: Specify a driver name so that the client library can choose which method to use to establish the connection. Supported driver names are as follows:
|
||||
- **taos**: Table names use the TDengine native connection driver.
|
||||
- **tmq**: Use the TMQ to subscribe to data.
|
||||
- **http/ws**: Use Websocket to establish connections.
|
||||
- **https/wss**: Use Websocket to establish connections, and enable SSL/TLS.
|
||||
|
@ -327,7 +327,7 @@ Parameter binding details see [API Reference](#stmt-api)
|
|||
|
||||
### Schemaless Writing
|
||||
|
||||
TDengine supports schemaless writing. It is compatible with InfluxDB's Line Protocol, OpenTSDB's telnet line protocol, and OpenTSDB's JSON format protocol. For more information, see [Schemaless Writing](../../schemaless).
|
||||
TDengine supports schemaless writing. It is compatible with InfluxDB's Line Protocol, OpenTSDB's telnet line protocol, and OpenTSDB's JSON format protocol. For more information, see [Schemaless Writing](../../reference/schemaless/).
|
||||
|
||||
<RustSml />
|
||||
|
||||
|
@ -347,7 +347,7 @@ client.put(&sml_data)?
|
|||
|
||||
### Data Subscription
|
||||
|
||||
TDengine starts subscriptions through [TMQ](../../../taos-sql/tmq/).
|
||||
TDengine starts subscriptions through [TMQ](../../taos-sql/tmq/).
|
||||
|
||||
#### Create a Topic
|
||||
|
||||
|
@ -361,7 +361,7 @@ taos.exec_many([
|
|||
|
||||
#### Create a Consumer
|
||||
|
||||
You create a TMQ connector by using a DSN.
|
||||
You create a TMQ connection by using a DSN.
|
||||
|
||||
```rust
|
||||
let tmq = TmqBuilder::from_dsn("taos://localhost:6030/?group.id=test")?;
|
||||
|
@ -442,7 +442,7 @@ The following parameters can be configured for the TMQ DSN. Only `group.id` is m
|
|||
|
||||
- `group.id`: Within a consumer group, load balancing is implemented by consuming messages on an at-least-once basis.
|
||||
- `client.id`: Subscriber client ID.
|
||||
- `auto.offset.reset`: Initial point of subscription. *earliest* subscribes from the beginning, and *latest* subscribes from the newest message. The default value varies depending on the TDengine version. For details, see [Data Subscription](https://docs.tdengine.com/develop/tmq/). Note: This parameter is set per consumer group.
|
||||
- `auto.offset.reset`: Initial point of subscription. *earliest* subscribes from the beginning, and *latest* subscribes from the newest message. The default value varies depending on the TDengine version. For details, see [Data Subscription](../../develop/tmq/). Note: This parameter is set per consumer group.
|
||||
- `enable.auto.commit`: Automatically commits. This can be enabled when data consistency is not essential.
|
||||
- `auto.commit.interval.ms`: Interval for automatic commits.
|
||||
|
||||
|
@ -488,7 +488,7 @@ The source code of the sample application is under `TDengine/examples/rust` :
|
|||
|
||||
## Frequently Asked Questions
|
||||
|
||||
For additional troubleshooting, see [FAQ](../../../train-faq/faq).
|
||||
For additional troubleshooting, see [FAQ](../../train-faq/faq).
|
||||
|
||||
## API Reference
|
||||
|
|
@ -1,20 +1,20 @@
|
|||
---
|
||||
title: TDengine Python Connector
|
||||
title: TDengine Python Client Library
|
||||
sidebar_label: Python
|
||||
description: This document describes taospy, the TDengine Python connector.
|
||||
description: This document describes taospy, the TDengine Python client library.
|
||||
---
|
||||
|
||||
import Tabs from "@theme/Tabs";
|
||||
import TabItem from "@theme/TabItem";
|
||||
|
||||
`taospy` is the official Python connector for TDengine. taospy provides a rich API that makes it easy for Python applications to use TDengine. `taospy` wraps both the [native interface](../cpp) and [REST interface](../../rest-api) of TDengine, which correspond to the `taos` and `taosrest` modules of the `taospy` package, respectively.
|
||||
`taospy` is the official Python client library for TDengine. taospy provides a rich API that makes it easy for Python applications to use TDengine. `taospy` wraps both the [native interface](../cpp) and [REST interface](../../reference/rest-api) of TDengine, which correspond to the `taos` and `taosrest` modules of the `taospy` package, respectively.
|
||||
In addition to wrapping the native and REST interfaces, `taospy` also provides a set of programming interfaces that conforms to the [Python Data Access Specification (PEP 249)](https://peps.python.org/pep-0249/). It is easy to integrate `taospy` with many third-party tools, such as [SQLAlchemy](https://www.sqlalchemy.org/) and [pandas](https://pandas.pydata.org/).
|
||||
|
||||
`taos-ws-py` is an optional package to enable using WebSocket to connect TDengine.
|
||||
|
||||
The direct connection to the server using the native interface provided by the client driver is referred to hereinafter as a "native connection"; the connection to the server using the REST or WebSocket interface provided by taosAdapter is referred to hereinafter as a "REST connection" or "WebSocket connection".
|
||||
|
||||
The source code for the Python connector is hosted on [GitHub](https://github.com/taosdata/taos-connector-python).
|
||||
The source code for the Python client library is hosted on [GitHub](https://github.com/taosdata/taos-connector-python).
|
||||
## Supported platforms
|
||||
|
||||
- The [supported platforms](../#supported-platforms) for the native connection are the same as the ones supported by the TDengine client.
|
||||
|
@ -29,13 +29,13 @@ The source code for the Python connector is hosted on [GitHub](https://github.co
|
|||
|
||||
We recommend using the latest version of `taospy`, regardless of the version of TDengine.
|
||||
|
||||
|Python Connector Version|major changes|
|
||||
|Python Client Library Version|major changes|
|
||||
|:-------------------:|:----:|
|
||||
|2.7.12|1. added support for `varbinary` type (STMT does not yet support)<br/> 2. improved query performance (thanks to contributor [hadrianl](https://github.com/taosdata/taos-connector-python/pull/209))|
|
||||
|2.7.9|support for getting assignment and seek function on subscription|
|
||||
|2.7.8|add `execute_many` method|
|
||||
|
||||
|Python Websocket Connector Version|major changes|
|
||||
|Python Websocket Connection Version|major changes|
|
||||
|:----------------------------:|:-----:|
|
||||
|0.2.9|bugs fixes|
|
||||
|0.2.5|1. support for getting assignment and seek function on subscription <br/> 2. support schemaless <br/> 3. support STMT|
|
||||
|
@ -43,9 +43,9 @@ We recommend using the latest version of `taospy`, regardless of the version of
|
|||
|
||||
## Handling Exceptions
|
||||
|
||||
There are 4 types of exception in python connector.
|
||||
There are 4 types of exception in python client library.
|
||||
|
||||
- The exception of Python Connector itself.
|
||||
- The exception of Python client library itself.
|
||||
- The exception of native library.
|
||||
- The exception of websocket
|
||||
- The exception of subscription.
|
||||
|
@ -55,7 +55,7 @@ There are 4 types of exception in python connector.
|
|||
|:--------:|:---------:|:---------------:|
|
||||
|InterfaceError|the native library is too old that it cannot support the function|please check the TDengine client version|
|
||||
|ConnectionError|connection error|please check TDengine's status and the connection params|
|
||||
|DatabaseError|database error|please upgrade Python connector to latest|
|
||||
|DatabaseError|database error|please upgrade Python client library to latest|
|
||||
|OperationalError|operation error||
|
||||
|ProgrammingError|||
|
||||
|StatementError|the exception of stmt||
|
||||
|
@ -65,7 +65,7 @@ There are 4 types of exception in python connector.
|
|||
|
||||
It usually uses try-expect to handle exceptions in python. For exception handling, please refer to [Python Errors and Exceptions Documentation](https://docs.python.org/3/tutorial/errors.html).
|
||||
|
||||
All exceptions from the Python Connector are thrown directly. Applications should handle these exceptions. For example:
|
||||
All exceptions from the Python client library are thrown directly. Applications should handle these exceptions. For example:
|
||||
|
||||
```python
|
||||
{{#include docs/examples/python/handle_exception.py}}
|
||||
|
@ -101,14 +101,14 @@ If you use a native connection, you will also need to [Install Client Driver](..
|
|||
|
||||
#### Uninstalling an older version
|
||||
|
||||
If you have installed an older version of the Python Connector, please uninstall it beforehand.
|
||||
If you have installed an older version of the Python client library, please uninstall it beforehand.
|
||||
|
||||
```
|
||||
pip3 uninstall taos taospy
|
||||
```
|
||||
|
||||
:::note
|
||||
Earlier TDengine client software includes the Python connector. If the Python connector is installed from the client package's installation directory, the corresponding Python package name is `taos`. So the above uninstall command includes `taos`, and it doesn't matter if it doesn't exist.
|
||||
Earlier TDengine client software includes the Python client library. If the Python client library is installed from the client package's installation directory, the corresponding Python package name is `taos`. So the above uninstall command includes `taos`, and it doesn't matter if it doesn't exist.
|
||||
|
||||
:::
|
||||
|
||||
|
@ -160,7 +160,7 @@ pip3 install taos-ws-py
|
|||
<Tabs defaultValue="rest">
|
||||
<TabItem value="native" label="native connection">
|
||||
|
||||
For native connection, you need to verify that both the client driver and the Python connector itself are installed correctly. The client driver and Python connector have been installed properly if you can successfully import the `taos` module. In the Python Interactive Shell, you can type.
|
||||
For native connection, you need to verify that both the client driver and the Python client library itself are installed correctly. The client driver and Python client library have been installed properly if you can successfully import the `taos` module. In the Python Interactive Shell, you can type.
|
||||
|
||||
```python
|
||||
import taos
|
||||
|
@ -202,7 +202,7 @@ Requirement already satisfied: taospy in c:\users\username\appdata\local\program
|
|||
|
||||
### Connectivity testing
|
||||
|
||||
Before establishing a connection with the connector, we recommend testing the connectivity of the local TDengine CLI to the TDengine cluster.
|
||||
Before establishing a connection with the client library, we recommend testing the connectivity of the local TDengine CLI to the TDengine cluster.
|
||||
|
||||
<Tabs defaultValue="rest">
|
||||
<TabItem value="native" label="native connection">
|
||||
|
@ -444,7 +444,7 @@ The best practice for TaosCursor is to create a cursor at the beginning of a que
|
|||
|
||||
##### Use of the RestClient class
|
||||
|
||||
The `RestClient` class is a direct wrapper for the [REST API](../../rest-api). It contains only a `sql()` method for executing arbitrary SQL statements and returning the result.
|
||||
The `RestClient` class is a direct wrapper for the [REST API](../../reference/rest-api). It contains only a `sql()` method for executing arbitrary SQL statements and returning the result.
|
||||
|
||||
```python title="Use of RestClient"
|
||||
{{#include docs/examples/python/rest_client_example.py}}
|
||||
|
@ -501,7 +501,7 @@ The queried results can only be fetched once. For example, only one of `fetch_al
|
|||
|
||||
<TabItem value="rest" label="REST connection">
|
||||
|
||||
The `RestClient` class is a direct wrapper for the [REST API](../../rest-api). It contains only a `sql()` method for executing arbitrary SQL statements and returning the result.
|
||||
The `RestClient` class is a direct wrapper for the [REST API](../../reference/rest-api). It contains only a `sql()` method for executing arbitrary SQL statements and returning the result.
|
||||
|
||||
```python
|
||||
{{#include docs/examples/python/rest_client_example.py}}
|
||||
|
@ -561,7 +561,7 @@ The `TaosConnection` class and the `TaosResult` class already implement all the
|
|||
|
||||
##### Use of the RestClient class
|
||||
|
||||
The `RestClient` class is a direct wrapper for the [REST API](../../rest-api). It contains only a `sql()` method for executing arbitrary SQL statements and returning the result.
|
||||
The `RestClient` class is a direct wrapper for the [REST API](../../reference/rest-api). It contains only a `sql()` method for executing arbitrary SQL statements and returning the result.
|
||||
|
||||
```python title="Use of RestClient"
|
||||
{{#include docs/examples/python/rest_client_with_req_id_example.py}}
|
||||
|
@ -624,7 +624,7 @@ As the way to connect introduced above but add `req_id` argument.
|
|||
|
||||
### Writing data via parameter binding
|
||||
|
||||
The Python connector provides a parameter binding api for inserting data. Similar to most databases, TDengine currently only supports the question mark `?` to indicate the parameters to be bound.
|
||||
The Python client library provides a parameter binding api for inserting data. Similar to most databases, TDengine currently only supports the question mark `?` to indicate the parameters to be bound.
|
||||
|
||||
<Tabs>
|
||||
<TabItem value="native" label="native connection">
|
||||
|
@ -755,7 +755,7 @@ stmt.close()
|
|||
|
||||
### Schemaless Writing
|
||||
|
||||
Connector support schemaless insert.
|
||||
Client library support schemaless insert.
|
||||
|
||||
<Tabs defaultValue="list">
|
||||
<TabItem value="list" label="List Insert">
|
||||
|
@ -817,11 +817,11 @@ There is a optional parameter called `req_id` in `schemaless_insert` and `schema
|
|||
|
||||
### Data Subscription
|
||||
|
||||
Connector support data subscription. For more information about subscroption, please refer to [Data Subscription](../../../develop/tmq/).
|
||||
Client library support data subscription. For more information about subscroption, please refer to [Data Subscription](../../develop/tmq/).
|
||||
|
||||
#### Create a Topic
|
||||
|
||||
To create topic, please refer to [Data Subscription](../../../develop/tmq/#create-a-topic).
|
||||
To create topic, please refer to [Data Subscription](../../develop/tmq/#create-a-topic).
|
||||
|
||||
#### Create a Consumer
|
||||
|
||||
|
@ -829,7 +829,7 @@ To create topic, please refer to [Data Subscription](../../../develop/tmq/#creat
|
|||
|
||||
<TabItem value="native" label="native connection">
|
||||
|
||||
The consumer in the connector contains the subscription api. The syntax for creating a consumer is consumer = Consumer(configs). For more subscription api parameters, please refer to [Data Subscription](../../../develop/tmq/#create-a-consumer).
|
||||
The consumer in the client library contains the subscription api. The syntax for creating a consumer is consumer = Consumer(configs). For more subscription api parameters, please refer to [Data Subscription](../../develop/tmq/#create-a-consumer).
|
||||
|
||||
```python
|
||||
from taos.tmq import Consumer
|
||||
|
@ -840,9 +840,9 @@ consumer = Consumer({"group.id": "local", "td.connect.ip": "127.0.0.1"})
|
|||
|
||||
<TabItem value="websocket" label="WebSocket connection">
|
||||
|
||||
In addition to native connections, the connector also supports subscriptions via websockets.
|
||||
In addition to native connections, the client library also supports subscriptions via websockets.
|
||||
|
||||
The syntax for creating a consumer is "consumer = consumer = Consumer(conf=configs)". You need to specify that the `td.connect.websocket.scheme` parameter is set to "ws" in the configuration. For more subscription api parameters, please refer to [Data Subscription](../../../develop/tmq/#create-a-consumer).
|
||||
The syntax for creating a consumer is "consumer = consumer = Consumer(conf=configs)". You need to specify that the `td.connect.websocket.scheme` parameter is set to "ws" in the configuration. For more subscription api parameters, please refer to [Data Subscription](../../develop/tmq/#create-a-consumer).
|
||||
|
||||
```python
|
||||
import taosws
|
||||
|
@ -1025,7 +1025,7 @@ consumer.close()
|
|||
|
||||
### About nanoseconds
|
||||
|
||||
Due to the current imperfection of Python's nanosecond support (see link below), the current implementation returns integers at nanosecond precision instead of the `datetime` type produced by `ms` and `us`, which application developers will need to handle on their own. And it is recommended to use pandas' to_datetime(). The Python Connector may modify the interface in the future if Python officially supports nanoseconds in full.
|
||||
Due to the current imperfection of Python's nanosecond support (see link below), the current implementation returns integers at nanosecond precision instead of the `datetime` type produced by `ms` and `us`, which application developers will need to handle on their own. And it is recommended to use pandas' to_datetime(). The Python client library may modify the interface in the future if Python officially supports nanoseconds in full.
|
||||
|
||||
1. https://stackoverflow.com/questions/10611328/parsing-datetime-strings-containing-nanoseconds
|
||||
2. https://www.python.org/dev/peps/pep-0564/
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
title: TDengine Node.js Connector
|
||||
title: TDengine Node.js Client Library
|
||||
sidebar_label: Node.js
|
||||
description: This document describes the TDengine Node.js connector.
|
||||
description: This document describes the TDengine Node.js client library.
|
||||
toc_max_heading_level: 4
|
||||
---
|
||||
|
||||
|
@ -9,22 +9,22 @@ import Tabs from "@theme/Tabs";
|
|||
import TabItem from "@theme/TabItem";
|
||||
|
||||
import Preparition from "./_preparation.mdx";
|
||||
import NodeInsert from "../../07-develop/03-insert-data/_js_sql.mdx";
|
||||
import NodeInfluxLine from "../../07-develop/03-insert-data/_js_line.mdx";
|
||||
import NodeOpenTSDBTelnet from "../../07-develop/03-insert-data/_js_opts_telnet.mdx";
|
||||
import NodeOpenTSDBJson from "../../07-develop/03-insert-data/_js_opts_json.mdx";
|
||||
import NodeQuery from "../../07-develop/04-query-data/_js.mdx";
|
||||
import NodeInsert from "../07-develop/03-insert-data/_js_sql.mdx";
|
||||
import NodeInfluxLine from "../07-develop/03-insert-data/_js_line.mdx";
|
||||
import NodeOpenTSDBTelnet from "../07-develop/03-insert-data/_js_opts_telnet.mdx";
|
||||
import NodeOpenTSDBJson from "../07-develop/03-insert-data/_js_opts_json.mdx";
|
||||
import NodeQuery from "../07-develop/04-query-data/_js.mdx";
|
||||
|
||||
`@tdengine/client` and `@tdengine/rest` are the official Node.js connectors. Node.js developers can develop applications to access TDengine instance data. Note: The connectors for TDengine 3.0 are different than those for TDengine 2.x. The new connectors do not support TDengine 2.x.
|
||||
`@tdengine/client` and `@tdengine/rest` are the official Node.js client libraries. Node.js developers can develop applications to access TDengine instance data. Note: The client libraries for TDengine 3.0 are different than those for TDengine 2.x. The new client libraries do not support TDengine 2.x.
|
||||
|
||||
`@tdengine/client` is **native connection**, which connects to TDengine instances natively through the TDengine client driver (taosc), supporting data writing, querying, subscriptions, schemaless writing, and bind interface. `@tdengine/rest` is the **REST connection**, which connects to TDengine instances via the REST interface provided by taosAdapter. The REST connector can run on any platform, but performance is slightly degraded, and the interface implements a somewhat different set of functional features than the native interface.
|
||||
`@tdengine/client` is **native connection**, which connects to TDengine instances natively through the TDengine client driver (taosc), supporting data writing, querying, subscriptions, schemaless writing, and bind interface. `@tdengine/rest` is the **REST connection**, which connects to TDengine instances via the REST interface provided by taosAdapter. The REST client library can run on any platform, but performance is slightly degraded, and the interface implements a somewhat different set of functional features than the native interface.
|
||||
|
||||
The source code for the Node.js connectors is located on [GitHub](https://github.com/taosdata/taos-connector-node/tree/3.0).
|
||||
The source code for the Node.js client libraries is located on [GitHub](https://github.com/taosdata/taos-connector-node/tree/3.0).
|
||||
|
||||
## Supported platforms
|
||||
|
||||
The platforms supported by the native connector are the same as those supported by the TDengine client driver.
|
||||
The REST connector supports all platforms that can run Node.js.
|
||||
The platforms supported by the native client library are the same as those supported by the TDengine client driver.
|
||||
The REST client library supports all platforms that can run Node.js.
|
||||
|
||||
## Version support
|
||||
|
||||
|
@ -34,7 +34,7 @@ Please refer to [version support list](../#version-support)
|
|||
|
||||
|
||||
<Tabs defaultValue="native">
|
||||
<TabItem value="native" label="Native connector">
|
||||
<TabItem value="native" label="Native connection">
|
||||
|
||||
1. Connection Management
|
||||
2. General Query
|
||||
|
@ -44,7 +44,7 @@ Please refer to [version support list](../#version-support)
|
|||
6. Schemaless
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="rest" label="REST connector">
|
||||
<TabItem value="rest" label="REST connection">
|
||||
|
||||
1. Connection Management
|
||||
2. General Query
|
||||
|
@ -58,7 +58,7 @@ Please refer to [version support list](../#version-support)
|
|||
### Pre-installation preparation
|
||||
|
||||
- Install the Node.js development environment
|
||||
- If you are using the REST connector, skip this step. However, if you use the native connector, please install the TDengine client driver. Please refer to [Install Client Driver](../#Install-Client-Driver) for more details. We use [node-gyp](https://github.com/nodejs/node-gyp) to interact with TDengine instances and also need to install some dependencies mentioned below depending on the specific OS.
|
||||
- If you are using the REST client library, skip this step. However, if you use the native client library, please install the TDengine client driver. Please refer to [Install Client Driver](../#Install-Client-Driver) for more details. We use [node-gyp](https://github.com/nodejs/node-gyp) to interact with TDengine instances and also need to install some dependencies mentioned below depending on the specific OS.
|
||||
|
||||
<Tabs defaultValue="Linux">
|
||||
<TabItem value="Linux" label="Linux system installation dependencies">
|
||||
|
@ -103,14 +103,14 @@ If using ARM64 Node.js on Windows 10 ARM, you must add "Visual C++ compilers and
|
|||
### Install via npm
|
||||
|
||||
<Tabs defaultValue="install_rest">
|
||||
<TabItem value="install_native" label="Install native connector">
|
||||
<TabItem value="install_native" label="Install native clieny library">
|
||||
|
||||
```bash
|
||||
npm install @tdengine/client
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="install_rest" label="Install REST connector">
|
||||
<TabItem value="install_rest" label="Install REST client library">
|
||||
|
||||
```bash
|
||||
npm install @tdengine/rest
|
||||
|
@ -122,7 +122,7 @@ npm install @tdengine/rest
|
|||
### Verify
|
||||
|
||||
<Tabs defaultValue="native">
|
||||
<TabItem value="native" label="Native connector">
|
||||
<TabItem value="native" label="Native client library">
|
||||
|
||||
After installing the TDengine client, use the `nodejsChecker.js` program to verify that the current environment supports Node.js access to TDengine.
|
||||
|
||||
|
@ -141,7 +141,7 @@ node nodejsChecker.js host=localhost
|
|||
- After executing the above steps, the command-line will output the result of `nodejsChecker.js` connecting to the TDengine instance and performing a simple insert and query.
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="rest" label="REST connector">
|
||||
<TabItem value="rest" label="REST client library">
|
||||
|
||||
After installing the TDengine client, use the `restChecker.js` program to verify that the current environment supports Node.js access to TDengine.
|
||||
|
||||
|
@ -164,7 +164,7 @@ node restChecker.js
|
|||
|
||||
## Establishing a connection
|
||||
|
||||
Please choose to use one of the connectors.
|
||||
Please choose to use one of the client libraries.
|
||||
|
||||
<Tabs defaultValue="rest">
|
||||
<TabItem value="native" label="native connection">
|
||||
|
@ -288,7 +288,7 @@ let cursor = conn.cursor();
|
|||
| [schemless insert](https://github.com/taosdata/taos-connector-node/blob/3.0/nodejs/examples/schemaless.js) | Schemaless insert |
|
||||
| [TMQ](https://github.com/taosdata/taos-connector-node/blob/3.0/nodejs/examples/tmq.js) | Using data subscription |
|
||||
| [asyncQuery](https://github.com/taosdata/taos-connector-node/blob/3.0/nodejs/examples/asyncQueryExample.js) | Using asynchronous queries |
|
||||
| [REST](https://github.com/taosdata/taos-connector-node/blob/3.0/typescript-rest/example/example.ts) | Using TypeScript with the REST connector |
|
||||
| [REST](https://github.com/taosdata/taos-connector-node/blob/3.0/typescript-rest/example/example.ts) | Using TypeScript with the REST client library |
|
||||
|
||||
## Usage limitations
|
||||
|
||||
|
@ -316,7 +316,7 @@ let cursor = conn.cursor();
|
|||
|
||||
## Important update records
|
||||
|
||||
### Native connectors
|
||||
### Native client library
|
||||
|
||||
| package name | version | TDengine version | Description |
|
||||
|------------------|---------|---------------------|------------------------------------------------------------------|
|
||||
|
@ -324,7 +324,7 @@ let cursor = conn.cursor();
|
|||
| td2.0-connector | 2.0.12 | 2.4.x; 2.5.x; 2.6.x | Fixed cursor.close() bug. |
|
||||
| td2.0-connector | 2.0.11 | 2.4.x; 2.5.x; 2.6.x | Supports parameter binding, JSON tags and schemaless interface |
|
||||
| td2.0-connector | 2.0.10 | 2.4.x; 2.5.x; 2.6.x | Supports connection management, standard queries, connection queries, system information, and data subscription |
|
||||
### REST Connector
|
||||
### REST client library
|
||||
|
||||
| package name | version | TDengine version | Description |
|
||||
|----------------------|---------|---------------------|---------------------------------------------------------------------------|
|
||||
|
@ -334,6 +334,3 @@ let cursor = conn.cursor();
|
|||
| td2.0-rest-connector | 1.0.5 | 2.4.x; 2.5.x; 2.6.x | Support cloud token |
|
||||
| td2.0-rest-connector | 1.0.3 | 2.4.x; 2.5.x; 2.6.x | Supports connection management, standard queries, system information, error information, and continuous queries |
|
||||
|
||||
## API Reference
|
||||
|
||||
[API Reference](https://docs.taosdata.com/api/td2.0-connector/)
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
title: TDengine C# Connector
|
||||
title: TDengine C# Client Library
|
||||
sidebar_label: C#
|
||||
description: This document describes the TDengine C# connector.
|
||||
description: This document describes the TDengine C# client library.
|
||||
toc_max_heading_level: 4
|
||||
---
|
||||
|
||||
|
@ -509,7 +509,7 @@ namespace NativeStmt
|
|||
stmt.AddBatch();
|
||||
stmt.Exec();
|
||||
var affected = stmt.Affected();
|
||||
Console.WriteLine($"affected rows: {affected}");
|
||||
Console.WriteLine($"affected rows: {affected}");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -554,7 +554,7 @@ namespace WSStmt
|
|||
stmt.AddBatch();
|
||||
stmt.Exec();
|
||||
var affected = stmt.Affected();
|
||||
Console.WriteLine($"affected rows: {affected}");
|
||||
Console.WriteLine($"affected rows: {affected}");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -950,7 +950,7 @@ namespace NativeSubscription
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void InsertData()
|
||||
{
|
||||
var builder = new ConnectionStringBuilder("host=localhost;port=6030;username=root;password=taosdata");
|
||||
|
@ -1033,7 +1033,7 @@ namespace WSSubscription
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void InsertData()
|
||||
{
|
||||
var builder = new ConnectionStringBuilder("protocol=WebSocket;host=localhost;port=6041;useSSL=false;username=root;password=taosdata");
|
|
@ -0,0 +1,75 @@
|
|||
---
|
||||
sidebar_label: ODBC
|
||||
title: TDengine ODBC
|
||||
---
|
||||
|
||||
|
||||
## Introduction
|
||||
|
||||
TDengine ODBC driver is a driver specifically designed for TDengine based on the ODBC standard. It can be used by ODBC based applications on Windows to access a local or remote TDengine cluster or TDengine cloud service, like [PowerBI](https://powerbi.microsoft.com).
|
||||
|
||||
TDengine ODBC provides two kinds of connections, native connection and WebSocket connection. You can choose to use either one for your convenience, WebSocket is recommded choice and you must use WebSocket if you are trying to access TDengine cloud service.
|
||||
|
||||
Note: TDengine ODBC driver can only be run on 64-bit system, and can only be invoked by 64-bit applications.
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
1. TDengine ODBC driver supports only Windows platform. To run on Windows, VisualStudio C Runtime library is required. If VisualStudio C Runtime Library is missing on your platform, you can download and install it from [VC Runtime Library](https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170).
|
||||
|
||||
2. Install TDengine client package for Windows, the version should be above 3.2.1.0, the client package includes both TDengine ODBC driver and some other necessary libraries that will be used in either native connection or WebSocket connection.
|
||||
|
||||
## Configure Data Source
|
||||
|
||||
### Connection Types
|
||||
|
||||
TDengine ODBC driver supports two kinds of connections to TDengine cluster, native connection and WebSocket connection, here is the major differences between them.
|
||||
|
||||
1. Only WebSocket can connect to TDengine cloud service.
|
||||
|
||||
2. Websocket connection is more compatible with different TDengine server versions, normally you don't need to uupgrade client package with the server side.
|
||||
|
||||
3. Native connection normally has better performance, but you need to keep the version aligned with the server side.
|
||||
|
||||
4. For most users, it's recommended to use **WebSocket** connection, which has much better compatibility and almost same performance as native connection.
|
||||
|
||||
### WebSocket Connection
|
||||
|
||||
1. Click the "Start" Menu, and Search for "ODBC", and choose "ODBC Data Source (64-bit)" (Note: Don't choose 32-bit)
|
||||
|
||||
2. Select "User DSN" tab, and click "Add" to enter the page for "Create Data Source"
|
||||
|
||||
3. Choose the data source to be added, here we choose "TDengine"
|
||||
|
||||
4. Click "Finish", and enter the configuration page for "TDengine ODBC Data Source", fill in required fields
|
||||
|
||||

|
||||
|
||||
4.1 [DSN]: Data Source Name, required field, to name the new ODBC data source
|
||||
|
||||
4.2 [Connection Type]: required field, we choose "WebSocket"
|
||||
|
||||
4.3 [URL]: required field, the URL for the ODBC data source, for example, `http://localhost:6041` is the URL for a local TDengine cluster, `https://gw.cloud.taosdata.com?token=your_token` is the URL for a TDengine cloud service.
|
||||
|
||||
4.4 [Database]: optional field, the default database to access
|
||||
|
||||
4.5 [User]: optional field, only used for connection testing in step 5; If it's left as blank, "root" user will be used by default.
|
||||
|
||||
4.6 [Password]: optional field, only used for connection testing in step 5;
|
||||
|
||||
5. Click "Test Connecting" to test whether the data source can be connectted; if successful, it will prompt "connecting success"
|
||||
|
||||
6. Click "OK" to sae the configuration and exit.
|
||||
|
||||
7. You can also select an already configured data source name in step 2 to change existing configuration.
|
||||
|
||||
### Native Connection
|
||||
|
||||
Please be noted that native connection can't be used to access a TDengine client service.
|
||||
|
||||
The steps are exactly same as "WebSocket" connection, except for you choose "Native" in step 4.2.
|
||||
|
||||
|
||||
## PowerBI
|
||||
|
||||
As an example, you can use PowerBI, which inovkes TDengine ODBC driver, to access TDengine, please refer to[Power BI](../../third-party/powerbi) for more details.
|
|
@ -1,13 +1,13 @@
|
|||
---
|
||||
toc_max_heading_level: 4
|
||||
sidebar_label: R
|
||||
title: R Language Connector
|
||||
title: R Language Client Library
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
import Rdemo from "../../07-develop/01-connect/_connect_r.mdx"
|
||||
import Rdemo from "../07-develop/01-connect/_connect_r.mdx"
|
||||
|
||||
By using the RJDBC library in R, you can enable R programs to access TDengine data. Here are the installation process, configuration steps, and an example code in R.
|
||||
|
|
@ -1,12 +1,12 @@
|
|||
---
|
||||
title: PHP Connector
|
||||
title: PHP Client Library
|
||||
sidebar_label: PHP
|
||||
description: This document describes the TDengine PHP connector.
|
||||
description: This document describes the TDengine PHP client library.
|
||||
---
|
||||
|
||||
`php-tdengine` is the TDengine PHP connector provided by TDengine community. In particular, it supports Swoole coroutine.
|
||||
`php-tdengine` is the TDengine PHP client library provided by TDengine community. In particular, it supports Swoole coroutine.
|
||||
|
||||
PHP Connector relies on TDengine client driver.
|
||||
PHP client library relies on TDengine client driver.
|
||||
|
||||
Project Repository: <https://github.com/Yurunsoft/php-tdengine>
|
||||
|
||||
|
@ -81,7 +81,7 @@ Option Two: Use CLI `php -dextension=tdengine test.php`.
|
|||
|
||||
## Sample Programs
|
||||
|
||||
In this section a few sample programs which use TDengine PHP connector to access TDengine cluster are demonstrated.
|
||||
In this section a few sample programs which use TDengine PHP client library to access TDengine cluster are demonstrated.
|
||||
|
||||
> Any error would throw exception: `TDengine\Exception\TDengineException`
|
||||
|
|
@ -0,0 +1 @@
|
|||
label: "Client Libraries"
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
:::info
|
||||
|
||||
Since the TDengine client driver is written in C, using the native connection requires loading the client driver shared library file, which is usually included in the TDengine installer. You can install either standard TDengine server installation package or [TDengine client installation package](../../get-started/). For Windows development, you need to install the corresponding Windows client, please refer to [Install TDengine](../../get-started/package).
|
||||
Since the TDengine client driver is written in C, using the native connection requires loading the client driver shared library file, which is usually included in the TDengine installer. You can install either standard TDengine server installation package or [TDengine client installation package](../get-started/). For Windows development, you need to install the corresponding Windows client, please refer to [Install TDengine](../../get-started/package).
|
||||
|
||||
- libtaos.so: After successful installation of TDengine on a Linux system, the dependent Linux version of the client driver `libtaos.so` file will be automatically linked to `/usr/lib/libtaos.so`, which is included in the Linux scannable path and does not need to be specified separately.
|
||||
- taos.dll: After installing the client on Windows, the dependent Windows version of the client driver taos.dll file will be automatically copied to the system default search path C:/Windows/System32, again without the need to specify it separately.
|
After Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
|
@ -1,15 +1,15 @@
|
|||
---
|
||||
title: Connector
|
||||
description: This document describes the connectors that TDengine provides to interface with various programming languages.
|
||||
title: Client Libraries
|
||||
description: This document describes the client libraries that TDengine provides to interface with various programming languages.
|
||||
---
|
||||
|
||||
TDengine provides a rich set of APIs (application development interface). To facilitate users to develop their applications quickly, TDengine supports connectors for multiple programming languages, including official connectors for C/C++, Java, Python, Go, Node.js, C#, and Rust. These connectors support connecting to TDengine clusters using both native interfaces (taosc) and REST interfaces (not supported in a few languages yet). Community developers have also contributed several unofficial connectors, such as the ADO.NET connector, the Lua connector, and the PHP connector.
|
||||
TDengine provides a rich set of APIs (application development interface). To facilitate users to develop their applications quickly, TDengine supports client libraries for multiple programming languages, including official libraries for C/C++, Java, Python, Go, Node.js, C#, and Rust. These client libraries support connecting to TDengine clusters using both native interfaces (taosc) and REST interfaces (not supported in a few languages yet). Community developers have also contributed several unofficial client libraries, such as the ADO.NET, Lua, and PHP libraries.
|
||||
|
||||

|
||||

|
||||
|
||||
## Supported platforms
|
||||
|
||||
Currently, TDengine's native interface connectors can support platforms such as x64 and ARM hardware platforms and Linux/Windows/macOS development environments. The comparison matrix is as follows.
|
||||
Currently, TDengine's native interface client libraries can support platforms such as x64 and ARM hardware platforms and Linux/Windows/macOS development environments. The comparison matrix is as follows.
|
||||
|
||||
| **CPU** | **OS** | **Java** | **Python** | **Go** | **Node.js** | **C#** | **Rust** | C/C++ |
|
||||
| -------------- | --------- | -------- | ---------- | ------ | ----------- | ------ | -------- | ----- |
|
||||
|
@ -25,7 +25,7 @@ Using REST connection can support a broader range of operating systems as it doe
|
|||
|
||||
## Version support
|
||||
|
||||
TDengine version updates often add new features, and the connector versions in the list are the best-fit versions of the connector.
|
||||
TDengine version updates often add new features, and the client library versions in the list are the best-fit versions of the library.
|
||||
|
||||
| **TDengine Versions** | **Java** | **Python** | **Go** | **C#** | **Node.js** | **Rust** |
|
||||
| --------------------------- | -------------- | -------------- | -------------- | ------------- | --------------- | --------------- |
|
||||
|
@ -37,7 +37,7 @@ TDengine version updates often add new features, and the connector versions in t
|
|||
|
||||
## Functional Features
|
||||
|
||||
Comparing the connector support for TDengine functional features as follows.
|
||||
Comparing the client library support for TDengine functional features as follows.
|
||||
|
||||
### Using the native interface (taosc)
|
||||
|
||||
|
@ -66,7 +66,7 @@ The different database framework specifications for various programming language
|
|||
|
||||
:::warning
|
||||
|
||||
- Regardless of the programming language chosen for the connector, TDengine versions 2.0 and above recommend that each thread of a database application create a separate connection. Or create a connection pool based on threads to avoid interference between threads with the "USE statement" state within a connection (but the connection's query and write operations are thread-safe).
|
||||
- Regardless of the programming language chosen for the client library, TDengine versions 2.0 and above recommend that each thread of a database application create a separate connection. Or create a connection pool based on threads to avoid interference between threads with the "USE statement" state within a connection (but the connection's query and write operations are thread-safe).
|
||||
|
||||
:::
|
||||
|
||||
|
@ -82,7 +82,7 @@ import VerifyMacOS from "./_verify_macos.mdx";
|
|||
## Install Client Driver
|
||||
|
||||
:::info
|
||||
The client driver needs to be installed if you use the native interface connector on a system that does not have the TDengine server software installed.
|
||||
The client driver needs to be installed if you use the native interface connection on a system that does not have the TDengine server software installed.
|
||||
|
||||
:::
|
||||
|
Before Width: | Height: | Size: 73 KiB After Width: | Height: | Size: 73 KiB |
|
@ -21,6 +21,7 @@ docker run -d --name tdengine \
|
|||
* /var/lib/taos: TDengine's default data file directory. The location can be changed via [configuration file]. And also you can modify ~/data/taos/dnode/data to your any other local emtpy data directory
|
||||
* /var/log/taos: TDengine's default log file directory. The location can be changed via [configure file]. And also you can modify ~/data/taos/dnode/log to your any other local empty log directory
|
||||
|
||||
|
||||
:::
|
||||
|
||||
The above command starts a container named "tdengine" and maps the HTTP service port 6041 to the host port 6041. You can verify that the HTTP service provided in this container is available using the following command.
|
||||
|
@ -42,7 +43,7 @@ taos> show databases;
|
|||
Query OK, 2 row(s) in set (0.002843s)
|
||||
```
|
||||
|
||||
The TDengine server running in the container uses the container's hostname to establish a connection. Using TDengine CLI or various connectors (such as JDBC-JNI) to access the TDengine inside the container from outside the container is more complicated. So the above is the simplest way to access the TDengine service in the container and is suitable for some simple scenarios. Please refer to the next section if you want to access the TDengine service in the container from outside the container using TDengine CLI or various connectors for complex scenarios.
|
||||
The TDengine server running in the container uses the container's hostname to establish a connection. Using TDengine CLI or various client libraries (such as JDBC-JNI) to access the TDengine inside the container from outside the container is more complicated. So the above is the simplest way to access the TDengine service in the container and is suitable for some simple scenarios. Please refer to the next section if you want to access the TDengine service in the container from outside the container using TDengine CLI or various client libraries for complex scenarios.
|
||||
|
||||
## Start TDengine on the host network
|
||||
|
||||
|
@ -83,7 +84,7 @@ Next, ensure the hostname "tdengine" is resolvable in `/etc/hosts`.
|
|||
echo 127.0.0.1 tdengine |sudo tee -a /etc/hosts
|
||||
```
|
||||
|
||||
Finally, the TDengine service can be accessed from the TDengine CLI or any connector with "tdengine" as the server address.
|
||||
Finally, the TDengine service can be accessed from the TDengine CLI or any client library with "tdengine" as the server address.
|
||||
|
||||
```shell
|
||||
taos -h tdengine -P 6030
|
||||
|
@ -324,6 +325,7 @@ services:
|
|||
- The `VERSION` environment variable is used to set the tdengine image tag
|
||||
- `TAOS_FIRST_EP` must be set on the newly created instance so that it can join the TDengine cluster; if there is a high availability requirement, `TAOS_SECOND_EP` needs to be used at the same time
|
||||
|
||||
|
||||
:::
|
||||
|
||||
2. Start the cluster
|
||||
|
|
|
@ -46,6 +46,7 @@ database_option: {
|
|||
- last_row: The last row of each subtable is cached. This option significantly improves the performance of the LAST_ROW function.
|
||||
- last_value: The last non-null value of each column in each subtable is cached. This option significantly improves the performance of the LAST function under normal circumstances, such as statements including the WHERE, ORDER BY, GROUP BY, and INTERVAL keywords.
|
||||
- both: The last row of each subtable and the last non-null value of each column in each subtable are cached.
|
||||
Note: If you turn on cachemodel, then turn off, and turn on again, the result of last/last_row may be wrong, don't do like this, it's strongly recommended to always turn on the cache using "both".
|
||||
- CACHESIZE: specifies the amount (in MB) of memory used for subtable caching on each vnode. Enter a value between 1 and 65536. The default value is 1.
|
||||
- COMP: specifies how databases are compressed. The default value is 2.
|
||||
- 0: Compression is disabled.
|
||||
|
@ -137,6 +138,10 @@ You can use `show <db_name>.vgroups;` to check the value of cacheload.
|
|||
|
||||
If the value of `cacheload` is very close to the value of `cachesize`, then it's very probably that `cachesize` is too small. If the value of `cacheload` is much smaller than the value of `cachesize`, then `cachesize` is big enough. You can use this simple principle to determine. Depending on how much memory is available in your system, you can choose to double `cachesize` or incrase it by even 5 or more times.
|
||||
|
||||
4. stt_trigger
|
||||
|
||||
Pleae make sure stopping data writing before trying to alter stt_trigger parameter.
|
||||
|
||||
:::note
|
||||
Other parameters cannot be modified after the database has been created.
|
||||
|
||||
|
|
|
@ -158,8 +158,8 @@ Automatically creating table and the table name is specified through the `tbname
|
|||
|
||||
```sql
|
||||
INSERT INTO meters(tbname, location, groupId, ts, current, phase)
|
||||
values('d31001', 'California.SanFrancisco', 2, '2021-07-13 14:06:34.630', 10.2, 0.32)
|
||||
('d31001', 'California.SanFrancisco', 2, '2021-07-13 14:06:35.779', 10.15, 0.33)
|
||||
('d31002', NULL, 2, '2021-07-13 14:06:34.255', 10.15, 0.33)
|
||||
values('d31001', 'California.SanFrancisco', 2, '2021-07-13 14:06:34.630', 10.2, 219, 0.32)
|
||||
('d31001', 'California.SanFrancisco', 2, '2021-07-13 14:06:35.779', 10.15, 217, 0.33)
|
||||
('d31002', NULL, 2, '2021-07-13 14:06:34.255', 10.15, 217, 0.33)
|
||||
```
|
||||
|
||||
|
|
|
@ -259,7 +259,11 @@ The GROUP BY clause does not guarantee that the results are ordered. If you want
|
|||
|
||||
## PARTITION BY
|
||||
|
||||
The PARTITION BY clause is a TDengine-specific extension to standard SQL. This clause partitions data based on the part_list and performs computations per partition.
|
||||
The PARTITION BY clause is a TDengine-specific extension to standard SQL introduced in TDengine 3.0. This clause partitions data based on the part_list and performs computations per partition.
|
||||
|
||||
PARTITION BY and GROUP BY have similar meanings. They both group data according to a specified list and then perform calculations. The difference is that PARTITION BY does not have various restrictions on the SELECT list of the GROUP BY clause. Any operation can be performed within the group (constants, aggregations, scalars, expressions, etc.). Therefore, PARTITION BY is fully compatible with GROUP BY in terms of usage. All places that use the GROUP BY clause can be replaced with PARTITION BY.
|
||||
|
||||
Because PARTITION BY does not require returning a row of aggregated data, it can also support various window operations after grouping slices. All window operations that need to be grouped can only use the PARTITION BY clause.
|
||||
|
||||
For more information, see TDengine Extensions.
|
||||
|
||||
|
|
|
@ -626,9 +626,9 @@ TIMEDIFF(expr1, expr2 [, time_unit])
|
|||
#### TIMETRUNCATE
|
||||
|
||||
```sql
|
||||
TIMETRUNCATE(expr, time_unit [, ignore_timezone])
|
||||
TIMETRUNCATE(expr, time_unit [, use_current_timezone])
|
||||
|
||||
ignore_timezone: {
|
||||
use_current_timezone: {
|
||||
0
|
||||
| 1
|
||||
}
|
||||
|
@ -647,10 +647,11 @@ ignore_timezone: {
|
|||
1b (nanoseconds), 1u (microseconds), 1a (milliseconds), 1s (seconds), 1m (minutes), 1h (hours), 1d (days), or 1w (weeks)
|
||||
- The precision of the returned timestamp is same as the precision set for the current data base in use
|
||||
- If the input data is not formatted as a timestamp, the returned value is null.
|
||||
- If `1d` is used as `time_unit` to truncate the timestamp, `ignore_timezone` option can be set to indicate if the returned result is affected by client timezone or not.
|
||||
For example, if client timezone is set to UTC+0800, TIMETRUNCATE('2020-01-01 23:00:00', 1d, 0) will return '2020-01-01 08:00:00'.
|
||||
Otherwise, TIMETRUNCATE('2020-01-01 23:00:00', 1d, 1) will return '2020-01-01 00:00:00'.
|
||||
If `ignore_timezone` option is omitted, the default value is set to 1.
|
||||
- When using 1d/1w as the time unit to truncate timestamp, you can specify whether to truncate based on the current time zone by setting the use_current_timezone parameter.
|
||||
Value 0 indicates truncation using the UTC time zone, value 1 indicates truncation using the current time zone.
|
||||
For example, if the time zone configured by the Client is UTC + 0800, TIMETRUNCATE ('2020-01-01 23:00:00', 1d, 0) returns the result of '2020-01-01 08:00:00'.
|
||||
When using TIMETRUNCATE ('2020-01-01 23:00:00', 1d, 1), the result is 2020-01-01 00:00:00 '.
|
||||
When use_current_timezone is not specified, use_current_timezone defaults to 1.
|
||||
|
||||
#### TIMEZONE
|
||||
|
||||
|
|
|
@ -16,7 +16,10 @@ When you query a supertable, you may need to partition the supertable by some di
|
|||
PARTITION BY part_list
|
||||
```
|
||||
|
||||
part_list can be any scalar expression, such as a column, constant, scalar function, or a combination of the preceding items.
|
||||
part_list can be any scalar expression, such as a column, constant, scalar function, or a combination of the preceding items. For example, grouping data by label location, taking the average voltage within each group.
|
||||
```sql
|
||||
select location, avg(voltage) from meters partition by location
|
||||
```
|
||||
|
||||
A PARTITION BY clause is processed as follows:
|
||||
|
||||
|
@ -25,10 +28,13 @@ A PARTITION BY clause is processed as follows:
|
|||
- The PARTITION BY clause can be used together with a window clause or GROUP BY clause. In this case, the window or GROUP BY clause takes effect on every partition. For example, the following statement partitions the table by the location tag, performs downsampling over a 10 minute window, and returns the maximum value:
|
||||
|
||||
```sql
|
||||
select max(current) from meters partition by location interval(10m)
|
||||
select _wstart, location, max(current) from meters partition by location interval(10m)
|
||||
```
|
||||
|
||||
The most common usage of PARTITION BY is partitioning the data in subtables by tags then perform computation when querying data in a supertable. More specifically, `PARTITION BY TBNAME` partitions the data of each subtable into a single timeline, and this method facilitates the statistical analysis in many use cases of processing timeseries data.
|
||||
The most common usage of PARTITION BY is partitioning the data in subtables by tags then perform computation when querying data in a supertable. More specifically, `PARTITION BY TBNAME` partitions the data of each subtable into a single timeline, and this method facilitates the statistical analysis in many use cases of processing timeseries data. For example, calculate the average voltage of each meter every 10 minutes£º
|
||||
```sql
|
||||
select _wstart, tbname, avg(voltage) from meters partition by tbname interval(10m)
|
||||
```
|
||||
|
||||
## Windowed Queries
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ The preceding command displays all topics in the current database.
|
|||
|
||||
## Create Consumer Group
|
||||
|
||||
You can create consumer groups only through the TDengine Client driver or the API provided by a connector.
|
||||
You can create consumer groups only through the TDengine Client driver or the API provided by a client library.
|
||||
|
||||
## Delete Consumer Group
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ description: This document describes the TDengine REST API.
|
|||
To support the development of various types of applications and platforms, TDengine provides an API that conforms to REST principles; namely REST API. To minimize the learning cost, unlike REST APIs for other database engines, TDengine allows insertion of SQL commands in the BODY of an HTTP POST request, to operate the database.
|
||||
|
||||
:::note
|
||||
One difference from the native connector is that the REST interface is stateless and so the `USE db_name` command has no effect. All references to table names and super table names need to specify the database name in the prefix. TDengine supports specification of the db_name in RESTful URL. If the database name prefix is not specified in the SQL command, the `db_name` specified in the URL will be used.
|
||||
One difference from the native connection is that the REST interface is stateless and so the `USE db_name` command has no effect. All references to table names and super table names need to specify the database name in the prefix. TDengine supports specification of the db_name in RESTful URL. If the database name prefix is not specified in the SQL command, the `db_name` specified in the URL will be used.
|
||||
:::
|
||||
|
||||
## Installation
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
label: "Connector"
|
|
@ -8,7 +8,7 @@ The TDengine command-line interface (hereafter referred to as `TDengine CLI`) is
|
|||
|
||||
## Installation
|
||||
|
||||
If executed on the TDengine server-side, there is no need for additional installation steps to install TDengine CLI as it is already included and installed automatically. To run TDengine CLI in an environment where no TDengine server is running, the TDengine client installation package needs to be installed first. For details, please refer to [Connector](../connector/).
|
||||
If executed on the TDengine server-side, there is no need for additional installation steps to install TDengine CLI as it is already included and installed automatically. To run TDengine CLI in an environment where no TDengine server is running, the TDengine client installation package needs to be installed first. For details, please refer to [Install Client Driver](../../client-libraries/#install-client-driver).
|
||||
|
||||
## Execution
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: List of supported platforms
|
||||
description: This document describes the supported platforms for the TDengine server, client, and connectors.
|
||||
description: This document describes the supported platforms for the TDengine server, client, and client libraries.
|
||||
---
|
||||
|
||||
## List of supported platforms for TDengine server
|
||||
|
@ -12,9 +12,9 @@ description: This document describes the supported platforms for the TDengine se
|
|||
|
||||
Note: 1) ● means officially tested and verified, ○ means unofficially tested and verified, E means only supported by the enterprise edition. 2) The community edition only supports newer versions of mainstream operating systems, including Ubuntu 18+/CentOS 7+/RetHat/Debian/CoreOS/FreeBSD/OpenSUSE/SUSE Linux/Fedora/macOS, etc. If you have requirements for other operating systems and editions, please contact support of the enterprise edition.
|
||||
|
||||
## List of supported platforms for TDengine clients and connectors
|
||||
## List of supported platforms for TDengine clients and client libraries
|
||||
|
||||
TDengine's connector can support a wide range of platforms, including X64/X86/ARM64/ARM32/MIPS/Alpha/LoongArch64 hardware platforms and Linux/Win64/Win32/macOS development environments.
|
||||
TDengine's client libraries can support a wide range of platforms, including X64/X86/ARM64/ARM32/MIPS/Alpha/LoongArch64 hardware platforms and Linux/Win64/Win32/macOS development environments.
|
||||
|
||||
The comparison matrix is as follows.
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
---
|
||||
title: Reference
|
||||
description: This document describes TDengine connectors and utilities.
|
||||
description: This document describes TDengine utilities.
|
||||
---
|
||||
|
||||
This section describes the TDengine connectors and utilities.
|
||||
This section describes the TDengine utilities.
|
||||
|
||||
```mdx-code-block
|
||||
import DocCardList from '@theme/DocCardList';
|
||||
|
|
|
@ -94,7 +94,7 @@ The output as bellow:
|
|||
|
||||
The role of the TDengine Sink Connector is to synchronize the data of the specified topic to TDengine. Users do not need to create databases and super tables in advance. The name of the target database can be specified manually (see the configuration parameter connection.database), or it can be generated according to specific rules (see the configuration parameter connection.database.prefix).
|
||||
|
||||
TDengine Sink Connector internally uses TDengine [modeless write interface](../../reference/connector/cpp#modeless write-api) to write data to TDengine, currently supports data in three formats: [InfluxDB line protocol format](../../develop/insert-data/influxdb-line), [OpenTSDB Telnet protocol format](../../develop/insert-data/opentsdb-telnet), and [OpenTSDB JSON protocol format](../../develop/insert-data/opentsdb-json).
|
||||
TDengine Sink Connector internally uses TDengine [modeless write interface](../../client-libraries/cpp#modeless write-api) to write data to TDengine, currently supports data in three formats: [InfluxDB line protocol format](../../develop/insert-data/influxdb-line), [OpenTSDB Telnet protocol format](../../develop/insert-data/opentsdb-telnet), and [OpenTSDB JSON protocol format](../../develop/insert-data/opentsdb-json).
|
||||
|
||||
The following example synchronizes the data of the topic meters to the target database power. The data format is the InfluxDB Line protocol format.
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ sidebar_label: JupyterLab
|
|||
description: This document describes how to integrate TDengine with JupyterLab.
|
||||
---
|
||||
|
||||
JupyterLab is the next generation of the ubiquitous Jupyter Notebook. In this note we show you how to install the TDengine Python connector to connect to TDengine in JupyterLab. You can then insert data and perform queries against the TDengine instance within JupyterLab.
|
||||
JupyterLab is the next generation of the ubiquitous Jupyter Notebook. In this note we show you how to install the TDengine Python client library to connect to TDengine in JupyterLab. You can then insert data and perform queries against the TDengine instance within JupyterLab.
|
||||
|
||||
## Install JupyterLab
|
||||
Installing JupyterLab is very easy. Installation instructions can be found at:
|
||||
|
@ -36,8 +36,8 @@ jupyter lab
|
|||
````
|
||||
This will automatically launch your default browser and connect to your JupyterLab instance, usually on port 8888.
|
||||
|
||||
## Install the TDengine Python connector
|
||||
You can now install the TDengine Python connector as follows.
|
||||
## Install the TDengine Python client library
|
||||
You can now install the TDengine Python client library as follows.
|
||||
|
||||
Start a new Python kernel in JupyterLab.
|
||||
|
||||
|
@ -55,8 +55,8 @@ import sys
|
|||
````
|
||||
|
||||
## Connect to TDengine
|
||||
You can find detailed examples to use the Python connector, in the TDengine documentation here.
|
||||
Once you have installed the TDengine Python connector in your JupyterLab kernel, the process of connecting to TDengine is the same as that you would use if you weren't using JupyterLab.
|
||||
You can find detailed examples to use the Python client library, in the TDengine documentation here.
|
||||
Once you have installed the TDengine Python client library in your JupyterLab kernel, the process of connecting to TDengine is the same as that you would use if you weren't using JupyterLab.
|
||||
Each TDengine instance, has a database called "log" which has monitoring information about the TDengine instance.
|
||||
In the "log" database there is a [supertable](https://docs.tdengine.com/taos-sql/stable/) called "disks_info".
|
||||
|
||||
|
@ -96,4 +96,4 @@ result = sqlQuery(conn)
|
|||
print(result)
|
||||
````
|
||||
|
||||
TDengine has connectors for various languages including Node.js, Go, PHP and there are kernels for these languages which can be found [here](https://github.com/jupyter/jupyter/wiki/Jupyter-kernels).
|
||||
TDengine has client libraries for various languages including Node.js, Go, PHP and there are kernels for these languages which can be found [here](https://github.com/jupyter/jupyter/wiki/Jupyter-kernels).
|
||||
|
|
|
@ -19,7 +19,7 @@ To use DBeaver to manage TDengine, you need to prepare the following:
|
|||
|
||||

|
||||
|
||||
2. Configure the TDengine connection by filling in the host address, port number, username, and password. If TDengine is deployed on the local machine, you are only required to fill in the username and password. The default username is root and the default password is taosdata. Click **Test Connection** to check whether the connection is workable. If you do not have the TDengine Java connector installed on the local machine, DBeaver will prompt you to download and install it.
|
||||
2. Configure the TDengine connection by filling in the host address, port number, username, and password. If TDengine is deployed on the local machine, you are only required to fill in the username and password. The default username is root and the default password is taosdata. Click **Test Connection** to check whether the connection is workable. If you do not have the TDengine Java client library installed on the local machine, DBeaver will prompt you to download and install it.
|
||||
|
||||
)
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ To connect TDengine using qStudio, you need to complete the following preparatio
|
|||
|
||||

|
||||
|
||||
2. Configure the TDengine connection by entering the host address, port number, username, and password. If TDengine is deployed on the local machine, you can fill in the username and password only. The default username is "root," and the default password is "taosdata." Click "Test" to test the connection's availability. If the TDengine Java connector is not installed on the local machine, qStudio will prompt you to download and install it.
|
||||
2. Configure the TDengine connection by entering the host address, port number, username, and password. If TDengine is deployed on the local machine, you can fill in the username and password only. The default username is "root," and the default password is "taosdata." Click "Test" to test the connection's availability. If the TDengine Java client library is not installed on the local machine, qStudio will prompt you to download and install it.
|
||||
|
||||

|
||||
|
||||
|
|
|
@ -10,20 +10,20 @@ description: How to use Seeq and TDengine to perform time series data analysis
|
|||
|
||||
Seeq is an advanced analytics software for the manufacturing industry and the Industrial Internet of Things (IIoT). Seeq supports the use of machine learning innovations within process manufacturing organizations. These capabilities enable organizations to deploy their own or third-party machine learning algorithms into advanced analytics applications used by frontline process engineers and subject matter experts, thus extending the efforts of a single data scientist to many frontline workers.
|
||||
|
||||
TDengine can be added as a data source into Seeq via JDBC connector. Once data source is configured, Seeq can read data from TDengine and offers functionalities such as data visualization, analysis, and forecasting.
|
||||
TDengine can be added as a data source into Seeq via JDBC client library. Once data source is configured, Seeq can read data from TDengine and offers functionalities such as data visualization, analysis, and forecasting.
|
||||
|
||||
## Prerequisite
|
||||
|
||||
1. Install Seeq Server and Seeq Data Lab software
|
||||
2. Install TDengine or register TDengine Cloud service
|
||||
|
||||
## Install TDengine JDBC connector
|
||||
## Install TDengine JDBC client library
|
||||
|
||||
1. Get Seeq data location configuration
|
||||
```
|
||||
sudo seeq config get Folders/Data
|
||||
```
|
||||
2. Download the latest TDengine Java connector from maven.org (current is version is [3.2.5](https://repo1.maven.org/maven2/com/taosdata/jdbc/taos-jdbcdriver/3.2.5/taos-jdbcdriver-3.2.5-dist.jar)), and copy the JAR file into the_directory_found_in_step_1/plugins/lib/
|
||||
2. Download the latest TDengine Java client library from maven.org (current is version is [3.2.5](https://repo1.maven.org/maven2/com/taosdata/jdbc/taos-jdbcdriver/3.2.5/taos-jdbcdriver-3.2.5-dist.jar)), and copy the JAR file into the_directory_found_in_step_1/plugins/lib/
|
||||
3. Restart Seeq server
|
||||
```
|
||||
sudo seeq restart
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
---
|
||||
sidebar_label: Power BI
|
||||
title: Power BI
|
||||
description: Use PowerBI and TDengine to analyze time series data
|
||||
---
|
||||
|
||||
## Introduction
|
||||
|
||||
With TDengine ODBC driver, PowerBI can access time series data stored in TDengine. You can import tag data, original time series data, or aggregated data into PowerBI from TDengine, to create reports or dashboard without any coding effort.
|
||||
|
||||
## Steps
|
||||

|
||||
|
||||
### Prerequisites
|
||||
|
||||
1. TDengine server has been installed and running well.
|
||||
2. Power BI Desktop has been installed and running. (If not, please download and install latest Windows X64 version from [PowerBI](https://www.microsoft.com/download/details.aspx?id=58494).
|
||||
|
||||
|
||||
## Install Driver
|
||||
|
||||
Depending on your TDengine server version, download appropriate version of TDengine client package from TDengine website [Download Link](https://docs.taosdata.com/get-started/package/), or TDengine explorer if you are using a local TDengine cluster. Install the TDengine client package on same Windows machine where PowerBI is running.
|
||||
|
||||
### Configure Data Source
|
||||
|
||||
Please refer to [ODBC](../../client-libraries/odbc) to configure TDengine ODBC Driver with WebSocket connection.
|
||||
|
||||
### Import Data from TDengine to Power BI
|
||||
|
||||
1. Open Power BI and logon, add data source following steps "Home Page" -> "Get Data" -> "Others" -> "ODBC" -> "Connect"
|
||||
|
||||
2. Choose data source name, connect to configured data source, go to the nativator, browse tables of the selected database and load data
|
||||
|
||||
3. If you want to input some specific SQL, click "Advanced Options", and input your SQL in the open dialogue box and load the data.
|
||||
|
||||
|
||||
To better use Power BI to analyze the data stored in TDengine, you need to understand the concepts of dimention, metric, time serie, correlation, and use your own SQL to import data.
|
||||
|
||||
1. Dimention: it's normally category (text) data to describe such information as device, collection point, model. In the supertable template of TDengine, we use tag columns to store the dimention information. You can use SQL like `select distinct tbname, tag1, tag2 from supertable` to get dimentions.
|
||||
|
||||
2. Metric: quantitive (numeric) fileds that can be calculated, like SUM, AVERAGE, MINIMUM. If the collecting frequency is 1 second, then there are 31,536,000 records in one year, it will be too low efficient to import so big data into Power BI. In TDengine, you can use data partition query, window partition query, in combination with pseudo columns related to window, to import downsampled data into Power BI. For more details, please refer to [TDengine Specialized Queries](https://docs.taosdata.com/taos-sql/distinguished/)。
|
||||
|
||||
- Window partition query: for example, thermal meters collect one data per second, but you need to query the average temperature every 10 minutes, you can use window subclause to get the downsampling data you need. The corresponding SQL is like `select tbname, _wstart date,avg(temperature) temp from table interval(10m)`, in which _wstart is a pseudo column indicting the start time of a widow, 10m is the duration of the window, `avg(temperature)` indicates the aggregate value inside a window.
|
||||
|
||||
- Data partition query: If you want to get the aggregate value of a lot of thermal meters, you can first partition the data and then perform a series of calculation in the partitioned data spaces. The SQL you need to use is `partition by part_list`. The most common of data partition usage is that when querying a supertable, you can partition data by subtable according to tags to form the data of each subtable into a single time serie to facilitate analytical processing of time series data.
|
||||
|
||||
3. Time Serie: When curve plotting or aggregating data based on time lines, date is normally required. Data or time can be imported from Excel, or retrieved from TDengine using SQL statement like `select _wstart date, count(*) cnt from test.meters where ts between A and B interval(1d) fill(0)`, in which the fill() subclause indicates the fill mode when there is data missing, pseudo column _wstart indicates the date to retrieve.
|
||||
|
||||
4. Correlation: Indicates how to correlate data. Dimentions and Metrics can be correlated by tbname, dates and metrics can be correlated by date. All these can cooperate to form visual reports.
|
||||
|
||||
### Example - Meters
|
||||
|
||||
TDengine has its own specific data model, which uses supertable as template and creates a specific table for each device. Each table can have maximum 4,096 data columns and 128 tags. In the example of meters, assume each meter generates one record per second, then there will be 86,400 records each day and 31,536,000 records every year, then only 1,000 meters will occupy 500GB disk space. So, the common usage of Power BI should be mapping tags to dimention columns, mapping the aggregation of data columns to metric columns, to provide indicators for decision makers.
|
||||
|
||||
1. Import Dimentions
|
||||
|
||||
Import the tags of tables in PowerBI, and name as "tags", the SQL is like `select distinct tbname, groupid, location from test.meters;`.
|
||||
|
||||
2. Import Metrics
|
||||
|
||||
In Power BI, import the average current, average voltage, average phase with 1 hour window, and name it as "data", the SQL is like `select tbname, _wstart ws, avg(current), avg(voltage), avg(phase) from test.meters PARTITION by tbname interval(1h)` .
|
||||
|
||||
3. Correlate Dimentions and Metrics
|
||||
|
||||
In Power BI, open model view, correlate "tags" and "data", and set "tabname" as the correlation column, then you can use the data in histogram, pie chart, etc. For more information about building visual reports in PowerBI, please refer to [Power BI](https://learn.microsoft.com/power-bi/)。
|
After Width: | Height: | Size: 36 KiB |
|
@ -176,7 +176,7 @@ After completing the query, if the data written does not differ from what is exp
|
|||
|
||||
TDengine does not support querying, or data fetching using the OpenTSDB query syntax but does provide a counterpart for each of the OpenTSDB queries. The corresponding query processing can be adapted and applied in a manner obtained by examining Appendix 1. To fully understand the types of queries supported by TDengine, refer to the TDengine user manual.
|
||||
|
||||
TDengine supports the standard JDBC 3.0 interface for manipulating databases, but you can also use other types of high-level language connectors for querying and reading data to suit your application. Please read the user manual for specific operations and usage.
|
||||
TDengine supports the standard JDBC 3.0 interface for manipulating databases, but you can also use other types of high-level language client libraries for querying and reading data to suit your application. Please read the user manual for specific operations and usage.
|
||||
|
||||
## Historical Data Migration
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ This error indicates that the client could not connect to the server. Perform th
|
|||
|
||||
6. Verify that your firewall settings allow all hosts in the cluster to communicate on ports 6030 and 6041 (TCP and UDP). You can run `ufw status` (Ubuntu) or `firewall-cmd --list-port` (CentOS) to check the configuration.
|
||||
|
||||
7. If you are using the Python, Java, Go, Rust, C#, or Node.js connector on Linux to connect to the server, verify that `libtaos.so` is in the `/usr/local/taos/driver` directory and `/usr/local/taos/driver` is in the `LD_LIBRARY_PATH` environment variable.
|
||||
7. If you are using the Python, Java, Go, Rust, C#, or Node.js client library on Linux to connect to the server, verify that `libtaos.so` is in the `/usr/local/taos/driver` directory and `/usr/local/taos/driver` is in the `LD_LIBRARY_PATH` environment variable.
|
||||
|
||||
8. If you are using macOS, verify that `libtaos.dylib` is in the `/usr/local/lib` directory and `/usr/local/lib` is in the `DYLD_LIBRARY_PATH` environment variable..
|
||||
|
||||
|
@ -142,7 +142,7 @@ Timestamps are processed as follows:
|
|||
|
||||
1. The client uses its system timezone unless it has been configured otherwise.
|
||||
2. A timezone configured in `taos.cfg` takes precedence over the system timezone.
|
||||
3. A timezone explicitly specified when establishing a connection to TDengine through a connector takes precedence over `taos.cfg` and the system timezone. For example, the Java connector allows you to specify a timezone in the JDBC URL.
|
||||
3. A timezone explicitly specified when establishing a connection to TDengine through a client library takes precedence over `taos.cfg` and the system timezone. For example, the Java client library allows you to specify a timezone in the JDBC URL.
|
||||
4. If you use an RFC 3339 timestamp (2013-04-12T15:52:01.123+08:00), or an ISO 8601 timestamp (2013-04-12T15:52:01.123+0800), the timezone specified in the timestamp is used instead of the timestamps configured using any other method.
|
||||
|
||||
### 11. Which network ports are required by TDengine?
|
||||
|
|
|
@ -23,7 +23,7 @@ import CDemo from "./_sub_c.mdx";
|
|||
|
||||
为了实现上述功能,TDengine 会为 WAL (Write-Ahead-Log) 文件自动创建索引以支持快速随机访问,并提供了灵活可配置的文件切换与保留机制:用户可以按需指定 WAL 文件保留的时间以及大小(详见 create database 语句)。通过以上方式将 WAL 改造成了一个保留事件到达顺序的、可持久化的存储引擎(但由于 TSDB 具有远比 WAL 更高的压缩率,我们不推荐保留太长时间,一般来说,不超过几天)。 对于以 topic 形式创建的查询,TDengine 将对接 WAL 而不是 TSDB 作为其存储引擎。在消费时,TDengine 根据当前消费进度从 WAL 直接读取数据,并使用统一的查询引擎实现过滤、变换等操作,将数据推送给消费者。
|
||||
|
||||
下面为关于数据订阅的一些说明,需要对TDengine的架构有一些了解,结合各个语言链接器的接口使用。
|
||||
下面为关于数据订阅的一些说明,需要对TDengine的架构有一些了解,结合各个语言链接器的接口使用。(可使用时再了解)
|
||||
- 一个消费组消费同一个topic下的所有数据,不同消费组之间相互独立;
|
||||
- 一个消费组消费同一个topic所有的vgroup,消费组可由多个消费者组成,但一个vgroup仅被一个消费者消费,如果消费者数量超过了vgroup数量,多余的消费者不消费数据;
|
||||
- 在服务端每个vgroup仅保存一个offset,每个vgroup的offset是单调递增的,但不一定连续。各个vgroup的offset之间没有关联;
|
||||
|
@ -45,12 +45,13 @@ import CDemo from "./_sub_c.mdx";
|
|||
|
||||
本文档不对消息队列本身的知识做更多的介绍,如果需要了解,请自行搜索。
|
||||
|
||||
说明:
|
||||
从3.2.0.0版本开始,数据订阅支持vnode迁移和分裂。
|
||||
由于数据订阅依赖wal文件,而在vnode迁移和分裂的过程中,wal并不会同步过去,所以迁移或分裂后,之前没消费完的wal数据后消费不到。所以请保证之前把数据全部消费完后,再进行vnode迁移或分裂,否则,消费会丢失数据。
|
||||
|
||||
## 主要数据结构和 API
|
||||
|
||||
不同语言下, TMQ 订阅相关的 API 及数据结构如下:
|
||||
不同语言下, TMQ 订阅相关的 API 及数据结构如下(注意consumer结构不是线程安全的,在一个线程使用consumer时,不要在另一个线程close这个consumer):
|
||||
|
||||
<Tabs defaultValue="java" groupId="lang">
|
||||
<TabItem value="c" label="C">
|
||||
|
|
|
@ -0,0 +1,99 @@
|
|||
---
|
||||
sidebar_label: ODBC
|
||||
title: TDengine ODBC
|
||||
---
|
||||
|
||||
|
||||
## 简介
|
||||
|
||||
TDengine ODBC 是为 TDengine 实现的 ODBC 驱动程序,支持 Windows 系统的应用(如 [PowerBI](https://powerbi.microsoft.com/zh-cn/) 等)通过 ODBC 标准接口访问本地、远程和云服务的 TDengine 数据库。
|
||||
|
||||
TDengine ODBC 提供基于 WebSocket(推荐)和 原生连接两种方式连接 TDengine 数据库,使用时可以为 TDengine 数据源设置不同的连接方式。访问云服务时必须使用 WebSocket 连接方式。
|
||||
|
||||
注意:TDengine ODBC 只支持 64 位系统,调用 TDengine ODBC 必须通过 64 位的 ODBC 驱动管理器进行。因此调用 ODBC 的程序不能使用 32 位版本。
|
||||
|
||||
想更多了解 TDengine 时序时序数据库的使用,可访问 [TDengine官方文档](https://docs.taosdata.com/intro/)。
|
||||
|
||||
## 安装
|
||||
|
||||
1. 仅支持 Windows 平台。Windows 上需要安装过 VC 运行时库,可在此下载安装 [VC运行时库](https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170) 如果已经安装VS开发工具可忽略。
|
||||
|
||||
2. 安装 TDengine Windows 客户端,版本在 3.2.1.0 或以上,都会包含 TDengine 的 ODBC 驱动。
|
||||
|
||||
## 配置数据源
|
||||
|
||||
### 数据源连接类型与区别
|
||||
|
||||
TDengine ODBC 支持两种连接 TDengine 数据库方式:Websocket 连接与 Native 连接,其区别如下:
|
||||
|
||||
1. 只有 Websocket 支持连接云服务
|
||||
|
||||
2. Websocket 连接的兼容性更好,一般不需要随着 TDengine 数据库服务端升级而升级客户端的库。
|
||||
|
||||
3. Native 连接通常性能更好一点,但是必须与 TDengine 数据库服务端的版本保持一致。
|
||||
|
||||
4. 对于一般用户,建议使用 **Websocket** 连接方式,性能与 Native 差别不大,兼容性更好。
|
||||
|
||||
### WebSocket 连接
|
||||
|
||||
1. 【开始】菜单搜索打开【ODBC 数据源(64 位)】管理工具(注意不要选择ODBC 数据源(32 位))
|
||||
|
||||
2. 选中【用户 DSN】标签页,通过【添加(D)】按钮进入"创建数据源"界面
|
||||
|
||||
3. 选择想要添加的数据源,这里我们选择【TDengine】
|
||||
|
||||
4. 点击完成,进入 TDengine ODBC 数据源配置页面,填写如下必要信息
|
||||
|
||||

|
||||
|
||||
4.1 【DSN】:Data Source Name 必填,为新添加的 ODBC 数据源命名
|
||||
|
||||
4.2【Connection Type】 : 必选,选择连接类型,这里选择 【Websocket】
|
||||
|
||||
4.3【URL】必填,ODBC 数据源 URL,example: `http://localhost:6041`, 云服务的 url 示例: `https://gw.cloud.taosdata.com?token=your_token`
|
||||
|
||||
4.4【Database】选填,需要连接的默认数据库
|
||||
|
||||
4.5【User】仅供第5步测试连接使用,选填,数据库用户名,如果不填,TDengine 默认 root
|
||||
|
||||
4.6【Password】仅供第5步测试连接使用,选填,数据库用户密码,如果不填,TDengine 默认 taosdata
|
||||
|
||||
5. 点【Test Connecting...】测试连接情况,如果成功,提示"connecting success"
|
||||
|
||||
6. 点【确定】,即可保存配置并退出
|
||||
|
||||
7. 也可以在第2步选择已经配置好的数据源名通过【配置】按钮进入配置页面,修改已有配置
|
||||
|
||||
### 原生连接(不支持云服务)
|
||||
|
||||
1. 【开始】菜单搜索打开【ODBC 数据源(64 位)】管理工具(注意不要选择ODBC 数据源(32 位))
|
||||
|
||||
2. 选中【用户 DSN】标签页,通过【添加(D)】按钮进入"创建数据源"界面
|
||||
|
||||
3. 选择想要添加的数据源,这里我们选择【TDengine】
|
||||
|
||||
4. 点击完成,进入 TDengine ODBC 数据源配置页面,填写如下必要信息
|
||||
|
||||

|
||||
|
||||
4.1 【DSN】:Data Source Name 必填,为新添加的 ODBC 数据源命名
|
||||
|
||||
4.2 【Connection Type】 : 必选,选择连接类型,这里选择 【Native】 原生连接;
|
||||
|
||||
4.3 【Server】必填,ODBC 数据源 Server 地址,example: `localhost:6030`
|
||||
|
||||
4.4 【Database】选填,需要连接的默认数据库
|
||||
|
||||
4.5 【User】仅供第5步测试连接使用,选填,数据库用户名,如果不填,TDengine 默认 root
|
||||
|
||||
4.6 【Password】仅供第5步测试连接使用,选填,数据库用户密码,如果不填,TDengine 默认 taosdata
|
||||
|
||||
5. 点【Test Connecting...】测试连接情况,如果成功,提示"connecting success"
|
||||
|
||||
6. 点【确定】,即可保存配置并退出
|
||||
|
||||
7. 也可以在第2步选择已经配置好的数据源名通过【配置】按钮进入配置页面,修改已有配置
|
||||
|
||||
## 与第三方集成
|
||||
|
||||
作为使用 TDengine ODBC driver 的一个示例,你可以使用 Power BI 与 TDengine 分析时序数据。更多细节请参考 [Power BI](../../third-party/powerbi)
|
After Width: | Height: | Size: 35 KiB |
After Width: | Height: | Size: 6.2 KiB |
After Width: | Height: | Size: 6.1 KiB |
|
@ -46,6 +46,7 @@ database_option: {
|
|||
- last_row:表示缓存子表最近一行数据。这将显著改善 LAST_ROW 函数的性能表现。
|
||||
- last_value:表示缓存子表每一列的最近的非 NULL 值。这将显著改善无特殊影响(WHERE、ORDER BY、GROUP BY、INTERVAL)下的 LAST 函数的性能表现。
|
||||
- both:表示同时打开缓存最近行和列功能。
|
||||
Note:CacheModel 值来回切换有可能导致 last/last_row 的查询结果不准确,请谨慎操作。推荐保持打开。
|
||||
- CACHESIZE:表示每个 vnode 中用于缓存子表最近数据的内存大小。默认为 1 ,范围是[1, 65536],单位是 MB。
|
||||
- COMP:表示数据库文件压缩标志位,缺省值为 2,取值范围为 [0, 2]。
|
||||
- 0:表示不压缩。
|
||||
|
@ -137,6 +138,10 @@ alter_database_option: {
|
|||
|
||||
如果 cacheload 非常接近 cachesize,则 cachesize 可能过小。 如果 cacheload 明显小于 cachesize 则 cachesize 是够用的。可以根据这个原则判断是否需要修改 cachesize 。具体修改值可以根据系统可用内存情况来决定是加倍或者是提高几倍。
|
||||
|
||||
4. stt_trigger
|
||||
|
||||
在修改 stt_trigger 参数之前请先停止数据库写入。
|
||||
|
||||
:::note
|
||||
其它参数在 3.0.0.0 中暂不支持修改
|
||||
|
||||
|
|
|
@ -158,7 +158,7 @@ INSERT INTO d21001 USING meters TAGS ('California.SanFrancisco', 2) FILE '/tmp/c
|
|||
自动建表, 表名通过tbname列指定
|
||||
```sql
|
||||
INSERT INTO meters(tbname, location, groupId, ts, current, phase)
|
||||
values('d31001', 'California.SanFrancisco', 2, '2021-07-13 14:06:34.630', 10.2, 0.32)
|
||||
('d31001', 'California.SanFrancisco', 2, '2021-07-13 14:06:35.779', 10.15, 0.33)
|
||||
('d31002', NULL, 2, '2021-07-13 14:06:34.255', 10.15, 0.33)
|
||||
values('d31001', 'California.SanFrancisco', 2, '2021-07-13 14:06:34.630', 10.2, 219, 0.32)
|
||||
('d31001', 'California.SanFrancisco', 2, '2021-07-13 14:06:35.779', 10.15, 217, 0.33)
|
||||
('d31002', NULL, 2, '2021-07-13 14:06:34.255', 10.15, 217, 0.33)
|
||||
```
|
||||
|
|
|
@ -259,7 +259,12 @@ GROUP BY 子句中的表达式可以包含表或视图中的任何列,这些
|
|||
|
||||
## PARTITION BY
|
||||
|
||||
PARTITION BY 子句是 TDengine 特色语法,按 part_list 对数据进行切分,在每个切分的分片中进行计算。
|
||||
PARTITION BY 子句是 TDengine 3.0版本引入的特色语法,用于根据 part_list 对数据进行切分,在每个切分的分片中可以进行各种计算。
|
||||
|
||||
PARTITION BY 与 GROUP BY 基本含义相似,都是按照指定列表进行数据分组然后进行计算,不同点在于 PARTITION BY 没有 GROUP BY 子句的 SELECT 列表的各种限制,组内可以进行任意运算(常量、聚合、标量、表达式等),因此在使用上 PARTITION BY 完全兼容 GROUP BY,所有使用 GROUP BY 子句的地方都可以替换为 PARTITION BY。
|
||||
|
||||
因为 PARTITION BY 没有返回一行聚合数据的要求,因此还可以支持在分组切片后的各种窗口运算,所有需要分组进行的窗口运算都只能使用 PARTITION BY 子句。
|
||||
|
||||
|
||||
详见 [TDengine 特色查询](../distinguished)
|
||||
|
||||
|
|
|
@ -16,7 +16,11 @@ TDengine 提供的特色查询包括数据切分查询和时间窗口切分查
|
|||
PARTITION BY part_list
|
||||
```
|
||||
|
||||
part_list 可以是任意的标量表达式,包括列、常量、标量函数和它们的组合。
|
||||
part_list 可以是任意的标量表达式,包括列、常量、标量函数和它们的组合。例如,将数据按标签 location 进行分组,取每个分组内的电压平均值:
|
||||
```sql
|
||||
select location, avg(voltage) from meters partition by location
|
||||
```
|
||||
|
||||
|
||||
TDengine 按如下方式处理数据切分子句:
|
||||
|
||||
|
@ -25,9 +29,13 @@ TDengine 按如下方式处理数据切分子句:
|
|||
- 数据切分子句可以和窗口切分子句(或 GROUP BY 子句)一起使用,此时后面的子句作用在每个切分的分片上。例如,将数据按标签 location 进行分组,并对每个组按 10 分钟进行降采样,取其最大值。
|
||||
|
||||
```sql
|
||||
select max(current) from meters partition by location interval(10m)
|
||||
select _wstart, location, max(current) from meters partition by location interval(10m)
|
||||
```
|
||||
数据切分子句最常见的用法就是在超级表查询中,按标签将子表数据进行切分,然后分别进行计算。特别是 PARTITION BY TBNAME 用法,它将每个子表的数据独立出来,形成一条条独立的时间序列,极大的方便了各种时序场景的统计分析。
|
||||
数据切分子句最常见的用法就是在超级表查询中,按标签将子表数据进行切分,然后分别进行计算。特别是 PARTITION BY TBNAME 用法,它将每个子表的数据独立出来,形成一条条独立的时间序列,极大的方便了各种时序场景的统计分析。例如,统计每个电表每 10 分钟内的电压平均值:
|
||||
```sql
|
||||
select _wstart, tbname, avg(voltage) from meters partition by tbname interval(10m)
|
||||
```
|
||||
|
||||
|
||||
## 窗口切分查询
|
||||
|
||||
|
|
|
@ -81,13 +81,13 @@ taosBenchmark -f <json file>
|
|||
|
||||
</details>
|
||||
|
||||
#### 订阅场景 JSON 配置文件示例
|
||||
#### 订阅场景 JSON 配置文件示例
|
||||
|
||||
<details>
|
||||
<summary>subscribe.json</summary>
|
||||
<summary>tmq.json</summary>
|
||||
|
||||
```json
|
||||
{{#include /taos-tools/example/subscribe.json}}
|
||||
{{#include /taos-tools/example/tmq.json}}
|
||||
```
|
||||
|
||||
</details>
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
---
|
||||
sidebar_label: Power BI
|
||||
title: Power BI
|
||||
description: 如何使用 Power BI 和 TDengine 进行时序数据分析
|
||||
---
|
||||
|
||||
# 如何使用 Power BI 和 TDengine 进行时序数据分析
|
||||
|
||||
## 方案介绍
|
||||
|
||||
使用 ODBC 连接器,Power BI 可以快速的访问 TDengine。您可以将标签数据、原始时序数据或按时间聚合后的时序数据从 TDengine 导入到 Power BI,制作报表或仪表盘,整个过程不需要任何的代码编写过程。
|
||||
|
||||
### 整体步骤
|
||||

|
||||
|
||||
### 前置要求
|
||||
1. TDengine 服务端软件已经安装并运行
|
||||
2. Power BI Desktop 软件已经安装并运行(如未安装,请从[官方地址](https://www.microsoft.com/zh-cn/download/details.aspx?id=58494)下载最新的 Windows X64 版本)。
|
||||
|
||||
|
||||
### 安装驱动
|
||||
从 TDengine 官网下载最新的 Windows X64 客户端驱动程序 [下载地址](https://docs.taosdata.com/get-started/package/),并安装在 Power BI 运行的机器上
|
||||
|
||||
### 配置数据源
|
||||
请参考 [ODBC](../../connector/odbc) 配置Websocket数据源。
|
||||
|
||||
### 导入 TDengine 数据到 Power BI
|
||||
1. 打开 Power BI 并登录后,通过如下步骤添加数据源,“主页” -> “获取数据” -> “其他” -> “ODBC” -> “连接”
|
||||
2. 选择数据源名称后,连接到配置好的数据源,进入导航器,浏览对应数据库的数据表并加载
|
||||
3. 如果需要输入 SQL 语句,可以点击“高级选项”,在展开的对话框中输入并加载数据
|
||||
|
||||
|
||||
为了更好的使用 Power BI 分析 TDengine 中的数据,您需要理解维度、度量、时序、相关性的概念,然后通过自定义的 SQL 语句导入数据。
|
||||
1. 维度:通常是分类(文本)数据,描述设备、测点、型号等类别信息。在 TDengine 的超级表中,使用标签列存储数据的维度信息,可以通过形如 `select distinct tbname, tag1, tag2 from supertable` 的 SQL 语法快速获得维度信息。
|
||||
2. 度量:可以用于进行计算的定量(数值)字段, 常见计算有求和、平均值和最小值等。如果测点的采集频率为秒,那么一年就有 31,536,000 条记录,把这些数据全部导入 Power BI 会严重影响其执行效率。在 TDengine 中,您可以使用数据切分查询、窗口切分查询等语法,结合与窗口相关的伪列,把降采样后的数据导入到 Power BI 中,具体语法参考 [TDengine 特色查询功能介绍](https://docs.taosdata.com/taos-sql/distinguished/)。
|
||||
- 窗口切分查询:比如温度传感器每秒采集一次数据,但需查询每隔 10 分钟的温度平均值,这种场景下可以使用窗口子句来获得需要的降采样查询结果,对应的 SQL 语句形如 `select tbname, _wstart date,avg(temperature) temp from table interval(10m)` ,其中 _wstart 是伪列,表示时间窗口起始时间,10m 表示时间窗口的持续时间,`avg(temperature)` 表示时间窗口内的聚合值。
|
||||
- 数据切分查询:如果需要同时获取很多温度传感器的聚合数值,可对数据进行切分然后在切分出的数据空间内再进行一系列的计算,对应的 SQL 语法参考 `partition by part_list`。数据切分子句最常见的用法就是在超级表查询中,按标签将子表数据进行切分,将每个子表的数据独立出来,形成一条条独立的时间序列,方便各种时序场景的统计分析。
|
||||
3. 时序:在绘制曲线或者按照时间聚合数据时,通常需要引入日期表。日期表可以从 Excel 表格中导入,也可以在 TDengine 中执行 SQL 语句获取,例如 `select _wstart date, count(*) cnt from test.meters where ts between A and B interval(1d) fill(0)`,其中 fill 字句表示数据缺失情况下的填充模式,伪列_wstart 则为要获取的日期列。
|
||||
4. 相关性:告诉数据之间如何关联,度量和维度可以通过 tbname 列关联在一起,日期表和度量则可以通过 date 列关联,配合形成可视化报表。
|
||||
|
||||
### 智能电表样例
|
||||
TDengine 有自己独特的数据模型,它使用超级表作为模板,为每个设备创建一个表,每个表最多可创建 4096 个数据列和 128 个标签列。在智能电表样例中,假如一个电表每秒产生一条记录,一天就有 86,400 条记录,一年就有 31,536,000 条记录,1000 个电表将占用 600 GB 原始磁盘空间。因此,Power BI 更多的应用方式是将标签列映射为维度列,数据列的聚合结果导入为度量列,最终为关键决策制定者提供所需的指标。
|
||||
1. 导入维度数据
|
||||
在 Power BI 中导入表的标签列,取名为 tags,SQL 如下
|
||||
select distinct tbname, groupid, location from test.meters;
|
||||
2. 导入度量数据
|
||||
在 Power BI 中,按照 1 小时的时间窗口,导入每个电表的电流均值、电压均值、相位均值,取名为 data,SQL 如下
|
||||
`select tbname, _wstart ws, avg(current), avg(voltage), avg(phase) from test.meters PARTITION by tbname interval(1h)` ;
|
||||
3. 建立维度和度量的关联关系
|
||||
在 Power BI 中,打开模型视图,建立表 tags 和 data 的关联关系,将 tbname 设置为关联数据列。之后,就可以在柱状图、饼图等控件中使用这些数据。更多有关 Power BI 构建视觉效果的信息,请查询 [Power BI 文档](https://learn.microsoft.com/zh-cn/power-bi/)。
|
After Width: | Height: | Size: 39 KiB |
|
@ -32,6 +32,7 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
/* ------------------------ MESSAGE DEFINITIONS ------------------------ */
|
||||
|
||||
#define TD_MSG_NUMBER_
|
||||
#undef TD_MSG_DICT_
|
||||
#undef TD_MSG_INFO_
|
||||
|
@ -357,7 +358,7 @@ typedef enum ENodeType {
|
|||
QUERY_NODE_SHOW_USER_PRIVILEGES_STMT,
|
||||
QUERY_NODE_SHOW_VIEWS_STMT,
|
||||
QUERY_NODE_SHOW_COMPACTS_STMT,
|
||||
QUERY_NODE_SHOW_COMPACT_DETAILS_STMT,
|
||||
QUERY_NODE_SHOW_COMPACT_DETAILS_STMT,
|
||||
|
||||
// logic plan node
|
||||
QUERY_NODE_LOGIC_PLAN_SCAN = 1000,
|
||||
|
@ -1699,7 +1700,7 @@ typedef struct {
|
|||
int32_t vgId;
|
||||
int32_t dnodeId;
|
||||
int32_t numberFileset;
|
||||
int32_t finished;
|
||||
int32_t finished;
|
||||
} SQueryCompactProgressRsp;
|
||||
|
||||
int32_t tSerializeSQueryCompactProgressRsp(void* buf, int32_t bufLen, SQueryCompactProgressRsp* pReq);
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#undef TD_NEW_MSG_SEG
|
||||
#undef TD_DEF_MSG_TYPE
|
||||
#undef TD_CLOSE_MSG_SEG
|
||||
#define TD_NEW_MSG_SEG(TYPE)
|
||||
#define TD_NEW_MSG_SEG(TYPE)
|
||||
#define TD_DEF_MSG_TYPE(TYPE, MSG, REQ, RSP)
|
||||
#define TD_CLOSE_MSG_SEG(TYPE) TYPE,
|
||||
int32_t tMsgRangeDict[] = {
|
||||
|
@ -76,9 +76,7 @@
|
|||
#define TD_CLOSE_MSG_SEG(TYPE)
|
||||
|
||||
enum {
|
||||
|
||||
|
||||
#else
|
||||
#else
|
||||
|
||||
#undef TD_NEW_MSG_SEG
|
||||
#undef TD_DEF_MSG_TYPE
|
||||
|
@ -109,7 +107,7 @@
|
|||
TD_DEF_MSG_TYPE(TDMT_DND_ALTER_VNODE_TYPE, "dnode-alter-vnode-type", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_DND_CHECK_VNODE_LEARNER_CATCHUP, "dnode-check-vnode-learner-catchup", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_DND_MAX_MSG, "dnd-max", NULL, NULL)
|
||||
TD_CLOSE_MSG_SEG(TDMT_END_DND_MSG)
|
||||
TD_CLOSE_MSG_SEG(TDMT_END_DND_MSG)
|
||||
|
||||
TD_NEW_MSG_SEG(TDMT_MND_MSG) // 1<<8
|
||||
TD_DEF_MSG_TYPE(TDMT_MND_CONNECT, "connect", NULL, NULL)
|
||||
|
@ -220,7 +218,7 @@
|
|||
TD_DEF_MSG_TYPE(TDMT_MND_KILL_COMPACT, "kill-compact", SKillCompactReq, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_MND_COMPACT_TIMER, "compact-tmr", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_MND_MAX_MSG, "mnd-max", NULL, NULL)
|
||||
TD_CLOSE_MSG_SEG(TDMT_END_MND_MSG)
|
||||
TD_CLOSE_MSG_SEG(TDMT_END_MND_MSG)
|
||||
|
||||
TD_NEW_MSG_SEG(TDMT_VND_MSG) // 2<<8
|
||||
TD_DEF_MSG_TYPE(TDMT_VND_SUBMIT, "submit", SSubmitReq, SSubmitRsp)
|
||||
|
@ -272,7 +270,7 @@
|
|||
TD_DEF_MSG_TYPE(TDMT_VND_QUERY_COMPACT_PROGRESS, "vnode-query-compact-progress", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_VND_KILL_COMPACT, "kill-compact", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_VND_MAX_MSG, "vnd-max", NULL, NULL)
|
||||
TD_CLOSE_MSG_SEG(TDMT_END_VND_MSG)
|
||||
TD_CLOSE_MSG_SEG(TDMT_END_VND_MSG)
|
||||
|
||||
TD_NEW_MSG_SEG(TDMT_SCH_MSG) // 3<<8
|
||||
TD_DEF_MSG_TYPE(TDMT_SCH_QUERY, "query", NULL, NULL)
|
||||
|
@ -287,7 +285,7 @@
|
|||
TD_DEF_MSG_TYPE(TDMT_SCH_LINK_BROKEN, "link-broken", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_SCH_TASK_NOTIFY, "task-notify", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_SCH_MAX_MSG, "sch-max", NULL, NULL)
|
||||
TD_CLOSE_MSG_SEG(TDMT_END_SCH_MSG)
|
||||
TD_CLOSE_MSG_SEG(TDMT_END_SCH_MSG)
|
||||
|
||||
|
||||
TD_NEW_MSG_SEG(TDMT_STREAM_MSG) //4 << 8
|
||||
|
@ -305,11 +303,11 @@
|
|||
TD_DEF_MSG_TYPE(TDMT_STREAM_TASK_STOP, "stream-task-stop", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_STREAM_HTASK_DROP, "stream-htask-drop", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_STREAM_MAX_MSG, "stream-max", NULL, NULL)
|
||||
TD_CLOSE_MSG_SEG(TDMT_END_STREAM_MSG)
|
||||
TD_CLOSE_MSG_SEG(TDMT_END_STREAM_MSG)
|
||||
|
||||
TD_NEW_MSG_SEG(TDMT_MON_MSG) //5 << 8
|
||||
TD_DEF_MSG_TYPE(TDMT_MON_MAX_MSG, "monitor-max", NULL, NULL)
|
||||
TD_CLOSE_MSG_SEG(TDMT_END_MON_MSG)
|
||||
TD_CLOSE_MSG_SEG(TDMT_END_MON_MSG)
|
||||
|
||||
TD_NEW_MSG_SEG(TDMT_SYNC_MSG) //6 << 8
|
||||
TD_DEF_MSG_TYPE(TDMT_SYNC_TIMEOUT, "sync-timer", NULL, NULL)
|
||||
|
@ -341,8 +339,7 @@
|
|||
TD_DEF_MSG_TYPE(TDMT_SYNC_PREP_SNAPSHOT_REPLY, "sync-prep-snapshot-reply", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_SYNC_MAX_MSG, "sync-max", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_SYNC_FORCE_FOLLOWER, "sync-force-become-follower", NULL, NULL)
|
||||
TD_CLOSE_MSG_SEG(TDMT_END_SYNC_MSG)
|
||||
|
||||
TD_CLOSE_MSG_SEG(TDMT_END_SYNC_MSG)
|
||||
|
||||
TD_NEW_MSG_SEG(TDMT_VND_STREAM_MSG) //7 << 8
|
||||
TD_DEF_MSG_TYPE(TDMT_VND_STREAM_SCAN_HISTORY, "vnode-stream-scan-history", NULL, NULL)
|
||||
|
@ -352,7 +349,7 @@
|
|||
TD_DEF_MSG_TYPE(TDMT_VND_STREAM_TASK_RESET, "vnode-stream-reset", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_VND_STREAM_TASK_CHECK, "vnode-stream-task-check", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_VND_STREAM_MAX_MSG, "vnd-stream-max", NULL, NULL)
|
||||
TD_CLOSE_MSG_SEG(TDMT_END_VND_STREAM_MSG)
|
||||
TD_CLOSE_MSG_SEG(TDMT_END_VND_STREAM_MSG)
|
||||
|
||||
TD_NEW_MSG_SEG(TDMT_VND_TMQ_MSG) //8 << 8
|
||||
TD_DEF_MSG_TYPE(TDMT_VND_TMQ_SUBSCRIBE, "vnode-tmq-subscribe", SMqRebVgReq, SMqRebVgRsp)
|
||||
|
@ -366,13 +363,10 @@
|
|||
TD_DEF_MSG_TYPE(TDMT_VND_TMQ_VG_WALINFO, "vnode-tmq-vg-walinfo", SMqPollReq, SMqDataBlkRsp)
|
||||
TD_DEF_MSG_TYPE(TDMT_VND_TMQ_VG_COMMITTEDINFO, "vnode-tmq-committedinfo", NULL, NULL)
|
||||
TD_DEF_MSG_TYPE(TDMT_VND_TMQ_MAX_MSG, "vnd-tmq-max", NULL, NULL)
|
||||
TD_CLOSE_MSG_SEG(TDMT_END_TMQ_MSG)
|
||||
TD_CLOSE_MSG_SEG(TDMT_END_TMQ_MSG)
|
||||
|
||||
TD_NEW_MSG_SEG(TDMT_MAX_MSG) // msg end mark
|
||||
TD_CLOSE_MSG_SEG(TDMT_END_MAX_MSG)
|
||||
|
||||
|
||||
|
||||
TD_CLOSE_MSG_SEG(TDMT_END_MAX_MSG)
|
||||
|
||||
#if defined(TD_MSG_NUMBER_)
|
||||
TDMT_MAX
|
||||
|
|
|
@ -691,6 +691,7 @@ typedef struct SStreamHbMsg {
|
|||
|
||||
int32_t tEncodeStreamHbMsg(SEncoder* pEncoder, const SStreamHbMsg* pRsp);
|
||||
int32_t tDecodeStreamHbMsg(SDecoder* pDecoder, SStreamHbMsg* pRsp);
|
||||
void streamMetaClearHbMsg(SStreamHbMsg* pMsg);
|
||||
|
||||
typedef struct {
|
||||
int64_t streamId;
|
||||
|
|
|
@ -87,6 +87,7 @@ cp ${compile_dir}/../packaging/tools/taosd-dump-cfg.gdb ${pkg_dir}${install_h
|
|||
cp ${compile_dir}/build/bin/taosd ${pkg_dir}${install_home_path}/bin
|
||||
cp ${compile_dir}/build/bin/udfd ${pkg_dir}${install_home_path}/bin
|
||||
cp ${compile_dir}/build/bin/taosBenchmark ${pkg_dir}${install_home_path}/bin
|
||||
cp ${compile_dir}/build/bin/taosdump ${pkg_dir}${install_home_path}/bin
|
||||
|
||||
if [ -f "${compile_dir}/build/bin/taosadapter" ]; then
|
||||
cp ${compile_dir}/build/bin/taosadapter ${pkg_dir}${install_home_path}/bin ||:
|
||||
|
|
|
@ -82,6 +82,7 @@ cp %{_compiledir}/build/bin/taos %{buildroot}%{homepath}/bin
|
|||
cp %{_compiledir}/build/bin/taosd %{buildroot}%{homepath}/bin
|
||||
cp %{_compiledir}/build/bin/udfd %{buildroot}%{homepath}/bin
|
||||
cp %{_compiledir}/build/bin/taosBenchmark %{buildroot}%{homepath}/bin
|
||||
cp %{_compiledir}/build/bin/taosdump %{buildroot}%{homepath}/bin
|
||||
|
||||
if [ -f %{_compiledir}/../build-taoskeeper/taoskeeper ]; then
|
||||
cp %{_compiledir}/../build-taoskeeper/taoskeeper %{buildroot}%{homepath}/bin
|
||||
|
|
|
@ -621,8 +621,7 @@ function install_share_etc() {
|
|||
${csudo} cp ${script_dir}/share/srv/* ${service_config_dir} ||:
|
||||
}
|
||||
|
||||
function install_log() {
|
||||
${csudo}rm -rf ${log_dir} || :
|
||||
function install_log() {
|
||||
${csudo}mkdir -p ${log_dir} && ${csudo}chmod 777 ${log_dir}
|
||||
|
||||
${csudo}ln -sf ${log_dir} ${install_main_dir}/log
|
||||
|
@ -935,7 +934,9 @@ function updateProduct() {
|
|||
install_adapter_service
|
||||
install_adapter_config
|
||||
install_keeper_service
|
||||
install_keeper_config
|
||||
if [ "${verMode}" != "cloud" ]; then
|
||||
install_keeper_config
|
||||
fi
|
||||
|
||||
openresty_work=false
|
||||
|
||||
|
@ -1036,8 +1037,9 @@ function installProduct() {
|
|||
install_adapter_service
|
||||
install_adapter_config
|
||||
install_keeper_service
|
||||
install_keeper_config
|
||||
|
||||
if [ "${verMode}" != "cloud" ]; then
|
||||
install_keeper_config
|
||||
fi
|
||||
openresty_work=false
|
||||
|
||||
|
||||
|
|
|
@ -401,7 +401,14 @@ echo
|
|||
echo "Do you want to remove all the data, log and configuration files? [y/n]"
|
||||
read answer
|
||||
if [ X$answer == X"y" ] || [ X$answer == X"Y" ]; then
|
||||
confirmMsg="I confirm that I would like to delete all data, log and configuration files"
|
||||
echo "Please enter '${confirmMsg}' to continue"
|
||||
read answer
|
||||
if [ X"$answer" == X"${confirmMsg}" ]; then
|
||||
remove_data_and_config
|
||||
else
|
||||
echo "answer doesn't match, skip this step"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo
|
||||
|
|
|
@ -39,6 +39,8 @@ Compression=lzma
|
|||
SolidCompression=yes
|
||||
DisableDirPage=yes
|
||||
Uninstallable=yes
|
||||
ArchitecturesAllowed=x64
|
||||
ArchitecturesInstallIn64BitMode=x64
|
||||
|
||||
[Languages]
|
||||
Name: "chinesesimp"; MessagesFile: "compiler:Default.isl"
|
||||
|
@ -53,6 +55,7 @@ Source: favicon.ico; DestDir: "{app}\include"; Flags: igNoreversion;
|
|||
Source: {#MyAppSourceDir}{#MyAppDLLName}; DestDir: "{win}\System32"; Flags: igNoreversion recursesubdirs createallsubdirs 64bit;Check:IsWin64;
|
||||
Source: {#MyAppSourceDir}{#MyAppCfgName}; DestDir: "{app}\cfg"; Flags: igNoreversion recursesubdirs createallsubdirs onlyifdoesntexist uninsneveruninstall
|
||||
Source: {#MyAppSourceDir}{#MyAppDriverName}; DestDir: "{app}\driver"; Flags: igNoreversion recursesubdirs createallsubdirs
|
||||
Source: {#MyAppSourceDir}\taos_odbc\*; DestDir: "{app}\taos_odbc\"; Flags: igNoreversion recursesubdirs createallsubdirs
|
||||
;Source: {#MyAppSourceDir}{#MyAppConnectorName}; DestDir: "{app}\connector"; Flags: igNoreversion recursesubdirs createallsubdirs
|
||||
;Source: {#MyAppSourceDir}{#MyAppExamplesName}; DestDir: "{app}\examples"; Flags: igNoreversion recursesubdirs createallsubdirs
|
||||
Source: {#MyAppSourceDir}{#MyAppIncludeName}; DestDir: "{app}\include"; Flags: igNoreversion recursesubdirs createallsubdirs
|
||||
|
@ -66,6 +69,7 @@ Source: {#MyAppSourceDir}\taosdump.exe; DestDir: "{app}"; DestName: "{#CusPrompt
|
|||
[run]
|
||||
Filename: {sys}\sc.exe; Parameters: "create taosd start= DEMAND binPath= ""C:\\TDengine\\taosd.exe --win_service""" ; Flags: runhidden
|
||||
Filename: {sys}\sc.exe; Parameters: "create taosadapter start= DEMAND binPath= ""C:\\TDengine\\taosadapter.exe""" ; Flags: runhidden
|
||||
Filename: "{cmd}"; Parameters: "/c odbcconf /F ""C:\TDengine\taos_odbc\win_odbcinst.in"""; WorkingDir: "{app}"; Flags: runhidden; StatusMsg: "Configuring ODBC"
|
||||
|
||||
[UninstallRun]
|
||||
RunOnceId: "stoptaosd"; Filename: {sys}\sc.exe; Parameters: "stop taosd" ; Flags: runhidden
|
||||
|
@ -95,6 +99,43 @@ begin
|
|||
Result := Pos(';' + Param + ';', ';' + OrigPath + ';') = 0;
|
||||
end;
|
||||
|
||||
function DeleteOdbcDsnRegistry: Boolean;
|
||||
var
|
||||
Names: TArrayOfString;
|
||||
I: Integer;
|
||||
Value: String;
|
||||
begin
|
||||
if RegGetValueNames(HKCU64, 'SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources', Names) then
|
||||
begin
|
||||
for I := 0 to GetArrayLength(Names) - 1 do
|
||||
begin
|
||||
if RegQueryStringValue(HKCU64, 'SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources', Names[I], Value) then
|
||||
begin
|
||||
if Value = 'TDengine' then
|
||||
begin
|
||||
RegDeleteKeyIncludingSubkeys(HKCU64, 'SOFTWARE\ODBC\ODBC.INI\' + Names[I]);
|
||||
RegDeleteValue(HKCU64, 'SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources\', Names[I]);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
function DeleteOdbcDriverRegistry: Boolean;
|
||||
begin
|
||||
RegDeleteKeyIncludingSubkeys(HKLM64, 'SOFTWARE\ODBC\ODBCINST.INI\TDengine');
|
||||
RegDeleteValue(HKLM64, 'SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers', 'TDengine');
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
|
||||
procedure DeinitializeUninstall();
|
||||
begin
|
||||
DeleteOdbcDsnRegistry();
|
||||
DeleteOdbcDriverRegistry();
|
||||
end;
|
||||
|
||||
[UninstallDelete]
|
||||
Name: {app}\driver; Type: filesandordirs
|
||||
Name: {app}\connector; Type: filesandordirs
|
||||
|
|
|
@ -1309,6 +1309,10 @@ void taos_fetch_rows_a(TAOS_RES *res, __taos_async_fn_t fp, void *param) {
|
|||
}
|
||||
|
||||
SRequestObj *pRequest = res;
|
||||
if (TSDB_SQL_RETRIEVE_EMPTY_RESULT == pRequest->type) {
|
||||
fp(param, res, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
taosAsyncFetchImpl(pRequest, fp, param);
|
||||
}
|
||||
|
|
|
@ -1827,7 +1827,7 @@ int32_t tSerializeSGetUserAuthRspImpl(SEncoder *pEncoder, SGetUserAuthRsp *pRsp)
|
|||
char *tb = taosHashIterate(pRsp->readTbs, NULL);
|
||||
while (tb != NULL) {
|
||||
size_t keyLen = 0;
|
||||
void *key = taosHashGetKey(tb, &keyLen);
|
||||
void * key = taosHashGetKey(tb, &keyLen);
|
||||
if (tEncodeI32(pEncoder, keyLen) < 0) return -1;
|
||||
if (tEncodeCStr(pEncoder, key) < 0) return -1;
|
||||
|
||||
|
@ -1842,7 +1842,7 @@ int32_t tSerializeSGetUserAuthRspImpl(SEncoder *pEncoder, SGetUserAuthRsp *pRsp)
|
|||
tb = taosHashIterate(pRsp->writeTbs, NULL);
|
||||
while (tb != NULL) {
|
||||
size_t keyLen = 0;
|
||||
void *key = taosHashGetKey(tb, &keyLen);
|
||||
void * key = taosHashGetKey(tb, &keyLen);
|
||||
if (tEncodeI32(pEncoder, keyLen) < 0) return -1;
|
||||
if (tEncodeCStr(pEncoder, key) < 0) return -1;
|
||||
|
||||
|
@ -1857,7 +1857,7 @@ int32_t tSerializeSGetUserAuthRspImpl(SEncoder *pEncoder, SGetUserAuthRsp *pRsp)
|
|||
tb = taosHashIterate(pRsp->alterTbs, NULL);
|
||||
while (tb != NULL) {
|
||||
size_t keyLen = 0;
|
||||
void *key = taosHashGetKey(tb, &keyLen);
|
||||
void * key = taosHashGetKey(tb, &keyLen);
|
||||
if (tEncodeI32(pEncoder, keyLen) < 0) return -1;
|
||||
if (tEncodeCStr(pEncoder, key) < 0) return -1;
|
||||
|
||||
|
@ -1872,7 +1872,7 @@ int32_t tSerializeSGetUserAuthRspImpl(SEncoder *pEncoder, SGetUserAuthRsp *pRsp)
|
|||
tb = taosHashIterate(pRsp->readViews, NULL);
|
||||
while (tb != NULL) {
|
||||
size_t keyLen = 0;
|
||||
void *key = taosHashGetKey(tb, &keyLen);
|
||||
void * key = taosHashGetKey(tb, &keyLen);
|
||||
if (tEncodeI32(pEncoder, keyLen) < 0) return -1;
|
||||
if (tEncodeCStr(pEncoder, key) < 0) return -1;
|
||||
|
||||
|
@ -1887,7 +1887,7 @@ int32_t tSerializeSGetUserAuthRspImpl(SEncoder *pEncoder, SGetUserAuthRsp *pRsp)
|
|||
tb = taosHashIterate(pRsp->writeViews, NULL);
|
||||
while (tb != NULL) {
|
||||
size_t keyLen = 0;
|
||||
void *key = taosHashGetKey(tb, &keyLen);
|
||||
void * key = taosHashGetKey(tb, &keyLen);
|
||||
if (tEncodeI32(pEncoder, keyLen) < 0) return -1;
|
||||
if (tEncodeCStr(pEncoder, key) < 0) return -1;
|
||||
|
||||
|
@ -1902,7 +1902,7 @@ int32_t tSerializeSGetUserAuthRspImpl(SEncoder *pEncoder, SGetUserAuthRsp *pRsp)
|
|||
tb = taosHashIterate(pRsp->alterViews, NULL);
|
||||
while (tb != NULL) {
|
||||
size_t keyLen = 0;
|
||||
void *key = taosHashGetKey(tb, &keyLen);
|
||||
void * key = taosHashGetKey(tb, &keyLen);
|
||||
if (tEncodeI32(pEncoder, keyLen) < 0) return -1;
|
||||
if (tEncodeCStr(pEncoder, key) < 0) return -1;
|
||||
|
||||
|
@ -1917,7 +1917,7 @@ int32_t tSerializeSGetUserAuthRspImpl(SEncoder *pEncoder, SGetUserAuthRsp *pRsp)
|
|||
int32_t *useDb = taosHashIterate(pRsp->useDbs, NULL);
|
||||
while (useDb != NULL) {
|
||||
size_t keyLen = 0;
|
||||
void *key = taosHashGetKey(useDb, &keyLen);
|
||||
void * key = taosHashGetKey(useDb, &keyLen);
|
||||
if (tEncodeI32(pEncoder, keyLen) < 0) return -1;
|
||||
if (tEncodeCStr(pEncoder, key) < 0) return -1;
|
||||
|
||||
|
@ -8342,7 +8342,7 @@ int32_t tEncodeMqDataRsp(SEncoder *pEncoder, const SMqDataRsp *pRsp) {
|
|||
|
||||
for (int32_t i = 0; i < pRsp->blockNum; i++) {
|
||||
int32_t bLen = *(int32_t *)taosArrayGet(pRsp->blockDataLen, i);
|
||||
void *data = taosArrayGetP(pRsp->blockData, i);
|
||||
void * data = taosArrayGetP(pRsp->blockData, i);
|
||||
if (tEncodeBinary(pEncoder, (const uint8_t *)data, bLen) < 0) return -1;
|
||||
if (pRsp->withSchema) {
|
||||
SSchemaWrapper *pSW = (SSchemaWrapper *)taosArrayGetP(pRsp->blockSchema, i);
|
||||
|
@ -8375,7 +8375,7 @@ int32_t tDecodeMqDataRsp(SDecoder *pDecoder, SMqDataRsp *pRsp) {
|
|||
}
|
||||
|
||||
for (int32_t i = 0; i < pRsp->blockNum; i++) {
|
||||
void *data;
|
||||
void * data;
|
||||
uint64_t bLen;
|
||||
if (tDecodeBinaryAlloc(pDecoder, &data, &bLen) < 0) return -1;
|
||||
taosArrayPush(pRsp->blockData, &data);
|
||||
|
@ -8421,7 +8421,7 @@ int32_t tEncodeSTaosxRsp(SEncoder *pEncoder, const STaosxRsp *pRsp) {
|
|||
if (tEncodeI32(pEncoder, pRsp->createTableNum) < 0) return -1;
|
||||
if (pRsp->createTableNum) {
|
||||
for (int32_t i = 0; i < pRsp->createTableNum; i++) {
|
||||
void *createTableReq = taosArrayGetP(pRsp->createTableReq, i);
|
||||
void * createTableReq = taosArrayGetP(pRsp->createTableReq, i);
|
||||
int32_t createTableLen = *(int32_t *)taosArrayGet(pRsp->createTableLen, i);
|
||||
if (tEncodeBinary(pEncoder, createTableReq, createTableLen) < 0) return -1;
|
||||
}
|
||||
|
@ -8437,7 +8437,7 @@ int32_t tDecodeSTaosxRsp(SDecoder *pDecoder, STaosxRsp *pRsp) {
|
|||
pRsp->createTableLen = taosArrayInit(pRsp->createTableNum, sizeof(int32_t));
|
||||
pRsp->createTableReq = taosArrayInit(pRsp->createTableNum, sizeof(void *));
|
||||
for (int32_t i = 0; i < pRsp->createTableNum; i++) {
|
||||
void *pCreate = NULL;
|
||||
void * pCreate = NULL;
|
||||
uint64_t len;
|
||||
if (tDecodeBinaryAlloc(pDecoder, &pCreate, &len) < 0) return -1;
|
||||
int32_t l = (int32_t)len;
|
||||
|
@ -8739,7 +8739,7 @@ void tDestroySubmitTbData(SSubmitTbData *pTbData, int32_t flag) {
|
|||
taosArrayDestroy(pTbData->aCol);
|
||||
} else {
|
||||
int32_t nRow = TARRAY_SIZE(pTbData->aRowP);
|
||||
SRow **rows = (SRow **)TARRAY_DATA(pTbData->aRowP);
|
||||
SRow ** rows = (SRow **)TARRAY_DATA(pTbData->aRowP);
|
||||
|
||||
for (int32_t i = 0; i < nRow; ++i) {
|
||||
tRowDestroy(rows[i]);
|
||||
|
|
|
@ -5,7 +5,7 @@ target_link_libraries(
|
|||
PUBLIC sut
|
||||
)
|
||||
|
||||
add_test(
|
||||
NAME dsnodeTest
|
||||
COMMAND dsnodeTest
|
||||
)
|
||||
#add_test(
|
||||
# NAME dsnodeTest
|
||||
# COMMAND dsnodeTest
|
||||
#)
|
||||
|
|
|
@ -93,6 +93,9 @@ static int32_t mndStreamSeqActionInsert(SSdb *pSdb, SStreamSeq *pStream);
|
|||
static int32_t mndStreamSeqActionDelete(SSdb *pSdb, SStreamSeq *pStream);
|
||||
static int32_t mndStreamSeqActionUpdate(SSdb *pSdb, SStreamSeq *pOldStream, SStreamSeq *pNewStream);
|
||||
|
||||
static SSdbRaw *mndStreamActionEncode(SStreamObj *pStream);
|
||||
static SSdbRow *mndStreamActionDecode(SSdbRaw *pRaw);
|
||||
|
||||
int32_t mndInitStream(SMnode *pMnode) {
|
||||
SSdbTable table = {
|
||||
.sdbType = SDB_STREAM,
|
||||
|
@ -2932,6 +2935,7 @@ int32_t mndProcessStreamHb(SRpcMsg *pReq) {
|
|||
tDecoderInit(&decoder, pReq->pCont, pReq->contLen);
|
||||
|
||||
if (tDecodeStreamHbMsg(&decoder, &req) < 0) {
|
||||
streamMetaClearHbMsg(&req);
|
||||
tDecoderClear(&decoder);
|
||||
terrno = TSDB_CODE_INVALID_MSG;
|
||||
return -1;
|
||||
|
@ -3039,9 +3043,8 @@ int32_t mndProcessStreamHb(SRpcMsg *pReq) {
|
|||
}
|
||||
|
||||
taosThreadMutexUnlock(&execInfo.lock);
|
||||
streamMetaClearHbMsg(&req);
|
||||
|
||||
taosArrayDestroy(req.pTaskStatus);
|
||||
taosArrayDestroy(req.pUpdateNodes);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -4184,6 +4184,8 @@ int32_t tsdbReaderSuspend2(STsdbReader* pReader) {
|
|||
SReaderStatus* pStatus = &pReader->status;
|
||||
STableBlockScanInfo* pBlockScanInfo = NULL;
|
||||
|
||||
pReader->status.suspendInvoked = true; // record the suspend status
|
||||
|
||||
if (pStatus->loadFromFile) {
|
||||
SFileDataBlockInfo* pBlockInfo = getCurrentBlockInfo(&pReader->status.blockIter);
|
||||
if (pBlockInfo != NULL) {
|
||||
|
@ -4353,7 +4355,7 @@ static int32_t doTsdbNextDataBlockFilesetDelimited(STsdbReader* pReader) {
|
|||
return code;
|
||||
}
|
||||
|
||||
tsdbTrace("block from file rows: %"PRId64", will process pre-file set buffer: %d. %s",
|
||||
tsdbTrace("block from file rows: %"PRId64", will process pre-file set buffer: %d. %s",
|
||||
pBlock->info.rows, pStatus->bProcMemFirstFileset, pReader->idStr);
|
||||
if (pStatus->bProcMemPreFileset) {
|
||||
if (pBlock->info.rows > 0) {
|
||||
|
@ -4367,7 +4369,7 @@ static int32_t doTsdbNextDataBlockFilesetDelimited(STsdbReader* pReader) {
|
|||
pStatus->bProcMemPreFileset = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (pBlock->info.rows <= 0) {
|
||||
resetTableListIndex(&pReader->status);
|
||||
int64_t endKey = (ASCENDING_TRAVERSE(pReader->info.order)) ? INT64_MAX : INT64_MIN;
|
||||
|
|
|
@ -197,6 +197,7 @@ typedef struct SFileBlockDumpInfo {
|
|||
} SFileBlockDumpInfo;
|
||||
|
||||
typedef struct SReaderStatus {
|
||||
bool suspendInvoked;
|
||||
bool loadFromFile; // check file stage
|
||||
bool composedDataBlock; // the returned data block is a composed block or not
|
||||
SSHashObj* pTableMap; // SHash<STableBlockScanInfo>
|
||||
|
@ -210,7 +211,7 @@ typedef struct SReaderStatus {
|
|||
SArray* pLDataIterArray;
|
||||
SRowMerger merger;
|
||||
SColumnInfoData* pPrimaryTsCol; // primary time stamp output col info data
|
||||
// the following for preceeds fileset memory processing
|
||||
// the following for preceeds fileset memory processing
|
||||
// TODO: refactor into seperate struct
|
||||
bool bProcMemPreFileset;
|
||||
int64_t memTableMaxKey;
|
||||
|
|
|
@ -1007,10 +1007,18 @@ static bool waitForEnoughDuration(SMetaHbInfo* pInfo) {
|
|||
return false;
|
||||
}
|
||||
|
||||
static void clearHbMsg(SStreamHbMsg* pMsg, SArray* pIdList) {
|
||||
taosArrayDestroy(pMsg->pTaskStatus);
|
||||
taosArrayDestroy(pMsg->pUpdateNodes);
|
||||
taosArrayDestroy(pIdList);
|
||||
void streamMetaClearHbMsg(SStreamHbMsg* pMsg) {
|
||||
if (pMsg == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (pMsg->pUpdateNodes != NULL) {
|
||||
taosArrayDestroy(pMsg->pUpdateNodes);
|
||||
}
|
||||
|
||||
if (pMsg->pTaskStatus != NULL) {
|
||||
taosArrayDestroy(pMsg->pTaskStatus);
|
||||
}
|
||||
}
|
||||
|
||||
static bool existInHbMsg(SStreamHbMsg* pMsg, SDownstreamTaskEpset* pTaskEpset) {
|
||||
|
@ -1189,7 +1197,8 @@ void metaHbToMnode(void* param, void* tmrId) {
|
|||
}
|
||||
|
||||
_end:
|
||||
clearHbMsg(&hbMsg, pIdList);
|
||||
streamMetaClearHbMsg(&hbMsg);
|
||||
taosArrayDestroy(pIdList);
|
||||
taosTmrReset(metaHbToMnode, META_HB_CHECK_INTERVAL, param, streamTimer, &pMeta->pHbInfo->hbTmr);
|
||||
taosReleaseRef(streamMetaId, rid);
|
||||
}
|
||||
|
|
|
@ -1498,6 +1498,7 @@ int transSendResponse(const STransMsg* msg) {
|
|||
return 0;
|
||||
}
|
||||
SExHandle* exh = msg->info.handle;
|
||||
|
||||
if (exh == NULL) {
|
||||
rpcFreeCont(msg->pCont);
|
||||
return 0;
|
||||
|
|
|
@ -80,6 +80,7 @@ sql use test2;
|
|||
sql create stable st(ts timestamp, a int, b int , c int, d double) tags(ta int,tb int,tc int);
|
||||
sql create table t1 using st tags(1,1,1);
|
||||
sql create stream streams2 trigger at_once ignore expired 0 ignore update 0 waterMark 200s into streamt2 as select _wstart, count(*) c1 from t1 interval(1s);
|
||||
sleep 1000
|
||||
|
||||
sql insert into t1 values(1648791211000,1,2,3,1.0);
|
||||
sql insert into t1 values(1648791212001,2,2,3,1.1);
|
||||
|
|