Merge branch '3.0' of https://github.com/taosdata/TDengine into fix/TD-33272
|
@ -78,7 +78,7 @@ def check_docs(){
|
|||
file_only_tdgpt_change_except = sh (
|
||||
script: '''
|
||||
cd ${WKC}
|
||||
git --no-pager diff --name-only FETCH_HEAD `git merge-base FETCH_HEAD ${CHANGE_TARGET}`|grep -v "^docs/en/"|grep -v "^docs/zh/"|grep -v ".md$" | grep -v "forecastoperator.c\\|anomalywindowoperator.c" |grep -v "tsim/analytics" |grep -v "tdgpt_cases.task" || :
|
||||
git --no-pager diff --name-only FETCH_HEAD `git merge-base FETCH_HEAD ${CHANGE_TARGET}`|grep -v "^docs/en/"|grep -v "^docs/zh/"|grep -v ".md$" | grep -v "forecastoperator.c\\|anomalywindowoperator.c\\|tanalytics.h\\|tanalytics.c" |grep -v "tsim/analytics" |grep -v "tdgpt_cases.task" || :
|
||||
''',
|
||||
returnStdout: true
|
||||
).trim()
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
</p>
|
||||
<p>
|
||||
|
||||
[](https://cloud.drone.io/taosdata/TDengine)
|
||||
[](https://ci.appveyor.com/project/sangshuduo/tdengine-2n8ge/branch/master)
|
||||
[](https://coveralls.io/github/taosdata/TDengine?branch=3.0)
|
||||
[](https://bestpractices.coreinfrastructure.org/projects/4201)
|
||||
<br />
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# taos-tools
|
||||
ExternalProject_Add(taos-tools
|
||||
GIT_REPOSITORY https://github.com/taosdata/taos-tools.git
|
||||
GIT_TAG 3.0
|
||||
GIT_TAG main
|
||||
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools"
|
||||
BINARY_DIR ""
|
||||
#BUILD_IN_SOURCE TRUE
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# taosws-rs
|
||||
ExternalProject_Add(taosws-rs
|
||||
GIT_REPOSITORY https://github.com/taosdata/taos-connector-rust.git
|
||||
GIT_TAG 3.0
|
||||
GIT_TAG main
|
||||
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosws-rs"
|
||||
BINARY_DIR ""
|
||||
#BUILD_IN_SOURCE TRUE
|
||||
|
|
|
@ -22,15 +22,11 @@ import imgStep11 from '../../assets/grafana-11.png';
|
|||
|
||||
This document describes how to integrate the TDengine data source with the open-source data visualization system [Grafana](https://www.grafana.com/) to achieve data visualization and build a monitoring and alert system. With the TDengine plugin, you can easily display data from TDengine tables on Grafana dashboards without the need for complex development work.
|
||||
|
||||
## Grafana Version Requirements
|
||||
|
||||
TDengine currently supports Grafana version 7.5 and above. It is recommended to use the latest version. Please download and install the corresponding version of Grafana according to your system environment.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
To add the TDengine data source to Grafana normally, the following preparations are needed.
|
||||
|
||||
- Grafana service has been deployed and is running normally.
|
||||
- Grafana service has been deployed and is running normally. TDengine currently supports Grafana version 7.5 and above. It is recommended to use the latest version.
|
||||
**Note**: Ensure that the account starting Grafana has write permissions to its installation directory, otherwise you may not be able to install plugins later.
|
||||
- TDengine cluster has been deployed and is running normally.
|
||||
- taosAdapter has been installed and is running normally. For details, please refer to the [taosAdapter user manual](../../../tdengine-reference/components/taosadapter/)
|
||||
|
|
|
@ -13,13 +13,11 @@ Seeq is advanced analytics software for the manufacturing and Industrial Interne
|
|||
|
||||
Through the TDengine Java connector, Seeq can easily support querying time-series data provided by TDengine and offer data presentation, analysis, prediction, and other functions.
|
||||
|
||||
## Seeq Installation Method
|
||||
## Prerequisites
|
||||
|
||||
Download the relevant software from [Seeq's official website](https://www.seeq.com/customer-download), such as Seeq Server and Seeq Data Lab, etc. Seeq Data Lab needs to be installed on a different server from Seeq Server and interconnected through configuration. For detailed installation and configuration instructions, refer to the [Seeq Knowledge Base](https://support.seeq.com/kb/latest/cloud/).
|
||||
- Seeq has been installed. Download the relevant software from [Seeq's official website](https://www.seeq.com/customer-download), such as Seeq Server and Seeq Data Lab, etc. Seeq Data Lab needs to be installed on a different server from Seeq Server and interconnected through configuration. For detailed installation and configuration instructions, refer to the [Seeq Knowledge Base](https://support.seeq.com/kb/latest/cloud/).
|
||||
|
||||
### TDengine Local Instance Installation Method
|
||||
|
||||
Please refer to the [official documentation](../../../get-started).
|
||||
- TDengine local instance has been installed. Please refer to the [official documentation](../../../get-started). If using TDengine Cloud, please go to https://cloud.taosdata.com apply for an account and log in to see how to access TDengine Cloud.
|
||||
|
||||
## Configuring Seeq to Access TDengine
|
||||
|
||||
|
|
|
@ -9,14 +9,13 @@ Apache Superset provides an intuitive user interface that makes creating, sharin
|
|||
|
||||
Through the Python connector of TDengine, Superset can support TDengine data sources and provide functions such as data presentation and analysis
|
||||
|
||||
## Install Apache Superset
|
||||
|
||||
Ensure that Apache Superset v2.1.0 or above is installed. If not, please visit [official website](https://superset.apache.org/) to install
|
||||
|
||||
## Install TDengine
|
||||
|
||||
Both TDengine Enterprise Edition and Community Edition are supported, with version requirements of 3.0 or higher
|
||||
## Prerequisites
|
||||
|
||||
Prepare the following environment:
|
||||
- TDengine is installed and running normally (both Enterprise and Community versions are available)
|
||||
- taosAdapter is running normally, refer to [taosAdapter](../../../reference/components/taosAdapter)
|
||||
- Apache Superset version 2.1.0 or above is already installed, refre to [Apache Superset](https://superset.apache.org/)
|
||||
|
||||
## Install TDengine Python Connector
|
||||
|
||||
The Python connector of TDengine comes with a connection driver that supports Superset in versions 2.1.18 and later, which will be automatically installed in the Superset directory and provide data source services.
|
||||
|
|
|
@ -14,6 +14,7 @@ The default configuration file for `Agent` is located at `/etc/taos/agent.toml`,
|
|||
- `token`: Required, the Token generated when creating `Agent` in `Explorer`.
|
||||
- `instanceId`: The instance ID of the current taosx-agent service. If multiple taosx-agent instances are started on the same machine, it is necessary to ensure that the instance IDs of each instance are unique.
|
||||
- `compression`: Optional, can be configured as `true` or `false`, default is `false`. If set to `true`, it enables data compression in communication between `Agent` and `taosX`.
|
||||
- `in_memory_cache_capacity`: Optional, signifies the maximum number of message batches that can be cached in memory and can be configured as a positive integer greater than zero. The default value is set at 64.
|
||||
- `log_level`: Optional, log level, default is `info`. Like `taosX`, it supports five levels: `error`, `warn`, `info`, `debug`, `trace`. Deprecated, please use `log.level` instead.
|
||||
- `log_keep_days`: Optional, the number of days to keep logs, default is `30` days. Deprecated, please use `log.keepDays` instead.
|
||||
- `log.path`: The directory where log files are stored.
|
||||
|
@ -45,6 +46,10 @@ As shown below:
|
|||
#
|
||||
#compression = true
|
||||
|
||||
# In-memory cache capacity
|
||||
#
|
||||
#in_memory_cache_capacity = 64
|
||||
|
||||
# log configuration
|
||||
[log]
|
||||
# All log files are stored in this directory
|
||||
|
|
|
@ -4,22 +4,17 @@ sidebar_label: taosdump
|
|||
slug: /tdengine-reference/tools/taosdump
|
||||
---
|
||||
|
||||
taosdump is a tool application that supports backing up data from a running TDengine cluster and restoring the backed-up data to the same or another running TDengine cluster.
|
||||
|
||||
taosdump can back up data using databases, supertables, or basic tables as logical data units, and can also back up data records within a specified time period from databases, supertables, and basic tables. You can specify the directory path for data backup; if not specified, taosdump defaults to backing up data to the current directory.
|
||||
|
||||
If the specified location already has data files, taosdump will prompt the user and exit immediately to avoid data being overwritten. This means the same path can only be used for one backup.
|
||||
If you see related prompts, please operate carefully.
|
||||
|
||||
taosdump is a logical backup tool, it should not be used to back up any raw data, environment settings, hardware information, server configuration, or cluster topology. taosdump uses [Apache AVRO](https://avro.apache.org/) as the data file format to store backup data.
|
||||
`taosdump` is a TDengine data backup/recovery tool provided for open source users, and the backed up data files adopt the standard [Apache AVRO](https://avro.apache.org/)
|
||||
Format, convenient for exchanging data with the external ecosystem.
|
||||
Taosdump provides multiple data backup and recovery options to meet different data needs, and all supported options can be viewed through --help.
|
||||
|
||||
## Installation
|
||||
|
||||
There are two ways to install taosdump:
|
||||
Taosdump provides two installation methods:
|
||||
|
||||
- Install the official taosTools package, please find taosTools on the [release history page](../../../release-history/taostools/) and download it for installation.
|
||||
- Taosdump is the default installation component in the TDengine installation package, which can be used after installing TDengine. For how to install TDengine, please refer to [TDengine Installation](../../../get-started/)
|
||||
|
||||
- Compile taos-tools separately and install, please refer to the [taos-tools](https://github.com/taosdata/taos-tools) repository for details.
|
||||
- Compile and install taos tools separately, refer to [taos tools](https://github.com/taosdata/taos-tools) .
|
||||
|
||||
## Common Use Cases
|
||||
|
||||
|
@ -30,6 +25,9 @@ There are two ways to install taosdump:
|
|||
3. Backup certain supertables or basic tables in a specified database: use the `dbname stbname1 stbname2 tbname1 tbname2 ...` parameter, note that this input sequence starts with the database name, supports only one database, and the second and subsequent parameters are the names of the supertables or basic tables in that database, separated by spaces;
|
||||
4. Backup the system log database: TDengine clusters usually include a system database named `log`, which contains data for TDengine's own operation, taosdump does not back up the log database by default. If there is a specific need to back up the log database, you can use the `-a` or `--allow-sys` command line parameter.
|
||||
5. "Tolerant" mode backup: Versions after taosdump 1.4.1 provide the `-n` and `-L` parameters, used for backing up data without using escape characters and in "tolerant" mode, which can reduce backup data time and space occupied when table names, column names, and label names do not use escape characters. If unsure whether to use `-n` and `-L`, use the default parameters for "strict" mode backup. For an explanation of escape characters, please refer to the [official documentation](../../sql-manual/escape-characters/).
|
||||
6. If a backup file already exists in the directory specified by the `-o` parameter, to prevent data from being overwritten, taosdump will report an error and exit. Please replace it with another empty directory or clear the original data before backing up.
|
||||
7. Currently, taosdump does not support data breakpoint backup function. Once the data backup is interrupted, it needs to be started from scratch.
|
||||
If the backup takes a long time, it is recommended to use the (-S -E options) method to specify the start/end time for segmented backup.
|
||||
|
||||
:::tip
|
||||
|
||||
|
@ -42,7 +40,8 @@ There are two ways to install taosdump:
|
|||
|
||||
### taosdump Restore Data
|
||||
|
||||
Restore data files from a specified path: use the `-i` parameter along with the data file path. As mentioned earlier, the same directory should not be used to back up different data sets, nor should the same path be used to back up the same data set multiple times, otherwise, the backup data will cause overwriting or multiple backups.
|
||||
- Restore data files from a specified path: use the `-i` parameter along with the data file path. As mentioned earlier, the same directory should not be used to back up different data sets, nor should the same path be used to back up the same data set multiple times, otherwise, the backup data will cause overwriting or multiple backups.
|
||||
- taosdump supports data recovery to a new database name with the parameter `-W`, please refer to the command line parameter description for details.
|
||||
|
||||
:::tip
|
||||
taosdump internally uses the TDengine stmt binding API to write restored data, currently using 16384 as a batch for writing. If there are many columns in the backup data, it may cause a "WAL size exceeds limit" error, in which case you can try adjusting the `-B` parameter to a smaller value.
|
||||
|
@ -105,6 +104,13 @@ Usage: taosdump [OPTION...] dbname [tbname ...]
|
|||
the table name.(Version 2.5.3)
|
||||
-T, --thread-num=THREAD_NUM Number of thread for dump in file. Default is
|
||||
8.
|
||||
-W, --rename=RENAME-LIST Rename database name with new name during
|
||||
importing data. RENAME-LIST:
|
||||
"db1=newDB1|db2=newDB2" means rename db1 to newDB1
|
||||
and rename db2 to newDB2 (Version 2.5.4)
|
||||
-k, --retry-count=VALUE Set the number of retry attempts for connection or
|
||||
query failures
|
||||
-z, --retry-sleep-ms=VALUE retry interval sleep time, unit ms
|
||||
-C, --cloud=CLOUD_DSN specify a DSN to access TDengine cloud service
|
||||
-R, --restful Use RESTful interface to connect TDengine
|
||||
-t, --timeout=SECONDS The timeout seconds for websocket to interact.
|
||||
|
@ -112,10 +118,6 @@ Usage: taosdump [OPTION...] dbname [tbname ...]
|
|||
-?, --help Give this help list
|
||||
--usage Give a short usage message
|
||||
-V, --version Print program version
|
||||
-W, --rename=RENAME-LIST Rename database name with new name during
|
||||
importing data. RENAME-LIST:
|
||||
"db1=newDB1|db2=newDB2" means rename db1 to newDB1
|
||||
and rename db2 to newDB2 (Version 2.5.4)
|
||||
|
||||
Mandatory or optional arguments to long options are also mandatory or optional
|
||||
for any corresponding short options.
|
||||
|
|
|
@ -4,35 +4,38 @@ sidebar_label: taosBenchmark
|
|||
slug: /tdengine-reference/tools/taosbenchmark
|
||||
---
|
||||
|
||||
taosBenchmark (formerly known as taosdemo) is a tool for testing the performance of the TDengine product. taosBenchmark can test the performance of TDengine's insert, query, and subscription functions. It can simulate massive data generated by a large number of devices and flexibly control the number of databases, supertables, types and number of tag columns, types and number of data columns, number of subtables, data volume per subtable, data insertion interval, number of working threads in taosBenchmark, whether and how to insert out-of-order data, etc. To accommodate the usage habits of past users, the installation package provides taosdemo as a soft link to taosBenchmark.
|
||||
TaosBenchmark is a performance benchmarking tool for TDengine products, providing insertion, query, and subscription performance testing for TDengine products, and outputting performance indicators.
|
||||
|
||||
## Installation
|
||||
|
||||
There are two ways to install taosBenchmark:
|
||||
taosBenchmark provides two installation methods:
|
||||
|
||||
- taosBenchmark is automatically installed with the official TDengine installation package, for details please refer to [TDengine Installation](../../../get-started/).
|
||||
- taosBenchmark is the default installation component in the TDengine installation package, which can be used after installing TDengine. For how to install TDengine, please refer to [TDengine Installation](../../../get started/)
|
||||
|
||||
- Compile and install taos-tools separately, for details please refer to the [taos-tools](https://github.com/taosdata/taos-tools) repository.
|
||||
- Compile and install taos tools separately, refer to [taos tools](https://github.com/taosdata/taos-tools) .
|
||||
|
||||
## Operation
|
||||
|
||||
### Configuration and Operation Methods
|
||||
|
||||
taosBenchmark needs to be executed in the operating system's terminal, and this tool supports two configuration methods: Command Line Arguments and JSON Configuration File. These two methods are mutually exclusive; when using a configuration file, only one command line argument `-f <json file>` can be used to specify the configuration file. When using command line arguments to run taosBenchmark and control its behavior, the `-f` parameter cannot be used; instead, other parameters must be used for configuration. In addition, taosBenchmark also offers a special mode of operation, which is running without any parameters.
|
||||
|
||||
taosBenchmark supports comprehensive performance testing for TDengine, and the TDengine features it supports are divided into three categories: writing, querying, and subscribing. These three functions are mutually exclusive, and each run of taosBenchmark can only select one of them. It is important to note that the type of function to be tested is not configurable when using the command line configuration method; the command line configuration method can only test writing performance. To test TDengine's query and subscription performance, you must use the configuration file method and specify the type of function to be tested through the `filetype` parameter in the configuration file.
|
||||
taosBbenchmark supports three operating modes:
|
||||
- No parameter mode
|
||||
- Command line mode
|
||||
- JSON configuration file mode
|
||||
The command-line approach is a subset of the functionality of JSON configuration files, which immediately uses the command line and then the configuration file, with the parameters specified by the command line taking precedence.
|
||||
|
||||
**Ensure that the TDengine cluster is running correctly before running taosBenchmark.**
|
||||
|
||||
### Running Without Command Line Arguments
|
||||
|
||||
Execute the following command to quickly experience taosBenchmark performing a write performance test on TDengine based on the default configuration.
|
||||
|
||||
Execute the following command to quickly experience taosBenchmark performing a write performance test on TDengine based on the default configuration.
|
||||
```shell
|
||||
taosBenchmark
|
||||
```
|
||||
|
||||
When running without parameters, taosBenchmark by default connects to the TDengine cluster specified under `/etc/taos`, and creates a database named `test` in TDengine, under which a supertable named `meters` is created, and 10,000 tables are created under the supertable, each table having 10,000 records inserted. Note that if a `test` database already exists, this command will delete the existing database and create a new `test` database.
|
||||
When running without parameters, taosBenchmark defaults to connecting to the TDengine cluster specified in `/etc/taos/taos.cfg `.
|
||||
After successful connection, a smart meter example database test, super meters, and 10000 sub meters will be created, with 10000 records per sub meter. If the test database already exists, it will be deleted before creating a new one.
|
||||
|
||||
### Running Using Command Line Configuration Parameters
|
||||
|
||||
|
@ -46,9 +49,7 @@ The above command `taosBenchmark` will create a database named `test`, establish
|
|||
|
||||
### Running Using a Configuration File
|
||||
|
||||
The taosBenchmark installation package includes examples of configuration files, located in `<install_directory>/examples/taosbenchmark-json`
|
||||
|
||||
Use the following command line to run taosBenchmark and control its behavior through a configuration file.
|
||||
Running in configuration file mode provides all functions, so parameters can be configured to run in the configuration file.
|
||||
|
||||
```shell
|
||||
taosBenchmark -f <json file>
|
||||
|
@ -214,6 +215,61 @@ taosBenchmark -A INT,DOUBLE,NCHAR,BINARY\(16\)
|
|||
- **-?/--help**:
|
||||
Displays help information and exits. Cannot be used with other parameters.
|
||||
|
||||
|
||||
## Output performance indicators
|
||||
|
||||
#### Write indicators
|
||||
|
||||
After writing is completed, a summary performance metric will be output in the last two lines in the following format:
|
||||
``` bash
|
||||
SUCC: Spent 8.527298 (real 8.117379) seconds to insert rows: 10000000 with 8 thread(s) into test 1172704.41 (real 1231924.74) records/second
|
||||
SUCC: insert delay, min: 19.6780ms, avg: 64.9390ms, p90: 94.6900ms, p95: 105.1870ms, p99: 130.6660ms, max: 157.0830ms
|
||||
```
|
||||
First line write speed statistics:
|
||||
- Spent: Total write time, in seconds, counting from the start of writing the first data to the end of the last data. This indicates that a total of 8.527298 seconds were spent
|
||||
- Real: Total write time (calling the engine), excluding the time spent preparing data for the testing framework. Purely counting the time spent on engine calls, The time spent is 8.117379 seconds. If 8.527298-8.117379=0.409919 seconds, it is the time spent preparing data for the testing framework
|
||||
- Rows: Write the total number of rows, which is 10 million pieces of data
|
||||
- Threads: The number of threads being written, which is 8 threads writing simultaneously
|
||||
- Records/second write speed = `total write time` / `total number of rows written`, real in parentheses is the same as before, indicating pure engine write speed
|
||||
|
||||
Second line single write delay statistics:
|
||||
- min: Write minimum delay
|
||||
- avg: Write normal delay
|
||||
- p90: Write delay p90 percentile delay number
|
||||
- p95: Write delay p95 percentile delay number
|
||||
- p99: Write delay p99 percentile delay number
|
||||
- max: maximum write delay
|
||||
Through this series of indicators, the distribution of write request latency can be observed
|
||||
|
||||
#### Query indicators
|
||||
The query performance test mainly outputs the QPS indicator of query request speed, and the output format is as follows:
|
||||
|
||||
``` bash
|
||||
complete query with 3 threads and 10000 query delay avg: 0.002686s min: 0.001182s max: 0.012189s p90: 0.002977s p95: 0.003493s p99: 0.004645s SQL command: select ...
|
||||
INFO: Total specified queries: 30000
|
||||
INFO: Spend 26.9530 second completed total queries: 30000, the QPS of all threads: 1113.049
|
||||
```
|
||||
|
||||
- The first line represents the percentile distribution of query execution and query request delay for each of the three threads executing 10000 queries. The SQL command is the test query statement
|
||||
- The second line indicates that a total of 10000 * 3 = 30000 queries have been completed
|
||||
- The third line indicates that the total query time is 26.9653 seconds, and the query rate per second (QPS) is 1113.049 times/second
|
||||
|
||||
#### Subscription metrics
|
||||
|
||||
The subscription performance test mainly outputs consumer consumption speed indicators, with the following output format:
|
||||
``` bash
|
||||
INFO: consumer id 0 has poll total msgs: 376, period rate: 37.592 msgs/s, total rows: 3760000, period rate: 375924.815 rows/s
|
||||
INFO: consumer id 1 has poll total msgs: 362, period rate: 36.131 msgs/s, total rows: 3620000, period rate: 361313.504 rows/s
|
||||
INFO: consumer id 2 has poll total msgs: 364, period rate: 36.378 msgs/s, total rows: 3640000, period rate: 363781.731 rows/s
|
||||
INFO: consumerId: 0, consume msgs: 1000, consume rows: 10000000
|
||||
INFO: consumerId: 1, consume msgs: 1000, consume rows: 10000000
|
||||
INFO: consumerId: 2, consume msgs: 1000, consume rows: 10000000
|
||||
INFO: Consumed total msgs: 3000, total rows: 30000000
|
||||
```
|
||||
- Lines 1 to 3 real-time output of the current consumption speed of each consumer, msgs/s represents the number of consumption messages, each message contains multiple rows of data, and rows/s represents the consumption speed calculated by rows
|
||||
- Lines 4 to 6 show the overall statistics of each consumer after the test is completed, including the total number of messages consumed and the total number of lines
|
||||
- The overall statistics of all consumers in line 7, `msgs` represents how many messages were consumed in total, `rows` represents how many rows of data were consumed in total
|
||||
|
||||
## Configuration File Parameters Detailed Explanation
|
||||
|
||||
### General Configuration Parameters
|
||||
|
@ -331,21 +387,6 @@ Parameters related to supertable creation are configured in the `super_tables` s
|
|||
- **repeat_ts_max** : Numeric type, when composite primary key is enabled, specifies the maximum number of records with the same timestamp to be generated
|
||||
- **sqls** : Array of strings type, specifies the array of sql to be executed after the supertable is successfully created, the table name specified in sql must be prefixed with the database name, otherwise an unspecified database error will occur
|
||||
|
||||
#### tsma Configuration Parameters
|
||||
|
||||
Specify the configuration parameters for tsma in `super_tables` under `tsmas`, with the following specific parameters:
|
||||
|
||||
- **name**: Specifies the name of the tsma, mandatory.
|
||||
|
||||
- **function**: Specifies the function of the tsma, mandatory.
|
||||
|
||||
- **interval**: Specifies the time interval for the tsma, mandatory.
|
||||
|
||||
- **sliding**: Specifies the window time shift for the tsma, mandatory.
|
||||
|
||||
- **custom**: Specifies custom configuration appended at the end of the tsma creation statement, optional.
|
||||
|
||||
- **start_when_inserted**: Specifies when to create the tsma after how many rows are inserted, optional, default is 0.
|
||||
|
||||
#### Tag and Data Column Configuration Parameters
|
||||
|
||||
|
@ -423,6 +464,11 @@ For other common parameters, see Common Configuration Parameters.
|
|||
|
||||
Configuration parameters for querying specified tables (can specify supertables, subtables, or regular tables) are set in `specified_table_query`.
|
||||
|
||||
- **mixed_query** "yes": `Mixed Query` "no": `Normal Query`, default is "no"
|
||||
`Mixed Query`: All SQL statements in `sqls` are grouped by the number of threads, with each thread executing one group. Each SQL statement in a thread needs to perform `query_times` queries.
|
||||
`Normal Query `: Each SQL in `sqls` starts `threads` and exits after executing `query_times` times. The next SQL can only be executed after all previous SQL threads have finished executing and exited.
|
||||
Regardless of whether it is a `Normal Query` or `Mixed Query`, the total number of query executions is the same. The total number of queries = `sqls` * `threads` * `query_times`. The difference is that `Normal Query` starts `threads` for each SQL query, while ` Mixed Query` only starts `threads` once to complete all SQL queries. The number of thread startups for the two is different.
|
||||
|
||||
- **query_interval** : Query interval, in seconds, default is 0.
|
||||
|
||||
- **threads** : Number of threads executing the SQL query, default is 1.
|
||||
|
@ -433,7 +479,8 @@ Configuration parameters for querying specified tables (can specify supertables,
|
|||
|
||||
#### Configuration Parameters for Querying Supertables
|
||||
|
||||
Configuration parameters for querying supertables are set in `super_table_query`.
|
||||
Configuration parameters for querying supertables are set in `super_table_query`.
|
||||
The thread mode of the super table query is the same as the `Normal Query` mode of the specified query statement described above, except that `sqls` is filled all sub tables.
|
||||
|
||||
- **stblname** : The name of the supertable to query, required.
|
||||
|
||||
|
|
|
@ -386,7 +386,7 @@ This document details the server error codes that may be encountered when using
|
|||
| 0x8000260D | Tags number not matched | Mismatched number of tag columns | Check and correct the SQL statement |
|
||||
| 0x8000260E | Invalid tag name | Invalid or non-existent tag name | Check and correct the SQL statement |
|
||||
| 0x80002610 | Value is too long | Value length exceeds limit | Check and correct the SQL statement or API parameters |
|
||||
| 0x80002611 | Password can not be empty | Password is empty | Use a valid password |
|
||||
| 0x80002611 | Password too short or empty | Password is empty or less than 8 chars | Use a valid password |
|
||||
| 0x80002612 | Port should be an integer that is less than 65535 and greater than 0 | Illegal port number | Check and correct the port number |
|
||||
| 0x80002613 | Endpoint should be in the format of 'fqdn:port' | Incorrect address format | Check and correct the address information |
|
||||
| 0x80002614 | This statement is no longer supported | Feature has been deprecated | Refer to the feature documentation |
|
||||
|
|
|
@ -166,6 +166,12 @@ json 数据支持 JSONObject 或者 JSONArray,使用 json 解析器可以解
|
|||
|
||||

|
||||
|
||||
### 8. 创建完成
|
||||
### 8. 异常处理策略
|
||||
|
||||
import Contributing from './_03-exception-handling-strategy.mdx'
|
||||
|
||||
<Contributing />
|
||||
|
||||
### 9. 创建完成
|
||||
|
||||
点击 **提交** 按钮,完成创建 MQTT 到 TDengine 的数据同步任务,回到**数据源列表**页面可查看任务执行情况。
|
|
@ -196,12 +196,16 @@ json 数据支持 JSONObject 或者 JSONArray,使用 json 解析器可以解
|
|||
|
||||
### 8. 配置高级选项
|
||||
|
||||
**高级选项** 区域是默认折叠的,点击右侧 `>` 可以展开,如下图所示:
|
||||
import AdvancedOptions from './_02-advanced_options.mdx'
|
||||
|
||||

|
||||
<AdvancedOptions/>
|
||||
|
||||

|
||||
### 9. 异常处理策略
|
||||
|
||||
### 9. 创建完成
|
||||
import Contributing from './_03-exception-handling-strategy.mdx'
|
||||
|
||||
<Contributing />
|
||||
|
||||
### 10. 创建完成
|
||||
|
||||
点击 **提交** 按钮,完成创建 Kafka 到 TDengine 的数据同步任务,回到**数据源列表**页面可查看任务执行情况。
|
|
@ -75,9 +75,9 @@ InfluxDB 是一种流行的开源时间序列数据库,它针对处理大量
|
|||
|
||||
### 6. 配置高级选项
|
||||
|
||||
**高级选项** 区域是默认折叠的,点击右侧 `>` 可以展开,如下图所示:
|
||||

|
||||

|
||||
import AdvancedOptions from './_02-advanced_options.mdx'
|
||||
|
||||
<AdvancedOptions/>
|
||||
|
||||
### 7. 创建完成
|
||||
|
|
@ -58,9 +58,9 @@ OpenTSDB 是一个架构在 HBase 系统之上的实时监控信息收集和展
|
|||
|
||||
### 5. 配置高级选项
|
||||
|
||||
**高级选项** 区域是默认折叠的,点击右侧 `>` 可以展开,如下图所示:
|
||||

|
||||

|
||||
import AdvancedOptions from './_02-advanced_options.mdx'
|
||||
|
||||
<AdvancedOptions/>
|
||||
|
||||
### 6. 创建完成
|
||||
|
|
@ -107,13 +107,25 @@ sidebar_label: "CSV"
|
|||
|
||||

|
||||
|
||||
### 5. 创建完成
|
||||
### 5. 配置高级选项
|
||||
|
||||
import AdvancedOptions from './_02-advanced_options.mdx'
|
||||
|
||||
<AdvancedOptions/>
|
||||
|
||||
### 6. 异常处理策略
|
||||
|
||||
import Contributing from './_03-exception-handling-strategy.mdx'
|
||||
|
||||
<Contributing />
|
||||
|
||||
### 7. 创建完成
|
||||
|
||||
点击 **提交** 按钮,完成创建 CSV 到 TDengine 的数据同步任务,回到数据写入任务列表页面,可查看任务执行情况,也可以进行任务的“启动/停止”操作与“查看/编辑/删除/复制”操作。
|
||||
|
||||

|
||||
|
||||
### 6. 查看运行指标
|
||||
### 8. 查看运行指标
|
||||
|
||||
点击 **查看** 按钮,查看任务的运行指标,同时也可以查看任务中所有文件的处理情况。
|
||||
|
|
@ -134,6 +134,12 @@ split 提取器,seperator 填写分割符 `,`, number 填写 2。
|
|||
|
||||

|
||||
|
||||
### 7. 创建完成
|
||||
### 7. 异常处理策略
|
||||
|
||||
import Contributing from './_03-exception-handling-strategy.mdx'
|
||||
|
||||
<Contributing />
|
||||
|
||||
### 8. 创建完成
|
||||
|
||||
点击 **提交** 按钮,完成创建任务。提交任务后,回到**数据写入**页面可以查看任务状态。
|
|
@ -98,14 +98,16 @@ MySQL 是最流行的关系型数据库之一。很多系统都曾经或正在
|
|||
|
||||
### 8. 配置高级选项
|
||||
|
||||
**高级选项** 区域是默认折叠的,点击右侧 `>` 可以展开,如下图所示:
|
||||
import AdvancedOptions from './_02-advanced_options.mdx'
|
||||
|
||||
**最大读取并发数** 数据源连接数或读取线程数限制,当默认参数不满足需要或需要调整资源使用量时修改此参数。
|
||||
<AdvancedOptions/>
|
||||
|
||||
**批次大小** 单次发送的最大消息数或行数。默认是 10000。
|
||||
### 9. 异常处理策略
|
||||
|
||||

|
||||
import Contributing from './_03-exception-handling-strategy.mdx'
|
||||
|
||||
### 9. 创建完成
|
||||
<Contributing />
|
||||
|
||||
### 10. 创建完成
|
||||
|
||||
点击 **提交** 按钮,完成创建 MySQL 到 TDengine 的数据同步任务,回到**数据源列表**页面可查看任务执行情况。
|
|
@ -99,14 +99,16 @@ TDengine 可以高效地从 PostgreSQL 读取数据并将其写入 TDengine,
|
|||
|
||||
### 8. 配置高级选项
|
||||
|
||||
**高级选项** 区域是默认折叠的,点击右侧 `>` 可以展开,如下图所示:
|
||||
import AdvancedOptions from './_02-advanced_options.mdx'
|
||||
|
||||
**最大读取并发数** 数据源连接数或读取线程数限制,当默认参数不满足需要或需要调整资源使用量时修改此参数。
|
||||
<AdvancedOptions/>
|
||||
|
||||
**批次大小** 单次发送的最大消息数或行数。默认是 10000。
|
||||
### 9. 异常处理策略
|
||||
|
||||

|
||||
import Contributing from './_03-exception-handling-strategy.mdx'
|
||||
|
||||
### 9. 创建完成
|
||||
<Contributing />
|
||||
|
||||
### 10. 创建完成
|
||||
|
||||
点击 **提交** 按钮,完成创建 PostgreSQL 到 TDengine 的数据同步任务,回到**数据源列表**页面可查看任务执行情况。
|
|
@ -91,14 +91,16 @@ TDengine 可以高效地从 Oracle 读取数据并将其写入 TDengine,以实
|
|||
|
||||
### 7. 配置高级选项
|
||||
|
||||
**高级选项** 区域是默认折叠的,点击右侧 `>` 可以展开,如下图所示:
|
||||
import AdvancedOptions from './_02-advanced_options.mdx'
|
||||
|
||||
**最大读取并发数** 数据源连接数或读取线程数限制,当默认参数不满足需要或需要调整资源使用量时修改此参数。
|
||||
<AdvancedOptions/>
|
||||
|
||||
**批次大小** 单次发送的最大消息数或行数。默认是 10000。
|
||||
### 8. 异常处理策略
|
||||
|
||||

|
||||
import Contributing from './_03-exception-handling-strategy.mdx'
|
||||
|
||||
### 8. 创建完成
|
||||
<Contributing />
|
||||
|
||||
### 9. 创建完成
|
||||
|
||||
点击 **提交** 按钮,完成创建 Oracle 到 TDengine 的数据同步任务,回到**数据源列表****页面可查看任务执行情况。
|
|
@ -105,14 +105,16 @@ Microsoft SQL Server 是最流行的关系型数据库之一。很多系统都
|
|||
|
||||
### 8. 配置高级选项
|
||||
|
||||
**高级选项** 区域是默认折叠的,点击右侧 `>` 可以展开,如下图所示:
|
||||
import AdvancedOptions from './_02-advanced_options.mdx'
|
||||
|
||||
**最大读取并发数** 数据源连接数或读取线程数限制,当默认参数不满足需要或需要调整资源使用量时修改此参数。
|
||||
<AdvancedOptions/>
|
||||
|
||||
**批次大小** 单次发送的最大消息数或行数。默认是 10000。
|
||||
### 9. 异常处理策略
|
||||
|
||||

|
||||
import Contributing from './_03-exception-handling-strategy.mdx'
|
||||
|
||||
### 9. 创建完成
|
||||
<Contributing />
|
||||
|
||||
### 10. 创建完成
|
||||
|
||||
点击 **提交** 按钮,完成创建 Microsoft SQL Server 到 TDengine 的数据同步任务,回到**数据源列表**页面可查看任务执行情况。
|
|
@ -122,14 +122,16 @@ MongoDB 是一个介于关系型数据库与非关系型数据库之间的产品
|
|||
|
||||
### 8. 配置高级选项
|
||||
|
||||
**高级选项** 区域是默认折叠的,点击右侧 `>` 可以展开,如下图所示:
|
||||
import AdvancedOptions from './_02-advanced_options.mdx'
|
||||
|
||||
**最大读取并发数** 数据源连接数或读取线程数限制,当默认参数不满足需要或需要调整资源使用量时修改此参数。
|
||||
<AdvancedOptions/>
|
||||
|
||||
**批次大小** 单次发送的最大消息数或行数。默认是 10000。
|
||||
### 9. 异常处理策略
|
||||
|
||||

|
||||
import Contributing from './_03-exception-handling-strategy.mdx'
|
||||
|
||||
### 9. 创建完成
|
||||
<Contributing />
|
||||
|
||||
### 10. 创建完成
|
||||
|
||||
点击 **提交** 按钮,完成创建 MongoDB 到 TDengine 的数据同步任务,回到**数据源列表**页面可查看任务执行情况。
|
|
@ -0,0 +1,7 @@
|
|||
**高级选项** 区域是默认折叠的,点击右侧 `>` 可以展开,如下图所示:
|
||||
|
||||
**最大读取并发数** 数据源连接数或读取线程数限制,当默认参数不满足需要或需要调整资源使用量时修改此参数。
|
||||
|
||||
**批次大小** 单次发送的最大消息数或行数。默认是 10000。
|
||||
|
||||

|
|
@ -0,0 +1,23 @@
|
|||
异常处理策略区域是对数据异常时的处理策略进行配置,默认折叠的,点击右侧 `>` 可以展开,如下图所示:
|
||||
|
||||

|
||||
|
||||
各异常项说明及相应可选处理策略如下:
|
||||
|
||||
> 通用处理策略说明:
|
||||
> 归档:将异常数据写入归档文件(默认路径为 `${data_dir}/tasks/_id/.datetime`),不写入目标库
|
||||
> 丢弃:将异常数据忽略,不写入目标库
|
||||
> 报错:任务报错
|
||||
|
||||
- **主键时间戳溢出** 检查数据中第一列时间戳是否在正确的时间范围内(now - keep1, now + 100y),可选处理策略:归档、丢弃、报错
|
||||
- **主键时间戳空** 检查数据中第一列时间戳是否为空,可选处理策略:归档、丢弃、报错、使用当前时间
|
||||
> 使用当前时间:使用当前时间填充到空的时间戳字段中
|
||||
- **表名长度溢出** 检查子表表名的长度是否超出限制(最大 192 字符),可选处理策略:归档、丢弃、报错、截断、截断且归档
|
||||
> 截断:截取原始表名的前 192 个字符作为新的表名
|
||||
> 截断且归档:截取原始表名的前 192 个字符作为新的表名,并且将此行记录写入归档文件
|
||||
- **表名非法字符** 检查子表表名中是否包含特殊字符(符号 `.` 等),可选处理策略:归档、丢弃、报错、非法字符替换为指定字符串
|
||||
> 非法字符替换为指定字符串:将原始表名中的特殊字符替换为后方输入框中的指定字符串,例如 `a.b` 替换为 `a_b`
|
||||
- **表名模板变量空值** 检查子表表名模板中的变量是否为空,可选处理策略:丢弃、留空、变量替换为指定字符串
|
||||
> 留空:变量位置不做任何特殊处理,例如 `a_{x}` 转换为 `a_`
|
||||
> 变量替换为指定字符串:变量位置使用后方输入框中的指定字符串,例如 `a_{x}` 转换为 `a_b`
|
||||
- **列名长度溢出** 检查列名的长度是否超出限制(最大 64 字符),可选处理策略:归档、丢弃、报错
|
Before Width: | Height: | Size: 6.7 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 7.2 KiB |
Before Width: | Height: | Size: 98 KiB |
Before Width: | Height: | Size: 7.2 KiB |
Before Width: | Height: | Size: 97 KiB |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 43 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 31 KiB |
Before Width: | Height: | Size: 31 KiB |
Before Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 31 KiB |
|
@ -6,45 +6,154 @@ toc_max_heading_level: 4
|
|||
|
||||
为了防止数据丢失、误删操作,TDengine 提供全面的数据备份、恢复、容错、异地数据实时同步等功能,以保证数据存储的安全。本节简要说明备份和恢复功能。
|
||||
|
||||
## 基于 taosdump 进行数据备份恢复
|
||||
# 1. 基于 taosdump 进行数据备份恢复
|
||||
|
||||
taosdump 是一个开源工具,用于支持从运行中的 TDengine 集群备份数据并将备份的数据恢复到相同或另一个正在运行的 TDengine 集群中。taosdump 可以将数据库作为逻辑数据单元进行备份,也可以对数据库中指定时间段内的数据记录进行备份。在使用taosdump 时,可以指定数据备份的目录路径。如果不指定目录路径,taosdump 将默认将数据备份到当前目录。
|
||||
taosdump 是一个开源工具,用于支持从运行中的 TDengine 集群备份数据并将备份的数据恢复到相同或另一个正在运行的 TDengine
|
||||
集群中。taosdump 可以将数据库作为逻辑数据单元进行备份,也可以对数据库中指定时间段内的数据记录进行备份。在使用taosdump
|
||||
时,可以指定数据备份的目录路径。如果不指定目录路径,taosdump 将默认将数据备份到当前目录。
|
||||
|
||||
以下为 taosdump 执行数据备份的使用示例。
|
||||
|
||||
```shell
|
||||
taosdump -h localhost -P 6030 -D dbname -o /file/path
|
||||
```
|
||||
|
||||
执行上述命令后,taosdump 会连接 localhost:6030 所在的 TDengine 集群,查询数据库 dbname 中的所有数据,并将数据备份到 /f ile/path 下。
|
||||
执行上述命令后,taosdump 会连接 localhost:6030 所在的 TDengine 集群,查询数据库 dbname 中的所有数据,并将数据备份到 /f
|
||||
ile/path 下。
|
||||
|
||||
在使用 taosdump 时,如果指定的存储路径已经包含数据文件,taosdump 会提示用户并立即退出,以避免数据被覆盖。这意味着同一存储路径只能用于一次备份。如果你看到相关提示,请谨慎操作,以免误操作导致数据丢失。
|
||||
在使用 taosdump 时,如果指定的存储路径已经包含数据文件,taosdump
|
||||
会提示用户并立即退出,以避免数据被覆盖。这意味着同一存储路径只能用于一次备份。如果你看到相关提示,请谨慎操作,以免误操作导致数据丢失。
|
||||
|
||||
要将本地指定文件路径中的数据文件恢复到正在运行的 TDengine 集群中,可以通过指定命令行参数和数据文件所在路径来执行 taosdump
|
||||
命令。以下为 taosdump 执行数据恢复的示例代码。
|
||||
|
||||
要将本地指定文件路径中的数据文件恢复到正在运行的 TDengine 集群中,可以通过指定命令行参数和数据文件所在路径来执行 taosdump 命令。以下为 taosdump 执行数据恢复的示例代码。
|
||||
```shell
|
||||
taosdump -i /file/path -h localhost -P 6030
|
||||
```
|
||||
|
||||
执行上述命令后,taosdump 会连接 localhost:6030 所在的 TDengine 集群,并将 /file/path 下的数据文件恢复到 TDengine 集群中。
|
||||
|
||||
## 基于 TDengine Enterprise 进行数据备份恢复
|
||||
# 2. 基于 TDengine Enterprise 进行数据备份恢复
|
||||
|
||||
TDengine Enterprise 提供了一个高效的增量备份功能,具体流程如下。
|
||||
## 2.1. 概念
|
||||
|
||||
第 1 步,通过浏览器访问 taosExplorer 服务,访问地址通常为 TDengine 集群所在 IP 地址的端口 6060,如 http://localhost:6060。
|
||||
基于 TDengine 的数据订阅功能,TDengine Enterprise 实现了数据的增量备份和恢复。用户可以通过 taosExplorer 对 TDengine
|
||||
集群进行备份和恢复。
|
||||
|
||||
第 2 步,在 taosExplorer 服务页面中的“系统管理 - 备份”页面新增一个数据备份任务,在任务配置信息中填写需要备份的数据库名称和备份存储文件路径,完成创建任务
|
||||
后即可启动数据备份。 在数据备份配置页面中可以配置三个参数:
|
||||
- 备份周期:必填项,配置每次执行数据备份的时间间隔,可通过下拉框选择每天、每 7 天、每 30 天执行一次数据备份,配置后,会在对应的备份周期的0:00时启动一次数据备份任务;
|
||||
- 数据库:必填项,配置需要备份的数据库名(数据库的 wal_retention_period 参数需大于0);
|
||||
- 目录:必填项,配置将数据备份到 taosX 所在运行环境中指定的路径下,如 /root/data_backup;
|
||||
TDengine Enterprise 的备份和恢复功能包括以下几个概念:
|
||||
|
||||
第 3 步,在数据备份任务完成后,在相同页面的已创建任务列表中找到创建的数据备份任务,直接执行一键恢复,就能够将数据恢复到 TDengine 中。
|
||||
1. 备份对象:用户可以对一个数据库,或者一个超级表进行备份。
|
||||
2. 备份计划:用户可以为某个备份对象创建一个备份计划。备份计划从指定的时间点开始,周期性的执行一次备份任务,并生成一组备份文件。
|
||||
3. 备份点:每执行一次备份任务,生成一组备份文件,它们对应一个时间点,称为**备份点**。第一个备份点称为**初始备份点**。
|
||||
4. 备份文件:多个备份点,组成备份计划的备份文件。
|
||||
5. 恢复任务:用户可以选择备份计划的某个备份点,创建一个恢复任务。恢复任务会从初始备份点开始,逐个应用备份点,恢复到指定的备份点。
|
||||
|
||||
与 taosdump 相比,如果对相同的数据在指定存储路径下进行多次备份操作,由于TDengine Enterprise 不仅备份效率高,而且实行的是增量处理,因此每次备份任务都会很快完成。而由于 taosdump 永远是全量备份,因此 TDengine Enterprise 在数据量较大的场景下可以显著减小系统开销,而且更加方便。
|
||||

|
||||
|
||||
**常见错误排查**
|
||||
以上面的图为例:
|
||||
|
||||
1. 如果任务启动失败并报以下错误:
|
||||
1. 用户创建了一个备份计划,从 2024-08-27 00:00:00 开始,每隔 1 天执行一次备份任务。
|
||||
2. 在 2024-08-27 00:00:00 执行了第一次备份任务,生成了一个备份点。
|
||||
3. 之后,每隔 1 天执行一次备份任务,生成了多个备份点,组成了备份文件。
|
||||
4. 用户可以选择某个备份点,创建一个恢复任务,恢复到指定的备份点。
|
||||
5. 恢复任务会从初始备份点开始,逐个应用备份点,恢复到指定的备份点。
|
||||
|
||||
## 2.2. 备份计划
|
||||
|
||||
### 2.1.1. 创建
|
||||
|
||||
1. 通过浏览器访问 taosExplorer 服务,访问地址通常为 TDengine 集群所在 IP 地址的端口 6060,如 http://localhost:6060。
|
||||
2. 在 taosExplorer 服务页面中,进入“系统管理 - 备份”页面,点击“创建备份计划”按钮。
|
||||
|
||||

|
||||
|
||||
3. 在弹出的“创建备份计划”表单中,填写备份计划的相关信息。
|
||||
|
||||

|
||||
|
||||
需要填写的信息包括:
|
||||
|
||||
* 数据库:需要备份的数据库名称。一个备份计划只能备份一个数据库/超级表。
|
||||
* 超级表:需要备份的超级表名称。如果不填写,则备份整个数据库。
|
||||
* 下次执行时间:首次执行备份任务的日期时间。
|
||||
* 备份周期:备份点之间的时间间隔。注意:备份周期必须大于数据库的 WAL_RETENTION_PERIOD 参数值。
|
||||
* 错误重试次数:对于可通过重试解决的错误,系统会按照此次数进行重试。
|
||||
* 错误重试间隔:每次重试之间的时间间隔。
|
||||
* 目录:存储备份文件的目录。
|
||||
* 备份文件大小:备份文件的大小限制。当备份文件大小达到此限制时,会自动创建新的备份文件。
|
||||
* 文件压缩等级:备份文件的压缩等级。支持:最快速度、最佳压缩比、兼具速度和压缩比。
|
||||
|
||||
创建成功后,备份计划会开始按照配置的参数运行。
|
||||
|
||||
### 2.1.2. 查看
|
||||
|
||||
在“备份计划”下的列表中,可以查看已创建的备份计划。
|
||||
|
||||

|
||||
|
||||
点击“操作”中的“查看”按钮,可以查看备份计划的详细信息。
|
||||
|
||||

|
||||
|
||||
### 2.1.3. 修改
|
||||
|
||||
点击“操作”中的“修改”按钮,可以修改备份计划的配置。
|
||||
|
||||

|
||||
|
||||
修改备份计划的配置后,当前运行的备份任务会先停止,然后按照新的配置重新运行。
|
||||
|
||||
### 2.1.4. 复制
|
||||
|
||||
点击“操作”中的“复制”按钮,可以复制备份计划。
|
||||
|
||||

|
||||
|
||||
除了数据库和超级表被置为空外,其他配置项和被复制的计划相同。用户点击“确认”后,创建一个新的备份计划。
|
||||
|
||||
### 2.1.5. 删除
|
||||
|
||||
在操作中点击关闭按钮,可以停止当前备份计划。点击“操作”中的“删除”按钮,可以删除备份计划。
|
||||
|
||||

|
||||
|
||||
删除备份计划时,可以选择,是否删除关联的备份文件。
|
||||
|
||||
## 2.2. 备份文件
|
||||
|
||||
### 2.2.1. 查看
|
||||
|
||||
在备份计划列表中,选择要一个备份计划。在“备份文件”列中,点击“查看”按钮。可以查看和备份计划的所有备份点。
|
||||
|
||||

|
||||
|
||||
在备份文件列表中,可以查看备份文件的详细信息。
|
||||
|
||||

|
||||
|
||||
## 2.3. 恢复任务
|
||||
|
||||
### 2.3.1. 创建
|
||||
|
||||
在备份文件列表中,点击“操作”中的“恢复”按钮,可以创建一个恢复任务。
|
||||
|
||||

|
||||
|
||||
在弹出的对话框中,选择使用哪个备份点开始恢复,默认为最早的备份点。点击“确定”后,创建恢复任务,并跳转至“恢复任务”列表。
|
||||
|
||||
### 2.3.2. 查看
|
||||
|
||||
在“恢复任务”列表中,可以查看已创建的恢复任务。
|
||||
|
||||

|
||||
|
||||
恢复任务可以终止。点击“操作”中的开关,可以终止当前恢复任务。
|
||||
|
||||
# 3. 常见错误排查
|
||||
|
||||
## 3.1. 端口访问异常
|
||||
|
||||
如果任务启动失败并报以下错误:
|
||||
|
||||
```text
|
||||
Error: tmq to td task exec error
|
||||
|
@ -52,9 +161,12 @@ Error: tmq to td task exec error
|
|||
Caused by:
|
||||
[0x000B] Unable to establish connection
|
||||
```
|
||||
|
||||
产生原因是与数据源的端口链接异常,需检查数据源 FQDN 是否联通及端口 6030 是否可正常访问。
|
||||
|
||||
2. 如果使用 WebSocket 连接,任务启动失败并报以下错误:
|
||||
## 3.2. 连接异常
|
||||
|
||||
如果使用 WebSocket 连接,任务启动失败并报以下错误:
|
||||
|
||||
```text
|
||||
Error: tmq to td task exec error
|
||||
|
@ -73,7 +185,9 @@ Caused by:
|
|||
- "HTTP error: *": 可能连接到错误的 taosAdapter 端口或 LSB/Nginx/Proxy 配置错误。
|
||||
- "WebSocket protocol error: Handshake not finished": WebSocket 连接错误,通常是因为配置的端口不正确。
|
||||
|
||||
3. 如果任务启动失败并报以下错误:
|
||||
## 3.3. 任务启动失败
|
||||
|
||||
如果任务启动失败并报以下错误:
|
||||
|
||||
```text
|
||||
Error: tmq to td task exec error
|
||||
|
@ -88,5 +202,6 @@ Caused by:
|
|||
修改数据 WAL 配置:
|
||||
|
||||
```sql
|
||||
alter database test wal_retention_period 3600;
|
||||
alter
|
||||
database test wal_retention_period 3600;
|
||||
```
|
|
@ -0,0 +1,66 @@
|
|||
---
|
||||
title: 三副本方案
|
||||
sidebar_label: 三副本方案
|
||||
toc_max_heading_level: 4
|
||||
---
|
||||
|
||||
TDengine 的三副本方案采用 RAFT 算法来实现数据的一致性,包括元数据和时序数据。一个虚拟节点组(VGroup)构成了一个 RAFT 组;VGroup 中的虚拟节点(Vnode),便是该 RAFT 组的成员节点,也称之为副本。
|
||||
|
||||
1. 每个 Vnode 都有自己的角色,可以是 Leader(领导者)、Follower(跟随者)、Candidate(候选人)。
|
||||
2. 每个 Vnode 都维护了一份连续的日志,用于记录数据写入、变更、或删除等操作的所有指令。日志是由一系列有序的日志条目组成,每条日志都有唯一的编号,用于标识日志协商或执行的进度。
|
||||
3. Leader 角色的 Vnode 提供读写服务,在故障节点不超过半数的情况下保证集群的高可用性。此外,即使发生了节点重启及 Leader 重新选举等事件后,RAFT 协议也能够始终保证新产生的 Leader 可以提供已经写入成功的全部完整数据的读写服务。
|
||||
4. 每一次对数据库的变更请求(比如数据写入),都对应一条日志。在持续写入数据的过程中,会按照协议机制在每个成员节点上产生完全相同的日志记录,并且以相同的顺序执行数据变更操作,以 WAL 文件的形式存储在数据文件目录中。
|
||||
5. 只有当过半数的节点把该条日志追加到 WAL 文件,并且收到确认消息之后,这条日志才会被 Leader 认为是安全的;此时该日志进入 committed 状态,完成数据的插入,随后该日志被标记为 applied 的状态。
|
||||
|
||||
多副本工作原理参见 [数据写入与复制流程](../../26-tdinternal/01-arch.md#数据写入与复制流程)
|
||||
|
||||
## 集群配置
|
||||
|
||||
三副本要求集群至少配置三个服务器节点,基本部署与配置步骤如下:
|
||||
1. 确定服务器节点数量、主机名或域名,配置好所有节点的域名解析:DNS 或 /etc/hosts
|
||||
2. 各节点分别安装 TDengine 服务端安装包,按需编辑好各节点 taos.cfg
|
||||
3. 启动各节点 taosd 服务,其他服务可按需启动(taosadapter/taosx/taoskeeper/taos-explorer)
|
||||
|
||||
## 运维命令
|
||||
|
||||
### 创建集群
|
||||
|
||||
创建三节点的集群
|
||||
|
||||
```sql
|
||||
CREATE dnode <dnode_ep> port <dnode_port>;
|
||||
CREATE dnode <dnode_ep> port <dnode_port>;
|
||||
```
|
||||
|
||||
创建三副本的 Mnode,保证 Mnode 高可用
|
||||
|
||||
```sql
|
||||
CREATE mnode on dnode <dnode_id>;
|
||||
CREATE mnode on dnode <dnode_id>;
|
||||
```
|
||||
|
||||
### 数据库创建
|
||||
|
||||
创建三副本的数据库
|
||||
|
||||
```sql
|
||||
create database <dbname> replica 3 vgroups xx buffer xx ...
|
||||
```
|
||||
|
||||
### 修改数据库副本数
|
||||
|
||||
创建了单副本数据库后,如果希望改为三副本时,可通过 alter 命令来实现,反之亦然
|
||||
|
||||
```sql
|
||||
alter database <dbname> replica 3|1
|
||||
```
|
||||
|
||||
## 常见问题
|
||||
|
||||
### 1. 创建三副本数据库或修改为三副本时,报错:DB error: Out of dnodes
|
||||
- 服务器节点数不足:原因是服务器节点数少于三个。
|
||||
- 解决方案:增加服务器节点数量,满足最低要求。
|
||||
|
||||
### 2. 创建三副本数据库或 split vgroup 时,报错:DB error: Vnodes exhausted
|
||||
- 服务器可用 Vnodes 不足:原因是某些服务器节点可用 Vnodes 数少于建库或 split vgroup 的需求数。
|
||||
- 解决方案:调整服务器 CPU 数量、SupportVnodes 配置参数,满足建库要求。
|
|
@ -0,0 +1,84 @@
|
|||
---
|
||||
title: 双副本方案
|
||||
sidebar_label: 双副本方案
|
||||
toc_max_heading_level: 4
|
||||
---
|
||||
|
||||
部分用户期望在保证一定可靠性、可用性条件下,尽可能压缩部署成本。为此,TDengine 提出基于 Arbitrator 的双副本方案,可提供集群中**只有单个服务故障且不出现连续故障**的容错能力。双副本方案是 TDengine Enterprise 特有功能,在 3.3.0.0 版本中第一次发布,建议使用最新版本。
|
||||
|
||||
双副本选主由高可用的 Mnode 提供仲裁服务,不由 Raft 组内决定。
|
||||
1. Arbitrator:仲裁服务,不存储数据,VGroup 因某一 Vnode 故障而无法提供服务时,Arbitrator 可根据数据同步情况指定 VGroup 内另一 Vnode 成为 Assigned Leader
|
||||
2. AssignedLeader:被强制设置为 Leader 的 Vnode,无论其他副本 Vnode 是否存活,均可一直响应用户请求
|
||||
|
||||

|
||||
|
||||
## 集群配置
|
||||
|
||||
双副本要求集群至少配置三个节点,基本部署与配置步骤如下:
|
||||
1. 确定服务器节点数量、主机名或域名,配置好所有节点的域名解析:DNS 或 /etc/hosts
|
||||
2. 各节点分别安装 TDengine **企业版**服务端安装包,按需编辑好各节点 taos.cfg
|
||||
3. 可选择其中一个节点仅提供仲裁服务(部署 Mnode),将 SupportVnodes 参数设置为 0,表示不存储时序数据;该占用资源较少,仅需 1~2 核,且可与其他应用共用
|
||||
4. 启动各节点 taosd 服务,其他服务可按需启动(taosadapter/taosx/taoskeeper/taos-explorer)
|
||||
|
||||
## 约束条件
|
||||
1. 最小配置的服务器节点数为 2+1 个,其中两个数据节点,一个仲裁节点
|
||||
2. 双副本为数据库建库参数,不同数据库可按需选择副本数
|
||||
3. 支持 TDengine 集群的完整特性,包括:读缓存、数据订阅、流计算等
|
||||
4. 支持 TDengine 所有语言连接器以及连接方式
|
||||
5. 支持单副本与双副本之间切换(前提是节点数量满足需求、各节点可用 Vnode 数量/内存/存储空间足够)
|
||||
6. 不支持双副本与三副本之间的切换
|
||||
7. 不支持双副本切换为双活,除非另外部署一套实例与当前实例组成双活方案
|
||||
|
||||
## 运维命令
|
||||
|
||||
### 创建集群
|
||||
|
||||
创建三节点的集群
|
||||
|
||||
```sql
|
||||
CREATE dnode <dnode_ep> port <dnode_port>;
|
||||
CREATE dnode <dnode_ep> port <dnode_port>;
|
||||
```
|
||||
|
||||
创建三副本的 Mnode,保证 Mnode 高可用,确保仲裁服务的高可用
|
||||
|
||||
```sql
|
||||
CREATE mnode on dnode <dnode_id>;
|
||||
CREATE mnode on dnode <dnode_id>;
|
||||
```
|
||||
|
||||
### 数据库创建
|
||||
|
||||
按需创建双副本数据库
|
||||
|
||||
```sql
|
||||
create database <dbname> replica 2 vgroups xx buffer xx ...
|
||||
```
|
||||
|
||||
### 修改数据库副本数
|
||||
|
||||
创建了单副本数据库后,希望改为双副本时,可通过 alter 命令来实现,反之亦然
|
||||
|
||||
```sql
|
||||
alter database <dbname> replica 2|1
|
||||
```
|
||||
|
||||
## 异常情况
|
||||
|
||||
| 异常场景 | 集群状态 |
|
||||
| ------- | ------ |
|
||||
| 没有 Vnode 发生故障: Arbitrator 故障(Mnode 宕机节点超过一个,导致 Mnode 无法选主)| **持续提供服务** |
|
||||
| 仅一个 Vnode 故障:VGroup 已经达成同步后,某一个 Vnode 才发生故障的 | **持续提供服务** |
|
||||
| 仅一个 Vnode 故障:离线 Vnode 启动后,VGroup 未达成同步前,另一个 Vnode 服务故障的 | **无法提供服务** |
|
||||
| 两个 Vnode 都发生故障 | **无法提供服务** |
|
||||
|
||||
|
||||
## 常见问题
|
||||
|
||||
### 1. 创建双副本数据库或修改为双副本时,报错:DB error: Out of dnodes
|
||||
- 服务器节点数不足:原因是,数据服务器节点数少于两个。
|
||||
- 解决方案:增加服务器节点数量,满足最低要求。
|
||||
|
||||
### 2. 创建双副本数据库或 split vgroup 时,报错:DB error: Vnodes exhausted
|
||||
- 服务器可用 Vnodes 不足:原因是某些服务器节点可用 Vnodes 数少于建库或 split vgroup 的需求数。
|
||||
- 解决方案:调整服务器 CPU 数量、SupportVnodes 数量,满足建库要求。
|
|
@ -1,31 +1,29 @@
|
|||
---
|
||||
title: TDengine 双活系统
|
||||
sidebar_label: 双活系统
|
||||
title: 双活方案
|
||||
sidebar_label: 双活方案
|
||||
toc_max_heading_level: 4
|
||||
---
|
||||
|
||||
本节介绍 TDengine 双活系统的配置和使用。
|
||||
部分用户因为部署环境的特殊性只能部署两台服务器,同时希望实现一定的服务高可用和数据高可靠。本文主要描述基于数据复制和客户端 Failover 两项关键技术的 TDengine 双活系统的产品行为,包括双活系统的架构、配置、运维等。TDengine 双活既可以用于前面所述资源受限的环境,也可用于在两套 TDengine 集群(不限资源)之间的灾备场景。双活是 TDengine Enterprise 特有功能,在 3.3.0.0 版本中第一次发布,建议使用最新版本。
|
||||
|
||||
1. 部分用户因为部署环境的特殊性只能部署两台服务器,同时希望实现一定的服务高可用和数据高可靠。本文主要描述基于数据复制和客户端 Failover 两项关键技术的 TDengine 双活系统的产品行为,包括双活系统的架构、配置、运维等。TDengine 双活既可以用于前面所述资源受限的环境,也可用于在两套 TDengine 集群(不限资源)之间的灾备场景。双活是 TDengine Enterprise 特有功能,在 3.3.0.0 版本中第一次发布,建议使用最新版本。
|
||||
双活系统的定义是:业务系统中有且仅有两台服务器,其上分别部署一套服务,在业务层看来这两台机器和两套服务是一个完整的系统,对其中的细节业务层不需要感知。双活中的两个节点通常被称为 Master-Slave,意为”主从“或”主备“,本文档中可能会出现混用的情况。
|
||||
|
||||
2. 双活系统的定义是:业务系统中有且仅有两台服务器,其上分别部署一套服务,在业务层看来这两台机器和两套服务是一个完整的系统,对其中的细节业务层不需要感知。双活中的两个节点通常被称为 Master-Slave,意为”主从“或”主备“,本文档中可能会出现混用的情况。
|
||||
TDengine 双活系统的部署架构图如下, 其中涉及到三个关键点:
|
||||
|
||||
3. TDengine 双活系统的部署架构图如下, 其中涉及到三个关键点:
|
||||
1. 由 Client Driver 实现对双系统的 Failover,即主节点宕机时的主从切换
|
||||
2. 由 taosX 从(当前的)主节点到从节点实现数据复制
|
||||
3. 由数据订阅的写接口在写入复制过来的数据时在 WAL 中加入特殊标记,由数据订阅的读接口在读取数据时自动过滤掉带有该特殊标记的数据,避免重复复制形成 infinite loop
|
||||
|
||||
注:下图中仅以一个单机版 TDengine 作为示例,但在实际部署中图中的一个 Host 也可以被任意节点数量的 TDengine 集群代替。
|
||||
|
||||

|
||||

|
||||
|
||||
## 配置
|
||||
|
||||
### 集群配置
|
||||
## 集群配置
|
||||
|
||||
双活对 TDengine 集群本身的配置没有任何要求,但对要在双活系统之间同步的数据库的 WAL 保留时长有一定要求,WAL 保留时长越大双活系统的容错率越高;如果备节点宕机时长超过主节点上的 WAL 保留时长,必定会导致备节点上有数据缺失;如果备节点宕机时长虽未超过主节点上的 WAL 保留时长,也有一定概率丢失数据,取决于接近的程度以及数据同步的速度。
|
||||
|
||||
### 客户端配置
|
||||
## 客户端配置
|
||||
|
||||
目前只有 Java 连接器在 WebSocket 连接模式下支持双活,其配置示例如下
|
||||
|
||||
|
@ -42,19 +40,19 @@ connection = DriverManager.getConnection(url, properties);
|
|||
|
||||
其中的配置属性及含义如下表
|
||||
|
||||
| 属性名 | 含义 |
|
||||
| ---------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
|
||||
| PROPERTY_KEY_SLAVE_CLUSTER_HOST | 第二节点的主机名或者 ip,默认空 |
|
||||
| PROPERTY_KEY_SLAVE_CLUSTER_PORT | 第二节点的端口号,默认空 |
|
||||
| 属性名 | 含义 |
|
||||
| ---------------------------------- | --- |
|
||||
| PROPERTY_KEY_SLAVE_CLUSTER_HOST | 第二节点的主机名或者 ip,默认空 |
|
||||
| PROPERTY_KEY_SLAVE_CLUSTER_PORT | 第二节点的端口号,默认空 |
|
||||
| PROPERTY_KEY_ENABLE_AUTO_RECONNECT | 是否启用自动重连。仅在使用 WebSocket 连接时生效。true: 启用,false: 不启用。默认为 false。双活场景下请设置为 true |
|
||||
| PROPERTY_KEY_RECONNECT_INTERVAL_MS | 重连的时间间隔,单位毫秒:默认 2000 毫秒,也就是 2 秒;最小值为 0, 表示立即重试;最大值不做限制 |
|
||||
| PROPERTY_KEY_RECONNECT_RETRY_COUNT | 每节点最多重试次数:默认值为 3;最小值为 0,表示不进行重试;最大值不做限制 |
|
||||
| PROPERTY_KEY_RECONNECT_INTERVAL_MS | 重连的时间间隔,单位毫秒:默认 2000 毫秒,也就是 2 秒;最小值为 0, 表示立即重试;最大值不做限制 |
|
||||
| PROPERTY_KEY_RECONNECT_RETRY_COUNT | 每节点最多重试次数:默认值为 3;最小值为 0,表示不进行重试;最大值不做限制 |
|
||||
|
||||
### 约束条件
|
||||
## 约束条件
|
||||
|
||||
1. 应用程序不能使用订阅接口,如果配置了双活参数会导致创建消费者失败。
|
||||
2. 不建议应用程序使用参数绑定的写入和查询方式,如果使用应用需要自己解决连接切换后的相关对象失效问题。
|
||||
3. 在双活场景下,不建议用户应用程序显示调用 use database,应该在连接参数中指定 database。
|
||||
1. 应用程序不能使用订阅接口,如果配置了双活参数会导致创建消费者失败
|
||||
2. 不建议应用程序使用参数绑定的写入和查询方式,如果使用应用需要自己解决连接切换后的相关对象失效问题
|
||||
3. 在双活场景下,不建议用户应用程序显示调用 use database,应该在连接参数中指定 database
|
||||
4. 双活的两端集群必须同构(即数据库的命名和所有配置参数以及用户名密码和权限设置等完全相同)
|
||||
5. 只支持 WebSocket 连接模式
|
||||
|
||||
|
@ -73,7 +71,7 @@ taosx replica start
|
|||
1. 方法一
|
||||
|
||||
```shell
|
||||
- taosx replica start -f source_endpoint -t sink_endpoint [database...]
|
||||
taosx replica start -f source_endpoint -t sink_endpoint [database...]
|
||||
```
|
||||
|
||||
在本机器所在的 taosx 服务中建立从 source_endpoint 到 sink_endpoint 的同步任务。运行该命令成功后,将打印 replica ID 到控制台(后续记为 id)。
|
||||
|
@ -82,6 +80,7 @@ taosx replica start
|
|||
```shell
|
||||
taosx replica start -f td1:6030 -t td2:6030
|
||||
```
|
||||
|
||||
该示例命令会自动创建除 information_schema、performance_schema、log、audit 库之外的同步任务。可以使用 `http://td2:6041` 指定该 endpoint 使用 websocket 接口(默认是原生接口)。也可以指定数据库同步:taosx replica start -f td1:6030 -t td2:6030 db1 仅创建指定的数据库同步任务。
|
||||
|
||||
2. 方法二
|
||||
|
@ -93,9 +92,9 @@ taosx replica start -i id [database...]
|
|||
使用上面已经创建的 Replica ID (id) 以在该同步任务中增加其它数据库。
|
||||
|
||||
注意:
|
||||
- 多次使用该命令,不会创建重复任务,仅将所指定的数据库增加到相应任务中。
|
||||
- replica id 在一个 taosX 实例内是全局唯一的,与 source/sink 的组合无关
|
||||
- 为便于记忆,replica id 为一个随机常用单词,系统自动将 source/sink 组合对应到一个词库中取得一个唯一可用单词。
|
||||
1. 多次使用该命令,不会创建重复任务,仅将所指定的数据库增加到相应任务中。
|
||||
2. replica id 在一个 taosX 实例内是全局唯一的,与 source/sink 的组合无关
|
||||
3. 为便于记忆,replica id 为一个随机常用单词,系统自动将 source/sink 组合对应到一个词库中取得一个唯一可用单词。
|
||||
|
||||
### 查看任务状态
|
||||
|
||||
|
@ -120,8 +119,8 @@ taosx replica stop id [db...]
|
|||
```
|
||||
|
||||
该命令作用如下:
|
||||
- 停止指定 Replica ID 下所有或指定数据库的双副本同步任务。
|
||||
- 使用 `taosx replica stop id1 db1` 表示停止 id1 replica 下 db1的同步任务。
|
||||
1. 停止指定 Replica ID 下所有或指定数据库的双副本同步任务。
|
||||
2. 使用 `taosx replica stop id1 db1` 表示停止 id1 replica 下 db1的同步任务。
|
||||
|
||||
### 重启双活任务
|
||||
|
||||
|
@ -130,8 +129,8 @@ taosx replica restart id [db...]
|
|||
```
|
||||
|
||||
该命令作用如下:
|
||||
- 重启指定 Replica ID 下所有或指定数据库的双副本同步任务。
|
||||
- 使用 `taosx replica start id1 db1` 仅重启指定数据库 db1的同步任务。
|
||||
1. 重启指定 Replica ID 下所有或指定数据库的双副本同步任务。
|
||||
2. 使用 `taosx replica start id1 db1` 仅重启指定数据库 db1的同步任务。
|
||||
|
||||
### 查看同步进度
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
---
|
||||
sidebar_label: 高可用
|
||||
title: 高可用
|
||||
---
|
||||
|
||||
TDengine 作为分布式时序数据库,支持高可用特性。默认高可用方案为基于 RAFT 协议的标准三副本方案;为适应不同用户场景的需要,提供基于 RAFT 协议改造的双副本方案;为满足传统双机主备架构的需求,提供基于 WAL 数据同步的双活方案。
|
||||
|
||||
- 标准三副本方案:时序数据的副本数目为 3,确保了最高的可用性,成本也最高。
|
||||
- 双副本结合 Arbitrator 方案:时序数据的副本数目为 2,但节点数目至少为 3,以确保高可用性和良好的数据一致性,可显著降低成本。与三副本方案相比,此方案在显著降低成本的同时,依然保持了较高的可用性。
|
||||
- 双活方案:可仅部署两个节点,高可用性较好,数据一致性较弱(最终一致性)。
|
||||
|
||||
以下为三种方案的特点:
|
||||
|
||||
| # | **三副本** | **双副本** | **双活** |
|
||||
|:--|:----------|:----------|:--------|
|
||||
| **集群数目** | 部署一个集群 | 部署一个集群 | 部署两个不同集群 |
|
||||
| **最小节点数** | 三个数据节点 | 两个数据节点,一个仲裁节点 | 两个数据节点 |
|
||||
| **选主原理** | Raft 协议 | 管理节点仲裁选主 | 无需选主 |
|
||||
| **同步原理** | Raft 协议 | Raft 协议 | 通过 taosX 进行数据同步 |
|
||||
| **同步延迟** | 无延迟 | 无延迟 | 依赖于 taosX 的同步速度,秒级延迟 |
|
||||
| **数据安全性** | 无数据丢失 | 无数据丢失 | 依赖于 WAL 的保存时长 |
|
||||
| **数据一致性** | RAFT 一致性 | RAFT 一致性 | 最终一致性 |
|
||||
| **高可用性** | 任一节点宕机不影响服务 | 任一节点宕机不影响服务,但不能处理连续宕机场景 | 一个实例存活即可提供服务 |
|
||||
|
||||
|
Before Width: | Height: | Size: 161 KiB |
After Width: | Height: | Size: 32 KiB |
After Width: | Height: | Size: 94 KiB |
After Width: | Height: | Size: 55 KiB |
After Width: | Height: | Size: 56 KiB |
After Width: | Height: | Size: 106 KiB |
After Width: | Height: | Size: 102 KiB |
After Width: | Height: | Size: 119 KiB |
After Width: | Height: | Size: 56 KiB |
After Width: | Height: | Size: 50 KiB |
After Width: | Height: | Size: 40 KiB |
After Width: | Height: | Size: 64 KiB |
After Width: | Height: | Size: 56 KiB |
After Width: | Height: | Size: 103 KiB |
|
@ -10,15 +10,11 @@ import TabItem from "@theme/TabItem";
|
|||
## 概述
|
||||
本文档介绍如何将 TDengine 数据源与开源数据可视化系统 [Grafana](https://www.grafana.com/) 集成,以实现数据的可视化和监测报警系统的搭建。通过 TDengine 插件,您可以轻松地将 TDengine 数据表的数据展示在 Grafana 仪表盘上,且无需进行复杂的开发工作。
|
||||
|
||||
## Grafana 版本要求
|
||||
当前 TDengine 支持 Grafana 7.5 及以上版本,建议使用最新版本。请根据您的系统环境下载并安装对应版本的 Grafana。
|
||||
|
||||
|
||||
## 前置条件
|
||||
|
||||
要让 Grafana 能正常添加 TDengine 数据源,需要以下几方面的准备工作。
|
||||
|
||||
- Grafana 服务已经部署并正常运行。
|
||||
- Grafana 服务已经部署并正常运行。当前 TDengine 支持 Grafana 7.5 及以上版本,建议使用最新版本。
|
||||
**注意**:要确保启动 Grafana 的账号有其安装目录的写权限,否则可能后面无法安装插件。
|
||||
- TDengine 集群已经部署并正常运行。
|
||||
- taosAdapter 已经安装并正常运行。具体细节请参考 [taosAdapter 的使用手册](../../../reference/components/taosadapter)
|
||||
|
|
|
@ -10,13 +10,10 @@ toc_max_heading_level: 4
|
|||
|
||||
一旦数据源配置完成,永洪BI便能直接从TDengine中读取数据,并利用其强大的数据处理和分析功能,为用户提供丰富的数据展示、分析和预测能力。这意味着用户无须编写复杂的代码或进行烦琐的数据转换工作,即可轻松获取所需的业务洞察。
|
||||
|
||||
## 安装永洪 BI
|
||||
## 前置条件
|
||||
|
||||
确保永洪 BI 已经安装并运行(如果未安装,请到永洪科技官方下载页面下载)。
|
||||
|
||||
## 安装JDBC驱动
|
||||
|
||||
从 maven.org 下载 TDengine JDBC 连接器文件 “taos-jdbcdriver-3.2.7-dist.jar”,并安装在永洪 BI 的机器上。
|
||||
- 确保永洪 BI 已经安装并运行(如果未安装,请到永洪科技官方下载页面下载)。
|
||||
- 安装JDBC驱动。从 maven.org 下载 TDengine JDBC 连接器文件 “taos-jdbcdriver-3.4.0-dist.jar”,并安装在永洪 BI 的机器上。
|
||||
|
||||
## 配置JDBC数据源
|
||||
|
||||
|
|
|
@ -8,16 +8,11 @@ Seeq 是制造业和工业互联网(IIOT)高级分析软件。Seeq 支持在
|
|||
|
||||
通过 TDengine Java connector, Seeq 可以轻松支持查询 TDengine 提供的时序数据,并提供数据展现、分析、预测等功能。
|
||||
|
||||
## Seeq 安装方法
|
||||
## 前置条件
|
||||
|
||||
从 [Seeq 官网](https://www.seeq.com/customer-download)下载相关软件,例如 Seeq Server 和 Seeq Data Lab 等。Seeq Data Lab 需要安装在和 Seeq Server 不同的服务器上,并通过配置和 Seeq Server 互联。详细安装配置指令参见[Seeq 知识库]( https://support.seeq.com/kb/latest/cloud/)。
|
||||
- Seeq 已经安装。从 [Seeq 官网](https://www.seeq.com/customer-download)下载相关软件,例如 Seeq Server 和 Seeq Data Lab 等。Seeq Data Lab 需要安装在和 Seeq Server 不同的服务器上,并通过配置和 Seeq Server 互联。详细安装配置指令参见[Seeq 知识库]( https://support.seeq.com/kb/latest/cloud/)。
|
||||
|
||||
### TDengine 本地实例安装方法
|
||||
|
||||
请参考[官网文档](../../../get-started)。
|
||||
|
||||
### TDengine Cloud 访问方法
|
||||
如果使用 Seeq 连接 TDengine Cloud,请在 https://cloud.taosdata.com 申请帐号并登录查看如何访问 TDengine Cloud。
|
||||
- TDengine 本地实例已安装。 请参考[官网文档](../../../get-started)。 若使用 TDengine Cloud,请在 https://cloud.taosdata.com 申请帐号并登录查看如何访问 TDengine Cloud。
|
||||
|
||||
## 配置 Seeq 访问 TDengine
|
||||
|
||||
|
|
|
@ -4,26 +4,27 @@ title: 与 Superset 集成
|
|||
---
|
||||
Apache Superset 是一个现代的企业级商业智能(BI)Web 应用程序,主要用于数据探索和可视化。它由 Apache 软件基金会支持,是一个开源项目,它拥有活跃的社区和丰富的生态系统。Apache Superset 提供了直观的用户界面,使得创建、分享和可视化数据变得简单,同时支持多种数据源和丰富的可视化选项。
|
||||
|
||||
通过 TDengine 的 Python 连接器, Superset 可支持 TDengine 数据源并提供数据展现、分析等功能
|
||||
通过 TDengine 的 Python 连接器, Apache Superset 可支持 TDengine 数据源并提供数据展现、分析等功能
|
||||
|
||||
## 安装 Apache Superset
|
||||
|
||||
确保已安装 Apache Superset v2.1.0 及以上版本, 如未安装,请到其 [官网](https://superset.apache.org/) 安装
|
||||
## 前置条件
|
||||
|
||||
## 安装 TDengine
|
||||
准备以下环境:
|
||||
- TDengine 集群已部署并正常运行(企业及社区版均可)
|
||||
- taosAdapter 能够正常运行。详细参考 [taosAdapter 使用手册](../../../reference/components/taosadapter)
|
||||
- Apache Superset v2.1.0 或以上版本已安装。安装 Apache Superset 请参考 [官方文档](https://superset.apache.org/)
|
||||
|
||||
TDengine 企业版及社区版均可支持,版本要求在 3.0 及以上
|
||||
|
||||
## 安装 TDengine Python 连接器
|
||||
|
||||
TDengine Python 连接器从 `v2.1.18` 开始自带 Superset 连接驱动,安装程序会把连接驱动安装到 Superset 相应目录下并向 Superset 提供数据源服务
|
||||
Superset 与 TDengine 之间使用 WebSocket 协议连接,所以需另安装支持 WebSocket 连接协议的组件 `taos-ws-py` , 全部安装脚本如下:
|
||||
TDengine Python 连接器从 `v2.1.18` 起带 Superset 连接驱动,会安装至 Superset 相应目录下并向 Superset 提供数据源服务
|
||||
Superset 与 TDengine 之间使用 WebSocket 协议连接,需安装支持此协议的 `taos-ws-py` 组件, 全部安装脚本如下:
|
||||
```bash
|
||||
pip3 install taospy
|
||||
pip3 install taos-ws-py
|
||||
```
|
||||
|
||||
## Superset 中配置 TDengine 连接
|
||||
## 配置 TDengine 数据源
|
||||
|
||||
**第 1 步**,进入新建数据库连接页面 "Superset" → "Setting" → "Database Connections" → "+DATABASE"
|
||||
**第 2 步**,选择 TDengine 数据库连接。"SUPPORTED DATABASES" 下拉列表中选择 "TDengine" 项。
|
||||
|
|
|
@ -12,7 +12,8 @@ sidebar_label: taosX-Agent
|
|||
- `endpoint`: 必填,`taosX` 的 GRPC 服务地址。
|
||||
- `token`: 必填,在 `Explorer` 上创建 `Agent` 时,产生的 Token。
|
||||
- `instanceId`:当前 taosx-agent 服务的实例 ID,如果同一台机器上启动了多个 taosx-agent 实例,必须保证各个实例的实例 ID 互不相同。
|
||||
- `compression`: 非必填,可配置为 `ture` 或 `false`, 默认为 `false`。配置为`true`, 则开启 `Agent` 和 `taosX` 通信数据压缩。
|
||||
- `compression`: 非必填,可配置为 `true` 或 `false`, 默认为 `false`。配置为`true`, 则开启 `Agent` 和 `taosX` 通信数据压缩。
|
||||
- `in_memory_cache_capacity`: 非必填,表示可在内存中缓存的最大消息批次数,可配置为大于 0 的整数。默认为 `64`。
|
||||
- `log_level`: 非必填,日志级别,默认为 `info`, 同 `taosX` 一样,支持 `error`,`warn`,`info`,`debug`,`trace` 五级。已弃用,请使用 `log.level` 代替。
|
||||
- `log_keep_days`:非必填,日志保存天数,默认为 `30` 天。已弃用,请使用 `log.keepDays` 代替。
|
||||
- `log.path`:日志文件存放的目录。
|
||||
|
@ -44,6 +45,10 @@ sidebar_label: taosX-Agent
|
|||
#
|
||||
#compression = true
|
||||
|
||||
# In-memory cache capacity
|
||||
#
|
||||
#in_memory_cache_capacity = 64
|
||||
|
||||
# log configuration
|
||||
[log]
|
||||
# All log files are stored in this directory
|
||||
|
|
|
@ -4,26 +4,17 @@ sidebar_label: taosdump
|
|||
toc_max_heading_level: 4
|
||||
---
|
||||
|
||||
taosdump 是一个支持从运行中的 TDengine 集群备份数据并将备份的数据恢复到相同或另一个运行中的 TDengine 集群中的工具应用程序。
|
||||
taosdump 是为开源用户提供的 TDengine 数据备份/恢复工具,备份数据文件采用标准 [ Apache AVRO ](https://avro.apache.org/) 格式,方便与外界生态交换数据。taosdump 提供多种数据备份及恢复选项来满足不同需求,可通过 --help 查看支持的全部选项。
|
||||
|
||||
taosdump 可以用数据库、超级表或普通表作为逻辑数据单元进行备份,也可以对数据库、超级
|
||||
表和普通表中指定时间段内的数据记录进行备份。使用时可以指定数据备份的目录路径,如果
|
||||
不指定位置,taosdump 默认会将数据备份到当前目录。
|
||||
|
||||
如果指定的位置已经有数据文件,taosdump 会提示用户并立即退出,避免数据被覆盖。这意味着同一路径只能被用于一次备份。
|
||||
如果看到相关提示,请小心操作。
|
||||
|
||||
taosdump 是一个逻辑备份工具,它不应被用于备份任何原始数据、环境设置、
|
||||
硬件信息、服务端配置或集群的拓扑结构。taosdump 使用
|
||||
[ Apache AVRO ](https://avro.apache.org/)作为数据文件格式来存储备份数据。
|
||||
|
||||
## 安装
|
||||
|
||||
taosdump 有两种安装方式:
|
||||
taosdump 提供两种安装方式:
|
||||
|
||||
- 安装 taosTools 官方安装包, 请从[发布历史页面](https://docs.taosdata.com/releases/tools/)页面找到 taosTools 并下载安装。
|
||||
- taosdump 是 TDengine 安装包中默认安装组件,安装 TDengine 后即可使用,可参考[TDengine 安装](../../../get-started/)
|
||||
|
||||
- 单独编译 taos-tools 并安装, 参考 [taos-tools](https://github.com/taosdata/taos-tools) 仓库。
|
||||
|
||||
- 单独编译 taos-tools 并安装, 详情请参考 [taos-tools](https://github.com/taosdata/taos-tools) 仓库。
|
||||
|
||||
## 常用使用场景
|
||||
|
||||
|
@ -31,9 +22,11 @@ taosdump 有两种安装方式:
|
|||
|
||||
1. 备份所有数据库:指定 `-A` 或 `--all-databases` 参数;
|
||||
2. 备份多个指定数据库:使用 `-D db1,db2,...` 参数;
|
||||
3. 备份指定数据库中的某些超级表或普通表:使用 `dbname stbname1 stbname2 tbname1 tbname2 ...` 参数,注意这种输入序列第一个参数为数据库名称,且只支持一个数据库,第二个和之后的参数为该数据库中的超级表或普通表名称,中间以空格分隔;
|
||||
3. 备份指定数据库中某些超级表或普通表:使用 `dbname stbname1 stbname2 tbname1 tbname2 ...` 参数,注意这种输入序列第一个参数为数据库名称,且只支持一个数据库,第二个和之后的参数为该数据库中的超级表或普通表名称,中间以空格分隔;
|
||||
4. 备份系统 log 库:TDengine 集群通常会包含一个系统数据库,名为 `log`,这个数据库内的数据为 TDengine 自我运行的数据,taosdump 默认不会对 log 库进行备份。如果有特定需求对 log 库进行备份,可以使用 `-a` 或 `--allow-sys` 命令行参数。
|
||||
5. “宽容”模式备份:taosdump 1.4.1 之后的版本提供 `-n` 参数和 `-L` 参数,用于备份数据时不使用转义字符和“宽容”模式,可以在表名、列名、标签名没使用转义字符的情况下减少备份数据时间和备份数据占用空间。如果不确定符合使用 `-n` 和 `-L` 条件时请使用默认参数进行“严格”模式进行备份。转义字符的说明请参考[官方文档](../../taos-sql/escape)。
|
||||
6. `-o` 参数指定的目录下如果已存在备份文件,为防止数据被覆盖,taosdump 会报错并退出,请更换其它空目录或清空原来数据后再备份。
|
||||
7. 目前 taosdump 不支持数据断点继备功能,一旦数据备份中断,需要从头开始。如果备份需要很长时间,建议使用(-S -E 选项)指定开始/结束时间进行分段备份的方法,
|
||||
|
||||
:::tip
|
||||
- taosdump 1.4.1 之后的版本提供 `-I` 参数,用于解析 avro 文件 schema 和数据,如果指定 `-s` 参数将只解析 schema。
|
||||
|
@ -45,7 +38,9 @@ taosdump 有两种安装方式:
|
|||
|
||||
### taosdump 恢复数据
|
||||
|
||||
恢复指定路径下的数据文件:使用 `-i` 参数加上数据文件所在路径。如前面提及,不应该使用同一个目录备份不同数据集合,也不应该在同一路径多次备份同一数据集,否则备份数据会造成覆盖或多次备份。
|
||||
- 恢复指定路径下的数据文件:使用 `-i` 参数加上数据文件所在路径。如前面提及,不应该使用同一个目录备份不同数据集合,也不应该在同一路径多次备份同一数据集,否则备份数据会造成覆盖或多次备份。
|
||||
- taosdump 支持数据恢复至新数据库名下,参数是 -W, 详细见命令行参数说明。
|
||||
|
||||
|
||||
:::tip
|
||||
taosdump 内部使用 TDengine stmt binding API 进行恢复数据的写入,为提高数据恢复性能,目前使用 16384 为一次写入批次。如果备份数据中有比较多列数据,可能会导致产生 "WAL size exceeds limit" 错误,此时可以通过使用 `-B` 参数调整为一个更小的值进行尝试。
|
||||
|
@ -108,6 +103,13 @@ Usage: taosdump [OPTION...] dbname [tbname ...]
|
|||
the table name.(Version 2.5.3)
|
||||
-T, --thread-num=THREAD_NUM Number of thread for dump in file. Default is
|
||||
8.
|
||||
-W, --rename=RENAME-LIST Rename database name with new name during
|
||||
importing data. RENAME-LIST:
|
||||
"db1=newDB1|db2=newDB2" means rename db1 to newDB1
|
||||
and rename db2 to newDB2 (Version 2.5.4)
|
||||
-k, --retry-count=VALUE Set the number of retry attempts for connection or
|
||||
query failures
|
||||
-z, --retry-sleep-ms=VALUE retry interval sleep time, unit ms
|
||||
-C, --cloud=CLOUD_DSN specify a DSN to access TDengine cloud service
|
||||
-R, --restful Use RESTful interface to connect TDengine
|
||||
-t, --timeout=SECONDS The timeout seconds for websocket to interact.
|
||||
|
@ -115,10 +117,6 @@ Usage: taosdump [OPTION...] dbname [tbname ...]
|
|||
-?, --help Give this help list
|
||||
--usage Give a short usage message
|
||||
-V, --version Print program version
|
||||
-W, --rename=RENAME-LIST Rename database name with new name during
|
||||
importing data. RENAME-LIST:
|
||||
"db1=newDB1|db2=newDB2" means rename db1 to newDB1
|
||||
and rename db2 to newDB2 (Version 2.5.4)
|
||||
|
||||
Mandatory or optional arguments to long options are also mandatory or optional
|
||||
for any corresponding short options.
|
||||
|
|
|
@ -4,59 +4,59 @@ sidebar_label: taosBenchmark
|
|||
toc_max_heading_level: 4
|
||||
---
|
||||
|
||||
taosBenchmark (曾用名 taosdemo ) 是一个用于测试 TDengine 产品性能的工具。taosBenchmark 可以测试 TDengine 的插入、查询和订阅等功能的性能,它可以模拟由大量设备产生的大量数据,还可以灵活地控制数据库、超级表、标签列的数量和类型、数据列的数量和类型、子表的数量、每张子表的数据量、插入数据的时间间隔、taosBenchmark 的工作线程数量、是否以及如何插入乱序数据等。为了兼容过往用户的使用习惯,安装包提供 了 taosdemo 作为 taosBenchmark 的软链接。
|
||||
taosBenchmark 是 TDengine 产品性能基准测试工具,提供对 TDengine 产品写入、查询及订阅性能测试,输出性能指标。
|
||||
|
||||
## 安装
|
||||
|
||||
taosBenchmark 有两种安装方式:
|
||||
taosBenchmark 提供两种安装方式:
|
||||
|
||||
- 安装 TDengine 官方安装包的同时会自动安装 taosBenchmark, 详情请参考[ TDengine 安装](../../../get-started/)。
|
||||
- taosBenchmark 是 TDengine 安装包中默认安装组件,安装 TDengine 后即可使用,参考 [TDengine 安装](../../../get-started/)
|
||||
|
||||
- 单独编译 taos-tools 并安装, 详情请参考 [taos-tools](https://github.com/taosdata/taos-tools) 仓库。
|
||||
- 单独编译 taos-tools 并安装, 参考 [taos-tools](https://github.com/taosdata/taos-tools) 仓库。
|
||||
|
||||
## 运行
|
||||
|
||||
### 配置和运行方式
|
||||
### 运行方式
|
||||
|
||||
taosBenchmark 需要在操作系统的终端执行,该工具支持两种配置方式:[命令行参数](#命令行参数详解) 和 [JSON 配置文件](#配置文件参数详解)。这两种方式是互斥的,在使用配置文件时只能使用一个命令行参数 `-f <json file>` 指定配置文件。在使用命令行参数运行 taosBenchmark 并控制其行为时则不能使用 `-f` 参数而要用其它参数来进行配置。除此之外,taosBenchmark 还提供了一种特殊的运行方式,即无参数运行。
|
||||
taosBenchmark 支持三种运行模式:
|
||||
- 无参数模式
|
||||
- 命令行模式
|
||||
- JSON 配置文件模式
|
||||
`命令行方式` 为 `JSON 配置文件方式` 功能子集,两者都使用时,命令行方式优先。
|
||||
|
||||
taosBenchmark 支持对 TDengine 做完备的性能测试,其所支持的 TDengine 功能分为三大类:写入、查询和订阅。这三种功能之间是互斥的,每次运行 taosBenchmark 只能选择其中之一。值得注意的是,所要测试的功能类型在使用命令行配置方式时是不可配置的,命令行配置方式只能测试写入性能。若要测试 TDengine 的查询和订阅性能,必须使用配置文件的方式,通过配置文件中的参数 `filetype` 指定所要测试的功能类型。
|
||||
|
||||
**在运行 taosBenchmark 之前要确保 TDengine 集群已经在正确运行。**
|
||||
|
||||
### 无命令行参数运行
|
||||
|
||||
执行下列命令即可快速体验 taosBenchmark 对 TDengine 进行基于默认配置的写入性能测试。
|
||||
|
||||
```bash
|
||||
taosBenchmark
|
||||
```
|
||||
|
||||
在无参数运行时,taosBenchmark 默认连接 `/etc/taos` 下指定的 TDengine 集群,并在 TDengine 中创建一个名为 test 的数据库,test 数据库下创建名为 meters 的一张超级表,超级表下创建 10000 张表,每张表中写入 10000 条记录。注意,如果已有 test 数据库,这个命令会先删除该数据库后建立一个全新的 test 数据库。
|
||||
在无参数运行时,taosBenchmark 默认连接 `/etc/taos/taos.cfg` 中指定的 TDengine 集群。
|
||||
连接成功后,会默认创建智能电表示例数据库 test,创建超级表 meters, 创建子表 1 万,每子写入数据 1 万条,若 test 库已存在,默认会先删再建。
|
||||
|
||||
### 使用命令行配置参数运行
|
||||
|
||||
在使用命令行参数运行 taosBenchmark 并控制其行为时,`-f <json file>` 参数不能使用。所有配置参数都必须通过命令行指定。以下是使用命令行方式测试 taosBenchmark 写入性能的一个示例。
|
||||
### 使用命令行参数运行
|
||||
|
||||
命令行支持的参数为写入功能中使用较为频繁的参数,查询与订阅功能不支持命令行方式
|
||||
示例:
|
||||
```bash
|
||||
taosBenchmark -I stmt -n 200 -t 100
|
||||
taosBenchmark -d db -t 100 -n 1000 -T 4 -I stmt -y
|
||||
```
|
||||
|
||||
上面的命令 `taosBenchmark` 将创建一个名为`test`的数据库,在其中建立一张超级表`meters`,在该超级表中建立 100 张子表并使用参数绑定的方式为每张子表插入 200 条记录。
|
||||
此命令表示使用 `taosBenchmark` 将创建一个名为 `db` 的数据库,并建立默认超级表 `meters`,子表 100 ,使用参数绑定(stmt)方式为每张子表写入 1000 条记录。
|
||||
|
||||
### 使用配置文件运行
|
||||
|
||||
taosBenchmark 安装包中提供了配置文件的示例,位于 `<install_directory>/examples/taosbenchmark-json` 下
|
||||
|
||||
使用如下命令行即可运行 taosBenchmark 并通过配置文件控制其行为。
|
||||
配置文件方式运行提供了全部功能,所有命令行参数都可以在配置文件中配置运行
|
||||
|
||||
```bash
|
||||
taosBenchmark -f <json file>
|
||||
```
|
||||
|
||||
**下面是几个配置文件的示例:**
|
||||
**下面为支持的写入、查询、订阅三大功能的配置文件示例:**
|
||||
|
||||
#### 插入场景 JSON 配置文件示例
|
||||
#### 写入场景 JSON 配置文件示例
|
||||
|
||||
<details>
|
||||
<summary>insert.json</summary>
|
||||
|
@ -89,130 +89,102 @@ taosBenchmark -f <json file>
|
|||
|
||||
</details>
|
||||
|
||||
查看更多 json 配置文件示例可 [点击这里](https://github.com/taosdata/taos-tools/tree/main/example)
|
||||
|
||||
## 命令行参数详解
|
||||
| 命令行参数 | 功能说明 |
|
||||
| ---------------------------- | ----------------------------------------------- |
|
||||
| -f/--file \<json file> | 要使用的 JSON 配置文件,由该文件指定所有参数,本参数与命令行其他参数不能同时使用。没有默认值 |
|
||||
| -c/--config-dir \<dir> | TDengine 集群配置文件所在的目录,默认路径是 /etc/taos |
|
||||
| -h/--host \<host> | 指定要连接的 TDengine 服务端的 FQDN,默认值为 localhost |
|
||||
| -P/--port \<port> | 要连接的 TDengine 服务器的端口号,默认值为 6030 |
|
||||
| -I/--interface \<insertMode> | 插入模式,可选项有 taosc, rest, stmt, sml, sml-rest, 分别对应普通写入、restful 接口写入、参数绑定接口写入、schemaless 接口写入、restful schemaless 接口写入 (由 taosAdapter 提供)。默认值为 taosc |
|
||||
| -u/--user \<user> | 用于连接 TDengine 服务端的用户名,默认为 root |
|
||||
| -U/--supplement-insert | 写入数据而不提前建数据库和表,默认关闭 |
|
||||
| -p/--password \<passwd> | 用于连接 TDengine 服务端的密码,默认值为 taosdata |
|
||||
| -o/--output \<file> | 结果输出文件的路径,默认值为 ./output.txt |
|
||||
| -T/--thread \<threadNum> | 插入数据的线程数量,默认为 8 |
|
||||
| -B/--interlace-rows \<rowNum> |启用交错插入模式并同时指定向每个子表每次插入的数据行数。交错插入模式是指依次向每张子表插入由本参数所指定的行数并重复这个过程,直到所有子表的数据都插入完成。默认值为 0, 即向一张子表完成数据插入后才会向下一张子表进行数据插入 |
|
||||
| -i/--insert-interval \<timeInterval> | 指定交错插入模式的插入间隔,单位为 ms,默认值为 0。 只有当 `-B/--interlace-rows` 大于 0 时才起作用 |意味着数据插入线程在为每个子表插入隔行扫描记录后,会等待该值指定的时间间隔后再进行下一轮写入 |
|
||||
| -r/--rec-per-req \<rowNum> | 每次向 TDengine 请求写入的数据行数,默认值为 30000 |
|
||||
| -t/--tables \<tableNum> | 指定子表的数量,默认为 10000 |
|
||||
| -S/--timestampstep \<stepLength> | 每个子表中插入数据的时间戳步长,单位是 ms,默认值是 1 |
|
||||
| -n/--records \<recordNum> | 每个子表插入的记录数,默认值为 10000 |
|
||||
| -d/--database \<dbName> | 所使用的数据库的名称,默认值为 test |
|
||||
| -b/--data-type \<colType> | 指定超级表普通列数据类型, 多个使用逗号分隔,默认值: "FLOAT,INT,FLOAT" 如:`taosBenchmark -b "FLOAT,BINARY(8),NCHAR(16)"`|
|
||||
| -A/--tag-type \<tagType> | 指定超级表标签列数据类型,多个使用逗号分隔,默认值: "INT,BINARY(24)" 如:`taosBenchmark -A "INT,BINARY(8),NCHAR(8)"`|
|
||||
| -l/--columns \<colNum> | 超级表的数据列的总数量。如果同时设置了该参数和 `-b/--data-type`,则最后的结果列数为两者取大。如果本参数指定的数量大于 `-b/--data-type` 指定的列数,则未指定的列类型默认为 INT, 例如: `-l 5 -b float,double`, 那么最后的列为 `FLOAT,DOUBLE,INT,INT,INT`。如果 columns 指定的数量小于或等于 `-b/--data-type` 指定的列数,则结果为 `-b/--data-type` 指定的列和类型,例如: `-l 3 -b float,double,float,bigint`,那么最后的列为 `FLOAT,DOUBLE,FLOAT,BIGINT` |
|
||||
| -L/--partial-col-num \<colNum> | 指定某些列写入数据,其他列数据为 NULL。默认所有列都写入数据 |
|
||||
| -w/--binwidth \<length> | nchar 和 binary 类型的默认长度,默认值为 64 |
|
||||
| -m/--table-prefix \<tablePrefix> | 子表名称的前缀,默认值为 "d" |
|
||||
| -E/--escape-character | 开关参数,指定在超级表和子表名称中是否使用转义字符。默认值为不使用 |
|
||||
| -C/--chinese | 开关参数,指定 nchar 和 binary 是否使用 Unicode 中文字符。默认值为不使用 |
|
||||
| -N/--normal-table | 开关参数,指定只创建普通表,不创建超级表。默认值为 false。仅当插入模式为 taosc, stmt, rest 模式下可以使用 |
|
||||
| -M/--random | 开关参数,插入数据为生成的随机值。默认值为 false。若配置此参数,则随机生成要插入的数据。对于数值类型的 标签列/数据列,其值为该类型取值范围内的随机值。对于 NCHAR 和 BINARY 类型的 标签列/数据列,其值为指定长度范围内的随机字符串 |
|
||||
| -x/--aggr-func | 开关参数,指示插入后查询聚合函数。默认值为 false |
|
||||
| -y/--answer-yes | 开关参数,要求用户在提示后确认才能继续 |默认值为 false 。
|
||||
| -O/--disorder \<Percentage> | 指定乱序数据的百分比概率,其值域为 [0,50]。默认为 0,即没有乱序数据 |
|
||||
| -R/--disorder-range \<timeRange> | 指定乱序数据的时间戳回退范围。所生成的乱序时间戳为非乱序情况下应该使用的时间戳减去这个范围内的一个随机值。仅在 `-O/--disorder` 指定的乱序数据百分比大于 0 时有效|
|
||||
| -F/--prepare_rand \<Num> | 生成的随机数据中唯一值的数量。若为 1 则表示所有数据都相同。默认值为 10000 |
|
||||
| -a/--replica \<replicaNum> | 创建数据库时指定其副本数,默认值为 1 |
|
||||
| -k/--keep-trying \<NUMBER> | 失败后进行重试的次数,默认不重试。需使用 v3.0.9 以上版本|
|
||||
| -z/--trying-interval \<NUMBER> | 失败重试间隔时间,单位为毫秒,仅在 -k 指定重试后有效。需使用 v3.0.9 以上版本 |
|
||||
| -v/--vgroups \<NUMBER> | 创建数据库时指定 vgroups 数,仅对 TDengine v3.0+ 有效|
|
||||
| -V/--version | 显示版本信息并退出。不能与其它参数混用|
|
||||
| -?/--help | 显示帮助信息并退出。不能与其它参数混用|
|
||||
|
||||
- **-f/--file \<json file>** :
|
||||
要使用的 JSON 配置文件,由该文件指定所有参数,本参数与命令行其他参数不能同时使用。没有默认值。
|
||||
|
||||
- **-c/--config-dir \<dir>** :
|
||||
TDengine 集群配置文件所在的目录,默认路径是 /etc/taos 。
|
||||
## 输出性能指标
|
||||
|
||||
- **-h/--host \<host>** :
|
||||
指定要连接的 TDengine 服务端的 FQDN,默认值为 localhost 。
|
||||
|
||||
- **-P/--port \<port>** :
|
||||
要连接的 TDengine 服务器的端口号,默认值为 6030 。
|
||||
|
||||
- **-I/--interface \<insertMode>** :
|
||||
插入模式,可选项有 taosc, rest, stmt, sml, sml-rest, 分别对应普通写入、restful 接口写入、参数绑定接口写入、schemaless 接口写入、restful schemaless 接口写入 (由 taosAdapter 提供)。默认值为 taosc。
|
||||
|
||||
- **-u/--user \<user>** :
|
||||
用于连接 TDengine 服务端的用户名,默认为 root 。
|
||||
|
||||
- **-U/--supplement-insert ** :
|
||||
写入数据而不提前建数据库和表,默认关闭。
|
||||
|
||||
- **-p/--password \<passwd>** :
|
||||
用于连接 TDengine 服务端的密码,默认值为 taosdata。
|
||||
|
||||
- **-o/--output \<file>** :
|
||||
结果输出文件的路径,默认值为 ./output.txt。
|
||||
|
||||
- **-T/--thread \<threadNum>** :
|
||||
插入数据的线程数量,默认为 8 。
|
||||
|
||||
- **-B/--interlace-rows \<rowNum>** :
|
||||
启用交错插入模式并同时指定向每个子表每次插入的数据行数。交错插入模式是指依次向每张子表插入由本参数所指定的行数并重复这个过程,直到所有子表的数据都插入完成。默认值为 0, 即向一张子表完成数据插入后才会向下一张子表进行数据插入。
|
||||
|
||||
- **-i/--insert-interval \<timeInterval>** :
|
||||
指定交错插入模式的插入间隔,单位为 ms,默认值为 0。 只有当 `-B/--interlace-rows` 大于 0 时才起作用。意味着数据插入线程在为每个子表插入隔行扫描记录后,会等待该值指定的时间间隔后再进行下一轮写入。
|
||||
|
||||
- **-r/--rec-per-req \<rowNum>** :
|
||||
每次向 TDengine 请求写入的数据行数,默认值为 30000 。
|
||||
|
||||
- **-t/--tables \<tableNum>** :
|
||||
指定子表的数量,默认为 10000 。
|
||||
|
||||
- **-S/--timestampstep \<stepLength>** :
|
||||
每个子表中插入数据的时间戳步长,单位是 ms,默认值是 1。
|
||||
|
||||
- **-n/--records \<recordNum>** :
|
||||
每个子表插入的记录数,默认值为 10000 。
|
||||
|
||||
- **-d/--database \<dbName>** :
|
||||
所使用的数据库的名称,默认值为 test 。
|
||||
|
||||
- **-b/--data-type \<colType>** :
|
||||
超级表的数据列的类型。如果不使用则默认为有三个数据列,其类型分别为 FLOAT, INT, FLOAT 。
|
||||
|
||||
- **-l/--columns \<colNum>** :
|
||||
超级表的数据列的总数量。如果同时设置了该参数和 `-b/--data-type`,则最后的结果列数为两者取大。如果本参数指定的数量大于 `-b/--data-type` 指定的列数,则未指定的列类型默认为 INT, 例如: `-l 5 -b float,double`, 那么最后的列为 `FLOAT,DOUBLE,INT,INT,INT`。如果 columns 指定的数量小于或等于 `-b/--data-type` 指定的列数,则结果为 `-b/--data-type` 指定的列和类型,例如: `-l 3 -b float,double,float,bigint`,那么最后的列为 `FLOAT,DOUBLE,FLOAT,BIGINT` 。
|
||||
|
||||
- **-L/--partial-col-num \<colNum> **:
|
||||
指定某些列写入数据,其他列数据为 NULL。默认所有列都写入数据。
|
||||
|
||||
- **-A/--tag-type \<tagType>** :
|
||||
超级表的标签列类型。nchar 和 binary 类型可以同时设置长度,例如:
|
||||
#### 写入指标
|
||||
|
||||
写入结束后会在最后两行输出总体性能指标,格式如下:
|
||||
``` bash
|
||||
SUCC: Spent 8.527298 (real 8.117379) seconds to insert rows: 10000000 with 8 thread(s) into test 1172704.41 (real 1231924.74) records/second
|
||||
SUCC: insert delay, min: 19.6780ms, avg: 64.9390ms, p90: 94.6900ms, p95: 105.1870ms, p99: 130.6660ms, max: 157.0830ms
|
||||
```
|
||||
taosBenchmark -A INT,DOUBLE,NCHAR,BINARY(16)
|
||||
第一行写入速度统计:
|
||||
- Spent: 写入总耗时,单位秒,从开始写入第一个数据开始计时到最后一条数据结束,这里表示共花了 8.527298 秒
|
||||
- real : 写入总耗时(调用引擎),此耗时已抛去测试框架准备数据时间,纯统计在引擎调用上花费的时间,示例为 8.117379 秒,8.527298 - 8.117379 = 0.409919 秒则为测试框架准备数据消耗时间
|
||||
- rows : 写入总行数,为 1000 万条数据
|
||||
- threads: 写入线程数,这里是 8 个线程同时写入
|
||||
- records/second 写入速度 = `写入总耗时`/ `写入总行数` , 括号中 `real` 同前,表示纯引擎写入速度
|
||||
第二行单个写入延时统计:
|
||||
- min : 写入最小延时
|
||||
- avg : 写入平时延时
|
||||
- p90 : 写入延时 p90 百分位上的延时数
|
||||
- p95 : 写入延时 p95 百分位上的延时数
|
||||
- p99 : 写入延时 p99 百分位上的延时数
|
||||
- max : 写入最大延时
|
||||
通过此系列指标,可观察到写入请求延时分布情况
|
||||
|
||||
#### 查询指标
|
||||
|
||||
查询性能测试主要输出查询请求速度 QPS 指标, 输出格式如下:
|
||||
``` bash
|
||||
complete query with 3 threads and 10000 query delay avg: 0.002686s min: 0.001182s max: 0.012189s p90: 0.002977s p95: 0.003493s p99: 0.004645s SQL command: select ...
|
||||
INFO: Total specified queries: 30000
|
||||
INFO: Spend 26.9530 second completed total queries: 30000, the QPS of all threads: 1113.049
|
||||
```
|
||||
- 第一行表示 3 个线程每个线程执行 10000 次查询及查询请求延时百分位分布情况,`SQL command` 为测试的查询语句
|
||||
- 第二行表示总共完成了 10000 * 3 = 30000 次查询总数
|
||||
- 第三行表示查询总耗时为 26.9653 秒,每秒查询率(QPS)为:1113.049 次/秒
|
||||
|
||||
如果没有设置标签类型,默认是两个标签,其类型分别为 INT 和 BINARY(16)。
|
||||
注意:在有的 shell 比如 bash 命令里面 “()” 需要转义,则上述指令应为:
|
||||
#### 订阅指标
|
||||
|
||||
订阅性能测试主要输出消费者消费速度指标,输出格式如下:
|
||||
``` bash
|
||||
INFO: consumer id 0 has poll total msgs: 376, period rate: 37.592 msgs/s, total rows: 3760000, period rate: 375924.815 rows/s
|
||||
INFO: consumer id 1 has poll total msgs: 362, period rate: 36.131 msgs/s, total rows: 3620000, period rate: 361313.504 rows/s
|
||||
INFO: consumer id 2 has poll total msgs: 364, period rate: 36.378 msgs/s, total rows: 3640000, period rate: 363781.731 rows/s
|
||||
INFO: consumerId: 0, consume msgs: 1000, consume rows: 10000000
|
||||
INFO: consumerId: 1, consume msgs: 1000, consume rows: 10000000
|
||||
INFO: consumerId: 2, consume msgs: 1000, consume rows: 10000000
|
||||
INFO: Consumed total msgs: 3000, total rows: 30000000
|
||||
```
|
||||
taosBenchmark -A INT,DOUBLE,NCHAR,BINARY\(16\)
|
||||
```
|
||||
|
||||
- **-w/--binwidth \<length>**:
|
||||
nchar 和 binary 类型的默认长度,默认值为 64。
|
||||
|
||||
- **-m/--table-prefix \<tablePrefix>** :
|
||||
子表名称的前缀,默认值为 "d"。
|
||||
|
||||
- **-E/--escape-character** :
|
||||
开关参数,指定在超级表和子表名称中是否使用转义字符。默认值为不使用。
|
||||
|
||||
- **-C/--chinese** :
|
||||
开关参数,指定 nchar 和 binary 是否使用 Unicode 中文字符。默认值为不使用。
|
||||
|
||||
- **-N/--normal-table** :
|
||||
开关参数,指定只创建普通表,不创建超级表。默认值为 false。仅当插入模式为 taosc, stmt, rest 模式下可以使用。
|
||||
|
||||
- **-M/--random** :
|
||||
开关参数,插入数据为生成的随机值。默认值为 false。若配置此参数,则随机生成要插入的数据。对于数值类型的 标签列/数据列,其值为该类型取值范围内的随机值。对于 NCHAR 和 BINARY 类型的 标签列/数据列,其值为指定长度范围内的随机字符串。
|
||||
|
||||
- **-x/--aggr-func** :
|
||||
开关参数,指示插入后查询聚合函数。默认值为 false。
|
||||
|
||||
- **-y/--answer-yes** :
|
||||
开关参数,要求用户在提示后确认才能继续。默认值为 false 。
|
||||
|
||||
- **-O/--disorder \<Percentage>** :
|
||||
指定乱序数据的百分比概率,其值域为 [0,50]。默认为 0,即没有乱序数据。
|
||||
|
||||
- **-R/--disorder-range \<timeRange>** :
|
||||
指定乱序数据的时间戳回退范围。所生成的乱序时间戳为非乱序情况下应该使用的时间戳减去这个范围内的一个随机值。仅在 `-O/--disorder` 指定的乱序数据百分比大于 0 时有效。
|
||||
|
||||
- **-F/--prepare_rand \<Num>** :
|
||||
生成的随机数据中唯一值的数量。若为 1 则表示所有数据都相同。默认值为 10000 。
|
||||
|
||||
- **-a/--replica \<replicaNum>** :
|
||||
创建数据库时指定其副本数,默认值为 1 。
|
||||
|
||||
- ** -k/--keep-trying \<NUMBER>** : 失败后进行重试的次数,默认不重试。需使用 v3.0.9 以上版本。
|
||||
|
||||
- ** -z/--trying-interval \<NUMBER>** : 失败重试间隔时间,单位为毫秒,仅在 -k 指定重试后有效。需使用 v3.0.9 以上版本。
|
||||
|
||||
- **-v/--vgroups \<NUMBER>** :
|
||||
创建数据库时指定 vgroups 数,仅对 TDengine v3.0+ 有效。
|
||||
|
||||
- **-V/--version** :
|
||||
显示版本信息并退出。不能与其它参数混用。
|
||||
|
||||
- **-?/--help** :
|
||||
显示帮助信息并退出。不能与其它参数混用。
|
||||
- 1 ~ 3 行实时输出每个消费者当前的消费速度,`msgs/s` 表示消费消息个数,每个消息中包含多行数据,`rows/s` 表示按行数统计的消费速度
|
||||
- 4 ~ 6 行是测试完成后每个消费者总体统计,统计共消费了多少条消息,共计多少行
|
||||
- 第 7 行所有消费者总体统计,`msgs` 表示共消费了多少条消息, `rows` 表示共消费了多少行数据
|
||||
|
||||
## 配置文件参数详解
|
||||
|
||||
|
@ -220,7 +192,7 @@ taosBenchmark -A INT,DOUBLE,NCHAR,BINARY\(16\)
|
|||
|
||||
本节所列参数适用于所有功能模式。
|
||||
|
||||
- **filetype** : 要测试的功能,可选值为 `insert`, `query` 和 `subscribe`。分别对应插入、查询和订阅功能。每个配置文件中只能指定其中之一。
|
||||
- **filetype** : 功能分类,可选值为 `insert`, `query` 和 `subscribe`。分别对应插入、查询和订阅功能。每个配置文件中只能指定其中之一。
|
||||
- **cfgdir** : TDengine 客户端配置文件所在的目录,默认路径是 /etc/taos 。
|
||||
|
||||
- **host** : 指定要连接的 TDengine 服务端的 FQDN,默认值为 localhost。
|
||||
|
@ -252,7 +224,7 @@ taosBenchmark -A INT,DOUBLE,NCHAR,BINARY\(16\)
|
|||
|
||||
- **name** : 数据库名。
|
||||
|
||||
- **drop** : 插入前是否删除数据库,可选项为 "yes" 或者 "no", 为 "no" 时不创建。默认删除。
|
||||
- **drop** : 数据库已存在时是否删除重建,可选项为 "yes" 或 "no", 默认为 “yes”
|
||||
|
||||
#### 流式计算相关配置参数
|
||||
|
||||
|
@ -331,21 +303,6 @@ taosBenchmark -A INT,DOUBLE,NCHAR,BINARY\(16\)
|
|||
- **repeat_ts_max** : 数值类型,复合主键开启情况下指定生成相同时间戳记录的最大个数
|
||||
- **sqls** : 字符串数组类型,指定超级表创建成功后要执行的 sql 数组,sql 中指定表名前面要带数据库名,否则会报未指定数据库错误
|
||||
|
||||
#### tsma配置参数
|
||||
|
||||
指定tsma的配置参数在 `super_tables` 中的 `tsmas` 中,具体参数如下。
|
||||
|
||||
- **name** : 指定 tsma 的名字,必选项。
|
||||
|
||||
- **function** : 指定 tsma 的函数,必选项。
|
||||
|
||||
- **interval** : 指定 tsma 的时间间隔,必选项。
|
||||
|
||||
- **sliding** : 指定 tsma 的窗口时间位移,必选项。
|
||||
|
||||
- **custom** : 指定 tsma 的创建语句结尾追加的自定义配置,可选项。
|
||||
|
||||
- **start_when_inserted** : 指定当插入多少行时创建 tsma,可选项,默认为 0。
|
||||
|
||||
#### 标签列与数据列配置参数
|
||||
|
||||
|
@ -415,7 +372,8 @@ taosBenchmark -A INT,DOUBLE,NCHAR,BINARY\(16\)
|
|||
查询场景下 `filetype` 必须设置为 `query`。
|
||||
`query_times` 指定运行查询的次数,数值类型
|
||||
|
||||
查询场景可以通过设置 `kill_slow_query_threshold` 和 `kill_slow_query_interval` 参数来控制杀掉慢查询语句的执行,threshold 控制如果 exec_usec 超过指定时间的查询将被 taosBenchmark 杀掉,单位为秒;interval 控制休眠时间,避免持续查询慢查询消耗 CPU ,单位为秒。
|
||||
查询场景可以通过设置 `kill_slow_query_threshold` 和 `kill_slow_query_interval` 参数来控制杀掉慢查询语句的执行,threshold 控制如果 exec_usec 超过指定时间的查询将被 taosBenchmark 杀掉,单位为秒;
|
||||
interval 控制休眠时间,避免持续查询慢查询消耗 CPU ,单位为秒。
|
||||
|
||||
其它通用参数详见[通用配置参数](#通用配置参数)。
|
||||
|
||||
|
@ -423,6 +381,11 @@ taosBenchmark -A INT,DOUBLE,NCHAR,BINARY\(16\)
|
|||
|
||||
查询指定表(可以指定超级表、子表或普通表)的配置参数在 `specified_table_query` 中设置。
|
||||
|
||||
- **mixed_query** : 查询模式,取值 “yes” 为`混合查询`, "no" 为`正常查询` , 默认值为 “no”
|
||||
`混合查询`:`sqls` 中所有 sql 按 `threads` 线程数分组,每个线程执行一组, 线程中每个 sql 都需执行 `query_times` 次查询
|
||||
`正常查询`:`sqls` 中每个 sql 启动 `threads` 个线程,每个线程执行完 `query_times` 次后退出,下个 sql 需等待上个 sql 线程全部执行完退出后方可执行
|
||||
不管 `正常查询` 还是 `混合查询` ,执行查询总次数是相同的 ,查询总次数 = `sqls` 个数 * `threads` * `query_times`, 区别是 `正常查询` 每个 sql 都会启动 `threads` 个线程,而 `混合查询` 只启动一次 `threads` 个线程执行完所有 SQL, 两者启动线程次数不一样。
|
||||
|
||||
- **query_interval** : 查询时间间隔,单位是秒,默认值为 0。
|
||||
|
||||
- **threads** : 执行查询 SQL 的线程数,默认值为 1。
|
||||
|
@ -433,7 +396,8 @@ taosBenchmark -A INT,DOUBLE,NCHAR,BINARY\(16\)
|
|||
|
||||
#### 查询超级表的配置参数
|
||||
|
||||
查询超级表的配置参数在 `super_table_query` 中设置。
|
||||
查询超级表的配置参数在 `super_table_query` 中设置。
|
||||
超级表查询的线程模式与上面介绍的指定查询语句查询的 `正常查询` 模式相同,不同之处是本 `sqls` 使用所有子表填充。
|
||||
|
||||
- **stblname** : 指定要查询的超级表的名称,必填。
|
||||
|
||||
|
|
|
@ -403,7 +403,7 @@ description: TDengine 服务端的错误码列表和详细说明
|
|||
| 0x8000260D | Tags number not matched | tag列个数不匹配 | 检查并修正SQL语句 |
|
||||
| 0x8000260E | Invalid tag name | 无效或不存在的tag名 | 检查并修正SQL语句 |
|
||||
| 0x80002610 | Value is too long | 值长度超出限制 | 检查并修正SQL语句或API参数 |
|
||||
| 0x80002611 | Password can not be empty | 密码为空 | 使用合法的密码 |
|
||||
| 0x80002611 | Password too short or empty | 密码为空或少于 8 个字符 | 使用合法的密码 |
|
||||
| 0x80002612 | Port should be an integer that is less than 65535 and greater than 0 | 端口号非法 | 检查并修正端口号 |
|
||||
| 0x80002613 | Endpoint should be in the format of 'fqdn:port' | 地址格式错误 | 检查并修正地址信息 |
|
||||
| 0x80002614 | This statement is no longer supported | 功能已经废弃 | 参考功能文档说明 |
|
||||
|
|
Before Width: | Height: | Size: 319 KiB After Width: | Height: | Size: 232 KiB |
Before Width: | Height: | Size: 476 KiB After Width: | Height: | Size: 330 KiB |
Before Width: | Height: | Size: 359 KiB After Width: | Height: | Size: 332 KiB |
Before Width: | Height: | Size: 231 KiB After Width: | Height: | Size: 250 KiB |
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 70 KiB |
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 75 KiB |
|
@ -28,8 +28,8 @@ extern "C" {
|
|||
#define ANAL_FORECAST_DEFAULT_ROWS 10
|
||||
#define ANAL_FORECAST_DEFAULT_CONF 95
|
||||
#define ANAL_FORECAST_DEFAULT_WNCHECK 1
|
||||
#define ANAL_FORECAST_MAX_ROWS 10000
|
||||
#define ANAL_ANOMALY_WINDOW_MAX_ROWS 10000
|
||||
#define ANAL_FORECAST_MAX_ROWS 40000
|
||||
#define ANAL_ANOMALY_WINDOW_MAX_ROWS 40000
|
||||
|
||||
typedef struct {
|
||||
EAnalAlgoType type;
|
||||
|
|
|
@ -114,6 +114,7 @@ extern int32_t tsRetentionSpeedLimitMB;
|
|||
|
||||
extern const char *tsAlterCompactTaskKeywords;
|
||||
extern int32_t tsNumOfCompactThreads;
|
||||
extern int32_t tsNumOfRetentionThreads;
|
||||
|
||||
// sync raft
|
||||
extern int32_t tsElectInterval;
|
||||
|
@ -291,6 +292,7 @@ extern bool tsFilterScalarMode;
|
|||
extern int32_t tsMaxStreamBackendCache;
|
||||
extern int32_t tsPQSortMemThreshold;
|
||||
extern int32_t tsResolveFQDNRetryTime;
|
||||
extern bool tsStreamCoverage;
|
||||
|
||||
extern bool tsExperimental;
|
||||
// #define NEEDTO_COMPRESSS_MSG(size) (tsCompressMsgSize != -1 && (size) > tsCompressMsgSize)
|
||||
|
@ -323,6 +325,8 @@ void printConfigNotMatch(SArray *array);
|
|||
|
||||
int32_t compareSConfigItemArrays(SArray *mArray, const SArray *dArray, SArray *diffArray);
|
||||
bool isConifgItemLazyMode(SConfigItem *item);
|
||||
int32_t taosUpdateTfsItemDisable(SConfig *pCfg, const char *value, void *pTfs);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -288,6 +288,7 @@ struct SScalarParam {
|
|||
bool colAlloced;
|
||||
SColumnInfoData *columnData;
|
||||
SHashObj *pHashFilter;
|
||||
SHashObj *pHashFilterOthers;
|
||||
int32_t hashValueType;
|
||||
void *param; // other parameter, such as meta handle from vnode, to extract table name/tag value
|
||||
int32_t numOfRows;
|
||||
|
|
|
@ -109,8 +109,9 @@ int32_t doCallUdfAggProcess(UdfcFuncHandle handle, SSDataBlock *block, SUdfInter
|
|||
int32_t doCallUdfAggFinalize(UdfcFuncHandle handle, SUdfInterBuf *interBuf, SUdfInterBuf *resultData);
|
||||
// input: interbuf1, interbuf2
|
||||
// output: resultBuf
|
||||
int32_t doCallUdfAggMerge(UdfcFuncHandle handle, SUdfInterBuf *interBuf1, SUdfInterBuf *interBuf2,
|
||||
SUdfInterBuf *resultBuf);
|
||||
// udf todo: aggmerge
|
||||
// int32_t doCallUdfAggMerge(UdfcFuncHandle handle, SUdfInterBuf *interBuf1, SUdfInterBuf *interBuf2,
|
||||
// SUdfInterBuf *resultBuf);
|
||||
// input: block
|
||||
// output: resultData
|
||||
int32_t doCallUdfScalarFunc(UdfcFuncHandle handle, SScalarParam *input, int32_t numOfCols, SScalarParam *output);
|
||||
|
|
|
@ -40,7 +40,7 @@ pDst need to freed in caller
|
|||
int32_t scalarCalculate(SNode *pNode, SArray *pBlockList, SScalarParam *pDst);
|
||||
|
||||
int32_t scalarGetOperatorParamNum(EOperatorType type);
|
||||
int32_t scalarGenerateSetFromList(void **data, void *pNode, uint32_t type);
|
||||
int32_t scalarGenerateSetFromList(void **data, void *pNode, uint32_t type, int8_t processType);
|
||||
|
||||
int32_t vectorGetConvertType(int32_t type1, int32_t type2);
|
||||
int32_t vectorConvertSingleColImpl(const SScalarParam *pIn, SScalarParam *pOut, int32_t *overflow, int32_t startIndex, int32_t numOfRows);
|
||||
|
|
|
@ -319,6 +319,15 @@ bool tfsDiskSpaceAvailable(STfs *pTfs, int32_t level);
|
|||
*/
|
||||
bool tfsDiskSpaceSufficient(STfs *pTfs, int32_t level, int32_t disk);
|
||||
|
||||
/**
|
||||
* @brief Update disk size of tfs.
|
||||
*
|
||||
* @param pTfs The fs object.
|
||||
* @param dir The directory.
|
||||
* @param disable The disable flag.
|
||||
*/
|
||||
int32_t tfsUpdateDiskDisable(STfs *pTfs, const char *dir, int8_t disable);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -801,7 +801,7 @@ int32_t taosGetErrSize();
|
|||
#define TSDB_CODE_PAR_TAGS_NOT_MATCHED TAOS_DEF_ERROR_CODE(0, 0x260D)
|
||||
#define TSDB_CODE_PAR_INVALID_TAG_NAME TAOS_DEF_ERROR_CODE(0, 0x260E)
|
||||
#define TSDB_CODE_PAR_NAME_OR_PASSWD_TOO_LONG TAOS_DEF_ERROR_CODE(0, 0x2610)
|
||||
#define TSDB_CODE_PAR_PASSWD_EMPTY TAOS_DEF_ERROR_CODE(0, 0x2611)
|
||||
#define TSDB_CODE_PAR_PASSWD_TOO_SHORT_OR_EMPTY TAOS_DEF_ERROR_CODE(0, 0x2611)
|
||||
#define TSDB_CODE_PAR_INVALID_PORT TAOS_DEF_ERROR_CODE(0, 0x2612)
|
||||
#define TSDB_CODE_PAR_INVALID_ENDPOINT TAOS_DEF_ERROR_CODE(0, 0x2613)
|
||||
#define TSDB_CODE_PAR_EXPRIE_STATEMENT TAOS_DEF_ERROR_CODE(0, 0x2614)
|
||||
|
|
|
@ -44,27 +44,27 @@ mkdir -p ${pkg_dir}${install_home_path}/include
|
|||
#mkdir -p ${pkg_dir}${install_home_path}/init.d
|
||||
mkdir -p ${pkg_dir}${install_home_path}/script
|
||||
|
||||
# download taoskeeper and build
|
||||
if [ "$cpuType" = "x64" ] || [ "$cpuType" = "x86_64" ] || [ "$cpuType" = "amd64" ]; then
|
||||
arch=amd64
|
||||
elif [ "$cpuType" = "x32" ] || [ "$cpuType" = "i386" ] || [ "$cpuType" = "i686" ]; then
|
||||
arch=386
|
||||
elif [ "$cpuType" = "arm" ] || [ "$cpuType" = "aarch32" ]; then
|
||||
arch=arm
|
||||
elif [ "$cpuType" = "arm64" ] || [ "$cpuType" = "aarch64" ]; then
|
||||
arch=arm64
|
||||
else
|
||||
arch=$cpuType
|
||||
fi
|
||||
# # download taoskeeper and build
|
||||
# if [ "$cpuType" = "x64" ] || [ "$cpuType" = "x86_64" ] || [ "$cpuType" = "amd64" ]; then
|
||||
# arch=amd64
|
||||
# elif [ "$cpuType" = "x32" ] || [ "$cpuType" = "i386" ] || [ "$cpuType" = "i686" ]; then
|
||||
# arch=386
|
||||
# elif [ "$cpuType" = "arm" ] || [ "$cpuType" = "aarch32" ]; then
|
||||
# arch=arm
|
||||
# elif [ "$cpuType" = "arm64" ] || [ "$cpuType" = "aarch64" ]; then
|
||||
# arch=arm64
|
||||
# else
|
||||
# arch=$cpuType
|
||||
# fi
|
||||
|
||||
echo "${top_dir}/../enterprise/packaging/build_taoskeeper.sh -r ${arch} -e taoskeeper -t ver-${tdengine_ver}"
|
||||
echo "$top_dir=${top_dir}"
|
||||
taoskeeper_binary=`${top_dir}/../enterprise/packaging/build_taoskeeper.sh -r $arch -e taoskeeper -t ver-${tdengine_ver}`
|
||||
echo "taoskeeper_binary: ${taoskeeper_binary}"
|
||||
# echo "${top_dir}/../enterprise/packaging/build_taoskeeper.sh -r ${arch} -e taoskeeper -t ver-${tdengine_ver}"
|
||||
# echo "$top_dir=${top_dir}"
|
||||
# taoskeeper_binary=`${top_dir}/../enterprise/packaging/build_taoskeeper.sh -r $arch -e taoskeeper -t ver-${tdengine_ver}`
|
||||
# echo "taoskeeper_binary: ${taoskeeper_binary}"
|
||||
|
||||
# copy config files
|
||||
cp $(dirname ${taoskeeper_binary})/config/taoskeeper.toml ${pkg_dir}${install_home_path}/cfg
|
||||
cp $(dirname ${taoskeeper_binary})/taoskeeper.service ${pkg_dir}${install_home_path}/cfg
|
||||
# cp $(dirname ${taoskeeper_binary})/config/taoskeeper.toml ${pkg_dir}${install_home_path}/cfg
|
||||
# cp $(dirname ${taoskeeper_binary})/taoskeeper.service ${pkg_dir}${install_home_path}/cfg
|
||||
|
||||
cp ${compile_dir}/../packaging/cfg/taos.cfg ${pkg_dir}${install_home_path}/cfg
|
||||
cp ${compile_dir}/../packaging/cfg/taosd.service ${pkg_dir}${install_home_path}/cfg
|
||||
|
@ -75,7 +75,12 @@ fi
|
|||
if [ -f "${compile_dir}/test/cfg/taosadapter.service" ]; then
|
||||
cp ${compile_dir}/test/cfg/taosadapter.service ${pkg_dir}${install_home_path}/cfg || :
|
||||
fi
|
||||
|
||||
if [ -f "${compile_dir}/test/cfg/taoskeeper.toml" ]; then
|
||||
cp ${compile_dir}/test/cfg/taoskeeper.toml ${pkg_dir}${install_home_path}/cfg || :
|
||||
fi
|
||||
if [ -f "${compile_dir}/test/cfg/taoskeeper.service" ]; then
|
||||
cp ${compile_dir}/test/cfg/taoskeeper.service ${pkg_dir}${install_home_path}/cfg || :
|
||||
fi
|
||||
if [ -f "${compile_dir}/../../../explorer/target/taos-explorer.service" ]; then
|
||||
cp ${compile_dir}/../../../explorer/target/taos-explorer.service ${pkg_dir}${install_home_path}/cfg || :
|
||||
fi
|
||||
|
@ -83,7 +88,7 @@ if [ -f "${compile_dir}/../../../explorer/server/example/explorer.toml" ]; then
|
|||
cp ${compile_dir}/../../../explorer/server/example/explorer.toml ${pkg_dir}${install_home_path}/cfg || :
|
||||
fi
|
||||
|
||||
cp ${taoskeeper_binary} ${pkg_dir}${install_home_path}/bin
|
||||
# cp ${taoskeeper_binary} ${pkg_dir}${install_home_path}/bin
|
||||
#cp ${compile_dir}/../packaging/deb/taosd ${pkg_dir}${install_home_path}/init.d
|
||||
cp ${compile_dir}/../packaging/tools/post.sh ${pkg_dir}${install_home_path}/script
|
||||
cp ${compile_dir}/../packaging/tools/preun.sh ${pkg_dir}${install_home_path}/script
|
||||
|
@ -104,6 +109,9 @@ cp ${compile_dir}/build/bin/taosdump ${pkg_dir}${install_home_path
|
|||
if [ -f "${compile_dir}/build/bin/taosadapter" ]; then
|
||||
cp ${compile_dir}/build/bin/taosadapter ${pkg_dir}${install_home_path}/bin ||:
|
||||
fi
|
||||
if [ -f "${compile_dir}/build/bin/taoskeeper" ]; then
|
||||
cp ${compile_dir}/build/bin/taoskeeper ${pkg_dir}${install_home_path}/bin ||:
|
||||
fi
|
||||
|
||||
if [ -f "${compile_dir}/../../../explorer/target/release/taos-explorer" ]; then
|
||||
cp ${compile_dir}/../../../explorer/target/release/taos-explorer ${pkg_dir}${install_home_path}/bin ||:
|
||||
|
@ -185,7 +193,7 @@ else
|
|||
exit 1
|
||||
fi
|
||||
|
||||
rm -rf ${pkg_dir}/build-taoskeeper
|
||||
# rm -rf ${pkg_dir}/build-taoskeeper
|
||||
# make deb package
|
||||
dpkg -b ${pkg_dir} $debname
|
||||
echo "make deb package success!"
|
||||
|
|
|
@ -56,24 +56,23 @@ fi
|
|||
${csudo}mkdir -p ${pkg_dir}
|
||||
cd ${pkg_dir}
|
||||
|
||||
# download taoskeeper and build
|
||||
if [ "$cpuType" = "x64" ] || [ "$cpuType" = "x86_64" ] || [ "$cpuType" = "amd64" ]; then
|
||||
arch=amd64
|
||||
elif [ "$cpuType" = "x32" ] || [ "$cpuType" = "i386" ] || [ "$cpuType" = "i686" ]; then
|
||||
arch=386
|
||||
elif [ "$cpuType" = "arm" ] || [ "$cpuType" = "aarch32" ]; then
|
||||
arch=arm
|
||||
elif [ "$cpuType" = "arm64" ] || [ "$cpuType" = "aarch64" ]; then
|
||||
arch=arm64
|
||||
else
|
||||
arch=$cpuType
|
||||
fi
|
||||
# # download taoskeeper and build
|
||||
# if [ "$cpuType" = "x64" ] || [ "$cpuType" = "x86_64" ] || [ "$cpuType" = "amd64" ]; then
|
||||
# arch=amd64
|
||||
# elif [ "$cpuType" = "x32" ] || [ "$cpuType" = "i386" ] || [ "$cpuType" = "i686" ]; then
|
||||
# arch=386
|
||||
# elif [ "$cpuType" = "arm" ] || [ "$cpuType" = "aarch32" ]; then
|
||||
# arch=arm
|
||||
# elif [ "$cpuType" = "arm64" ] || [ "$cpuType" = "aarch64" ]; then
|
||||
# arch=arm64
|
||||
# else
|
||||
# arch=$cpuType
|
||||
# fi
|
||||
|
||||
cd ${top_dir}
|
||||
echo "${top_dir}/../enterprise/packaging/build_taoskeeper.sh -r ${arch} -e taoskeeper -t ver-${tdengine_ver}"
|
||||
taoskeeper_binary=`${top_dir}/../enterprise/packaging/build_taoskeeper.sh -r $arch -e taoskeeper -t ver-${tdengine_ver}`
|
||||
echo "taoskeeper_binary: ${taoskeeper_binary}"
|
||||
cd ${package_dir}
|
||||
# cd ${top_dir}
|
||||
# echo "${top_dir}/../enterprise/packaging/build_taoskeeper.sh -r ${arch} -e taoskeeper -t ver-${tdengine_ver}"
|
||||
# taoskeeper_binary=`${top_dir}/../enterprise/packaging/build_taoskeeper.sh -r $arch -e taoskeeper -t ver-${tdengine_ver}`
|
||||
# echo "taoskeeper_binary: ${taoskeeper_binary}"
|
||||
|
||||
${csudo}mkdir -p BUILD BUILDROOT RPMS SOURCES SPECS SRPMS
|
||||
|
||||
|
@ -106,4 +105,4 @@ mv ${output_dir}/TDengine-${tdengine_ver}.rpm ${output_dir}/${rpmname}
|
|||
|
||||
cd ..
|
||||
${csudo}rm -rf ${pkg_dir}
|
||||
rm -rf ${top_dir}/build-taoskeeper
|
||||
# rm -rf ${top_dir}/build-taoskeeper
|
|
@ -68,12 +68,12 @@ if [ -f %{_compiledir}/test/cfg/taosadapter.service ]; then
|
|||
cp %{_compiledir}/test/cfg/taosadapter.service %{buildroot}%{homepath}/cfg
|
||||
fi
|
||||
|
||||
if [ -f %{_compiledir}/../build-taoskeeper/config/taoskeeper.toml ]; then
|
||||
cp %{_compiledir}/../build-taoskeeper/config/taoskeeper.toml %{buildroot}%{homepath}/cfg ||:
|
||||
if [ -f %{_compiledir}/test/cfg/taoskeeper.toml ]; then
|
||||
cp %{_compiledir}/test/cfg/taoskeeper.toml %{buildroot}%{homepath}/cfg ||:
|
||||
fi
|
||||
|
||||
if [ -f %{_compiledir}/../build-taoskeeper/taoskeeper.service ]; then
|
||||
cp %{_compiledir}/../build-taoskeeper/taoskeeper.service %{buildroot}%{homepath}/cfg ||:
|
||||
if [ -f %{_compiledir}/test/cfg/taoskeeper.service ]; then
|
||||
cp %{_compiledir}/test/cfg/taoskeeper.service %{buildroot}%{homepath}/cfg ||:
|
||||
fi
|
||||
|
||||
if [ -f %{_compiledir}/../../../explorer/target/taos-explorer.service ]; then
|
||||
|
@ -104,8 +104,8 @@ if [ -f %{_compiledir}/../../../explorer/target/release/taos-explorer ]; then
|
|||
cp %{_compiledir}/../../../explorer/target/release/taos-explorer %{buildroot}%{homepath}/bin
|
||||
fi
|
||||
|
||||
if [ -f %{_compiledir}/../build-taoskeeper/taoskeeper ]; then
|
||||
cp %{_compiledir}/../build-taoskeeper/taoskeeper %{buildroot}%{homepath}/bin
|
||||
if [ -f %{_compiledir}/build/bin//taoskeeper ]; then
|
||||
cp %{_compiledir}/build/bin//taoskeeper %{buildroot}%{homepath}/bin
|
||||
fi
|
||||
|
||||
if [ -f %{_compiledir}/build/bin/taosadapter ]; then
|
||||
|
|
|
@ -282,5 +282,3 @@ else
|
|||
rm -rf ${install_dir} ||:
|
||||
# mv ../"$(basename ${pkg_name}).tar.gz" .
|
||||
fi
|
||||
|
||||
cd ${curr_dir}
|
||||
|
|
|
@ -2201,6 +2201,11 @@ int taos_stmt2_bind_param(TAOS_STMT2 *stmt, TAOS_STMT2_BINDV *bindv, int32_t col
|
|||
if (code) {
|
||||
goto out;
|
||||
}
|
||||
} else if (pStmt->bInfo.tbType == TSDB_CHILD_TABLE && pStmt->sql.autoCreateTbl) {
|
||||
code = stmtSetTbTags2(stmt, NULL);
|
||||
if (code) {
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
||||
if (bindv->bind_cols && bindv->bind_cols[i]) {
|
||||
|
|
|
@ -1012,10 +1012,10 @@ int stmtSetTbTags2(TAOS_STMT2* stmt, TAOS_STMT2_BIND* tags) {
|
|||
}
|
||||
|
||||
SBoundColInfo* tags_info = (SBoundColInfo*)pStmt->bInfo.boundTags;
|
||||
if (tags_info->numOfBound <= 0 || tags_info->numOfCols <= 0) {
|
||||
tscWarn("no tags or cols bound in sql, will not bound tags");
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
// if (tags_info->numOfBound <= 0 || tags_info->numOfCols <= 0) {
|
||||
// tscWarn("no tags or cols bound in sql, will not bound tags");
|
||||
// return TSDB_CODE_SUCCESS;
|
||||
// }
|
||||
|
||||
STableDataCxt** pDataBlock =
|
||||
(STableDataCxt**)taosHashGet(pStmt->exec.pBlockHash, pStmt->bInfo.tbFName, strlen(pStmt->bInfo.tbFName));
|
||||
|
|
|
@ -14,12 +14,12 @@
|
|||
*/
|
||||
|
||||
#define _DEFAULT_SOURCE
|
||||
#include "tglobal.h"
|
||||
#include "cJSON.h"
|
||||
#include "defines.h"
|
||||
#include "os.h"
|
||||
#include "osString.h"
|
||||
#include "tconfig.h"
|
||||
#include "tglobal.h"
|
||||
#include "tgrant.h"
|
||||
#include "tjson.h"
|
||||
#include "tlog.h"
|
||||
|
@ -104,6 +104,7 @@ int32_t tsRetentionSpeedLimitMB = 0; // unlimited
|
|||
|
||||
const char *tsAlterCompactTaskKeywords = "max_compact_tasks";
|
||||
int32_t tsNumOfCompactThreads = 2;
|
||||
int32_t tsNumOfRetentionThreads = 1;
|
||||
|
||||
// sync raft
|
||||
int32_t tsElectInterval = 25 * 1000;
|
||||
|
@ -328,6 +329,7 @@ int64_t tsStreamBufferSize = 128 * 1024 * 1024;
|
|||
bool tsFilterScalarMode = false;
|
||||
int tsResolveFQDNRetryTime = 100; // seconds
|
||||
int tsStreamAggCnt = 100000;
|
||||
bool tsStreamCoverage = false;
|
||||
|
||||
bool tsUpdateCacheBatch = true;
|
||||
|
||||
|
@ -390,6 +392,16 @@ int32_t taosSetTfsCfg(SConfig *pCfg) {
|
|||
int32_t taosSetTfsCfg(SConfig *pCfg);
|
||||
#endif
|
||||
|
||||
#ifndef _STORAGE
|
||||
int32_t cfgUpdateTfsItemDisable(SConfig *pCfg, const char *value, void *pTfs) { return TSDB_CODE_INVALID_CFG; }
|
||||
#else
|
||||
int32_t cfgUpdateTfsItemDisable(SConfig *pCfg, const char *value, void *pTfs);
|
||||
#endif
|
||||
|
||||
int32_t taosUpdateTfsItemDisable(SConfig *pCfg, const char *value, void *pTfs) {
|
||||
return cfgUpdateTfsItemDisable(pCfg, value, pTfs);
|
||||
}
|
||||
|
||||
static int32_t taosSplitS3Cfg(SConfig *pCfg, const char *name, char gVarible[TSDB_MAX_EP_NUM][TSDB_FQDN_LEN],
|
||||
int8_t *pNum) {
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
|
@ -733,6 +745,9 @@ static int32_t taosAddClientCfg(SConfig *pCfg) {
|
|||
CFG_DYN_CLIENT, CFG_CATEGORY_LOCAL));
|
||||
TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "tsmaDataDeleteMark", tsmaDataDeleteMark, 60 * 60 * 1000, INT64_MAX,
|
||||
CFG_SCOPE_CLIENT, CFG_DYN_CLIENT, CFG_CATEGORY_LOCAL));
|
||||
|
||||
TAOS_CHECK_RETURN(cfgAddBool(pCfg, "streamCoverage", tsStreamCoverage, CFG_DYN_CLIENT, CFG_DYN_CLIENT, CFG_CATEGORY_LOCAL));
|
||||
|
||||
TAOS_RETURN(TSDB_CODE_SUCCESS);
|
||||
}
|
||||
|
||||
|
@ -1463,6 +1478,9 @@ static int32_t taosSetClientCfg(SConfig *pCfg) {
|
|||
TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "bypassFlag");
|
||||
tsBypassFlag = pItem->i32;
|
||||
|
||||
TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "streamCoverage");
|
||||
tsStreamCoverage = pItem->bval;
|
||||
|
||||
TAOS_RETURN(TSDB_CODE_SUCCESS);
|
||||
}
|
||||
|
||||
|
@ -2381,6 +2399,10 @@ static int32_t taosCfgDynamicOptionsForServer(SConfig *pCfg, const char *name) {
|
|||
code = TSDB_CODE_SUCCESS;
|
||||
goto _exit;
|
||||
}
|
||||
if (strcasecmp(name, "dataDir") == 0) {
|
||||
code = TSDB_CODE_SUCCESS;
|
||||
goto _exit;
|
||||
}
|
||||
|
||||
{ // 'bool/int32_t/int64_t/float/double' variables with general modification function
|
||||
static OptionNameAndVar debugOptions[] = {
|
||||
|
@ -2735,7 +2757,8 @@ static int32_t taosCfgDynamicOptionsForClient(SConfig *pCfg, const char *name) {
|
|||
{"maxTsmaCalcDelay", &tsMaxTsmaCalcDelay},
|
||||
{"tsmaDataDeleteMark", &tsmaDataDeleteMark},
|
||||
{"numOfRpcSessions", &tsNumOfRpcSessions},
|
||||
{"bypassFlag", &tsBypassFlag}};
|
||||
{"bypassFlag", &tsBypassFlag},
|
||||
{"streamCoverage", &tsStreamCoverage}};
|
||||
|
||||
if ((code = taosCfgSetOption(debugOptions, tListLen(debugOptions), pItem, true)) != TSDB_CODE_SUCCESS) {
|
||||
code = taosCfgSetOption(options, tListLen(options), pItem, false);
|
||||
|
|
|
@ -25,6 +25,7 @@ extern "C" {
|
|||
typedef struct SDnodeMgmt {
|
||||
SDnodeData *pData;
|
||||
SMsgCb msgCb;
|
||||
STfs *pTfs;
|
||||
const char *path;
|
||||
const char *name;
|
||||
TdThread statusThread;
|
||||
|
@ -69,6 +70,7 @@ int32_t dmStartStatusThread(SDnodeMgmt *pMgmt);
|
|||
int32_t dmStartConfigThread(SDnodeMgmt *pMgmt);
|
||||
int32_t dmStartStatusInfoThread(SDnodeMgmt *pMgmt);
|
||||
void dmStopStatusThread(SDnodeMgmt *pMgmt);
|
||||
void dmStopConfigThread(SDnodeMgmt *pMgmt);
|
||||
void dmStopStatusInfoThread(SDnodeMgmt *pMgmt);
|
||||
int32_t dmStartNotifyThread(SDnodeMgmt *pMgmt);
|
||||
void dmStopNotifyThread(SDnodeMgmt *pMgmt);
|
||||
|
|
|
@ -475,7 +475,7 @@ int32_t dmProcessGrantRsp(SDnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
extern void tsdbAlterMaxCompactTasks();
|
||||
extern void tsdbAlterNumCompactThreads();
|
||||
static int32_t dmAlterMaxCompactTask(const char *value) {
|
||||
int32_t max_compact_tasks;
|
||||
char *endptr = NULL;
|
||||
|
@ -489,7 +489,7 @@ static int32_t dmAlterMaxCompactTask(const char *value) {
|
|||
dInfo("alter max compact tasks from %d to %d", tsNumOfCompactThreads, max_compact_tasks);
|
||||
tsNumOfCompactThreads = max_compact_tasks;
|
||||
#ifdef TD_ENTERPRISE
|
||||
tsdbAlterMaxCompactTasks();
|
||||
(void)tsdbAlterNumCompactThreads();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -499,9 +499,15 @@ static int32_t dmAlterMaxCompactTask(const char *value) {
|
|||
int32_t dmProcessConfigReq(SDnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
||||
int32_t code = 0;
|
||||
SDCfgDnodeReq cfgReq = {0};
|
||||
SConfig *pCfg = taosGetCfg();
|
||||
SConfigItem *pItem = NULL;
|
||||
|
||||
if (tDeserializeSDCfgDnodeReq(pMsg->pCont, pMsg->contLen, &cfgReq) != 0) {
|
||||
return TSDB_CODE_INVALID_MSG;
|
||||
}
|
||||
if (strcasecmp(cfgReq.config, "dataDir") == 0) {
|
||||
return taosUpdateTfsItemDisable(pCfg, cfgReq.value, pMgmt->pTfs);
|
||||
}
|
||||
|
||||
if (strncmp(cfgReq.config, tsAlterCompactTaskKeywords, strlen(tsAlterCompactTaskKeywords) + 1) == 0) {
|
||||
return dmAlterMaxCompactTask(cfgReq.value);
|
||||
|
@ -509,9 +515,6 @@ int32_t dmProcessConfigReq(SDnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
|||
|
||||
dInfo("start to config, option:%s, value:%s", cfgReq.config, cfgReq.value);
|
||||
|
||||
SConfig *pCfg = taosGetCfg();
|
||||
SConfigItem *pItem = NULL;
|
||||
|
||||
code = cfgGetAndSetItem(pCfg, &pItem, cfgReq.config, cfgReq.value, CFG_STYPE_ALTER_SERVER_CMD, true);
|
||||
if (code != 0) {
|
||||
if (strncasecmp(cfgReq.config, "resetlog", strlen("resetlog")) == 0) {
|
||||
|
|
|
@ -52,6 +52,7 @@ static void dmStopMgmt(SDnodeMgmt *pMgmt) {
|
|||
dmStopMonitorThread(pMgmt);
|
||||
dmStopAuditThread(pMgmt);
|
||||
dmStopStatusThread(pMgmt);
|
||||
dmStopConfigThread(pMgmt);
|
||||
dmStopStatusInfoThread(pMgmt);
|
||||
#if defined(TD_ENTERPRISE)
|
||||
dmStopNotifyThread(pMgmt);
|
||||
|
@ -68,6 +69,7 @@ static int32_t dmOpenMgmt(SMgmtInputOpt *pInput, SMgmtOutputOpt *pOutput) {
|
|||
|
||||
pMgmt->pData = pInput->pData;
|
||||
pMgmt->msgCb = pInput->msgCb;
|
||||
pMgmt->pTfs = pInput->pTfs;
|
||||
pMgmt->path = pInput->path;
|
||||
pMgmt->name = pInput->name;
|
||||
pMgmt->processCreateNodeFp = pInput->processCreateNodeFp;
|
||||
|
|
|
@ -343,7 +343,7 @@ int32_t dmStartConfigThread(SDnodeMgmt *pMgmt) {
|
|||
int32_t code = 0;
|
||||
TdThreadAttr thAttr;
|
||||
(void)taosThreadAttrInit(&thAttr);
|
||||
(void)taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_DETACHED);
|
||||
(void)taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE);
|
||||
if (taosThreadCreate(&pMgmt->configThread, &thAttr, dmConfigThreadFp, pMgmt) != 0) {
|
||||
code = TAOS_SYSTEM_ERROR(errno);
|
||||
dError("failed to create config thread since %s", tstrerror(code));
|
||||
|
@ -378,6 +378,13 @@ void dmStopStatusThread(SDnodeMgmt *pMgmt) {
|
|||
}
|
||||
}
|
||||
|
||||
void dmStopConfigThread(SDnodeMgmt *pMgmt) {
|
||||
if (taosCheckPthreadValid(pMgmt->configThread)) {
|
||||
(void)taosThreadJoin(pMgmt->configThread, NULL);
|
||||
taosThreadClear(&pMgmt->configThread);
|
||||
}
|
||||
}
|
||||
|
||||
void dmStopStatusInfoThread(SDnodeMgmt *pMgmt) {
|
||||
if (taosCheckPthreadValid(pMgmt->statusInfoThread)) {
|
||||
(void)taosThreadJoin(pMgmt->statusInfoThread, NULL);
|
||||
|
|
|
@ -896,7 +896,7 @@ static int32_t vmInit(SMgmtInputOpt *pInput, SMgmtOutputOpt *pOutput) {
|
|||
}
|
||||
tmsgReportStartup("vnode-sync", "initialized");
|
||||
|
||||
if ((code = vnodeInit(tsNumOfCommitThreads, pInput->stopDnodeFp)) != 0) {
|
||||
if ((code = vnodeInit(pInput->stopDnodeFp)) != 0) {
|
||||
dError("failed to init vnode since %s", tstrerror(code));
|
||||
goto _OVER;
|
||||
}
|
||||
|
|
|
@ -1805,12 +1805,21 @@ _OVER:
|
|||
TAOS_RETURN(code);
|
||||
}
|
||||
|
||||
static int32_t mndCheckPasswordFmt(const char *pwd) {
|
||||
int32_t len = strlen(pwd);
|
||||
if (len < TSDB_PASSWORD_MIN_LEN || len > TSDB_PASSWORD_MAX_LEN) {
|
||||
static int32_t mndCheckPasswordMinLen(const char *pwd, int32_t len) {
|
||||
if (len < TSDB_PASSWORD_MIN_LEN) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int32_t mndCheckPasswordMaxLen(const char *pwd, int32_t len) {
|
||||
if (len > TSDB_PASSWORD_MAX_LEN) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int32_t mndCheckPasswordFmt(const char *pwd, int32_t len) {
|
||||
if (strcmp(pwd, "taosdata") == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -1875,14 +1884,17 @@ static int32_t mndProcessCreateUserReq(SRpcMsg *pReq) {
|
|||
TAOS_CHECK_GOTO(TSDB_CODE_MND_INVALID_USER_FORMAT, &lino, _OVER);
|
||||
}
|
||||
|
||||
if (mndCheckPasswordFmt(createReq.pass) != 0) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_MND_INVALID_PASS_FORMAT, &lino, _OVER);
|
||||
}
|
||||
|
||||
int32_t len = strlen(createReq.pass);
|
||||
if (createReq.isImport != 1) {
|
||||
if (strlen(createReq.pass) >= TSDB_PASSWORD_LEN) {
|
||||
if (mndCheckPasswordMinLen(createReq.pass, len) != 0) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_PAR_PASSWD_TOO_SHORT_OR_EMPTY, &lino, _OVER);
|
||||
}
|
||||
if (mndCheckPasswordMaxLen(createReq.pass, len) != 0) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_PAR_NAME_OR_PASSWD_TOO_LONG, &lino, _OVER);
|
||||
}
|
||||
if (mndCheckPasswordFmt(createReq.pass, len) != 0) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_MND_INVALID_PASS_FORMAT, &lino, _OVER);
|
||||
}
|
||||
}
|
||||
|
||||
code = mndAcquireUser(pMnode, createReq.user, &pUser);
|
||||
|
@ -2364,8 +2376,17 @@ static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) {
|
|||
TAOS_CHECK_GOTO(TSDB_CODE_MND_INVALID_USER_FORMAT, &lino, _OVER);
|
||||
}
|
||||
|
||||
if (TSDB_ALTER_USER_PASSWD == alterReq.alterType && mndCheckPasswordFmt(alterReq.pass) != 0) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_MND_INVALID_PASS_FORMAT, &lino, _OVER);
|
||||
if (TSDB_ALTER_USER_PASSWD == alterReq.alterType) {
|
||||
int32_t len = strlen(alterReq.pass);
|
||||
if (mndCheckPasswordMinLen(alterReq.pass, len) != 0) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_PAR_PASSWD_TOO_SHORT_OR_EMPTY, &lino, _OVER);
|
||||
}
|
||||
if (mndCheckPasswordMaxLen(alterReq.pass, len) != 0) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_PAR_NAME_OR_PASSWD_TOO_LONG, &lino, _OVER);
|
||||
}
|
||||
if (mndCheckPasswordFmt(alterReq.pass, len) != 0) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_MND_INVALID_PASS_FORMAT, &lino, _OVER);
|
||||
}
|
||||
}
|
||||
|
||||
TAOS_CHECK_GOTO(mndAcquireUser(pMnode, alterReq.user, &pUser), &lino, _OVER);
|
||||
|
|
|
@ -51,7 +51,7 @@ extern const SVnodeCfg vnodeCfgDefault;
|
|||
|
||||
typedef void (*StopDnodeFp)();
|
||||
|
||||
int32_t vnodeInit(int32_t nthreads, StopDnodeFp stopDnodeFp);
|
||||
int32_t vnodeInit(StopDnodeFp stopDnodeFp);
|
||||
void vnodeCleanup();
|
||||
int32_t vnodeCreate(const char *path, SVnodeCfg *pCfg, int32_t diskPrimary, STfs *pTfs);
|
||||
bool vnodeShouldRemoveWal(SVnode *pVnode);
|
||||
|
|
|
@ -1083,9 +1083,6 @@ void tsdbRemoveFile(const char *path);
|
|||
} \
|
||||
} while (0)
|
||||
|
||||
int32_t tsdbInit();
|
||||
void tsdbCleanUp();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -55,16 +55,32 @@ typedef enum {
|
|||
EVA_PRIORITY_LOW,
|
||||
} EVAPriority;
|
||||
|
||||
int32_t vnodeAsyncOpen(int32_t numOfThreads);
|
||||
typedef enum {
|
||||
EVA_TASK_COMMIT = 1,
|
||||
EVA_TASK_MERGE,
|
||||
EVA_TASK_COMPACT,
|
||||
EVA_TASK_RETENTION,
|
||||
} EVATaskT;
|
||||
|
||||
#define COMMIT_TASK_ASYNC 1
|
||||
#define MERGE_TASK_ASYNC 2
|
||||
#define COMPACT_TASK_ASYNC 3
|
||||
#define RETENTION_TASK_ASYNC 4
|
||||
|
||||
int32_t vnodeAsyncOpen();
|
||||
void vnodeAsyncClose();
|
||||
int32_t vnodeAChannelInit(int64_t async, SVAChannelID* channelID);
|
||||
int32_t vnodeAChannelDestroy(SVAChannelID* channelID, bool waitRunning);
|
||||
int32_t vnodeAsync(SVAChannelID* channelID, EVAPriority priority, int32_t (*execute)(void*), void (*complete)(void*),
|
||||
void* arg, SVATaskID* taskID);
|
||||
int32_t vnodeAsync(int64_t async, EVAPriority priority, int32_t (*execute)(void*), void (*complete)(void*), void* arg,
|
||||
SVATaskID* taskID);
|
||||
int32_t vnodeAsyncC(SVAChannelID* channelID, EVAPriority priority, int32_t (*execute)(void*), void (*complete)(void*),
|
||||
void* arg, SVATaskID* taskID);
|
||||
void vnodeAWait(SVATaskID* taskID);
|
||||
int32_t vnodeACancel(SVATaskID* taskID);
|
||||
int32_t vnodeAsyncSetWorkers(int64_t async, int32_t numWorkers);
|
||||
|
||||
const char* vnodeGetATaskName(EVATaskT task);
|
||||
|
||||
// vnodeBufPool.c
|
||||
typedef struct SVBufPoolNode SVBufPoolNode;
|
||||
struct SVBufPoolNode {
|
||||
|
|
|
@ -479,8 +479,7 @@ struct SVnode {
|
|||
SVBufPool* onRecycle;
|
||||
|
||||
// commit variables
|
||||
SVAChannelID commitChannel;
|
||||
SVATaskID commitTask;
|
||||
SVATaskID commitTask;
|
||||
|
||||
SMeta* pMeta;
|
||||
SSma* pSma;
|
||||
|
|
|
@ -2635,23 +2635,15 @@ _exit:
|
|||
}
|
||||
|
||||
int32_t tsdbCacheDel(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSKEY sKey, TSKEY eKey) {
|
||||
int32_t code = 0, lino = 0;
|
||||
// fetch schema
|
||||
int32_t code = 0, lino = 0;
|
||||
STSchema *pTSchema = NULL;
|
||||
int sver = -1;
|
||||
int numKeys = 0;
|
||||
SArray *remainCols = NULL;
|
||||
|
||||
TAOS_CHECK_RETURN(metaGetTbTSchemaEx(pTsdb->pVnode->pMeta, suid, uid, sver, &pTSchema));
|
||||
|
||||
// build keys & multi get from rocks
|
||||
int numCols = pTSchema->numOfCols;
|
||||
int numKeys = 0;
|
||||
SArray *remainCols = NULL;
|
||||
|
||||
code = tsdbCacheCommit(pTsdb);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
tsdbTrace("vgId:%d, %s commit failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, __LINE__,
|
||||
tstrerror(code));
|
||||
}
|
||||
int numCols = pTSchema->numOfCols;
|
||||
|
||||
(void)taosThreadMutexLock(&pTsdb->lruMutex);
|
||||
|
||||
|
|
|
@ -574,7 +574,7 @@ static int32_t tsdbCommitInfoBuild(STsdb *tsdb) {
|
|||
// begin tasks on file set
|
||||
for (int i = 0; i < taosArrayGetSize(tsdb->commitInfo->arr); i++) {
|
||||
SFileSetCommitInfo *info = *(SFileSetCommitInfo **)taosArrayGet(tsdb->commitInfo->arr, i);
|
||||
tsdbBeginTaskOnFileSet(tsdb, info->fid, &fset);
|
||||
tsdbBeginTaskOnFileSet(tsdb, info->fid, EVA_TASK_COMMIT, &fset);
|
||||
if (fset) {
|
||||
code = tsdbTFileSetInitCopy(tsdb, fset, &info->fset);
|
||||
if (code) {
|
||||
|
@ -712,7 +712,7 @@ int32_t tsdbCommitCommit(STsdb *tsdb) {
|
|||
for (int32_t i = 0; i < taosArrayGetSize(tsdb->commitInfo->arr); i++) {
|
||||
SFileSetCommitInfo *info = *(SFileSetCommitInfo **)taosArrayGet(tsdb->commitInfo->arr, i);
|
||||
if (info->fset) {
|
||||
tsdbFinishTaskOnFileSet(tsdb, info->fid);
|
||||
tsdbFinishTaskOnFileSet(tsdb, info->fid, EVA_TASK_COMMIT);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -743,7 +743,7 @@ int32_t tsdbCommitAbort(STsdb *pTsdb) {
|
|||
for (int32_t i = 0; i < taosArrayGetSize(pTsdb->commitInfo->arr); i++) {
|
||||
SFileSetCommitInfo *info = *(SFileSetCommitInfo **)taosArrayGet(pTsdb->commitInfo->arr, i);
|
||||
if (info->fset) {
|
||||
tsdbFinishTaskOnFileSet(pTsdb, info->fid);
|
||||
tsdbFinishTaskOnFileSet(pTsdb, info->fid, EVA_TASK_COMMIT);
|
||||
}
|
||||
}
|
||||
(void)taosThreadMutexUnlock(&pTsdb->mutex);
|
||||
|
|
|
@ -770,8 +770,8 @@ extern void tsdbStopAllCompTask(STsdb *tsdb);
|
|||
|
||||
int32_t tsdbDisableAndCancelAllBgTask(STsdb *pTsdb) {
|
||||
STFileSystem *fs = pTsdb->pFS;
|
||||
SArray *channelArray = taosArrayInit(0, sizeof(SVAChannelID));
|
||||
if (channelArray == NULL) {
|
||||
SArray *asyncTasks = taosArrayInit(0, sizeof(SVATaskID));
|
||||
if (asyncTasks == NULL) {
|
||||
return terrno;
|
||||
}
|
||||
|
||||
|
@ -783,30 +783,31 @@ int32_t tsdbDisableAndCancelAllBgTask(STsdb *pTsdb) {
|
|||
// collect channel
|
||||
STFileSet *fset;
|
||||
TARRAY2_FOREACH(fs->fSetArr, fset) {
|
||||
if (fset->channelOpened) {
|
||||
if (taosArrayPush(channelArray, &fset->channel) == NULL) {
|
||||
taosArrayDestroy(channelArray);
|
||||
(void)taosThreadMutexUnlock(&pTsdb->mutex);
|
||||
return terrno;
|
||||
}
|
||||
fset->channel = (SVAChannelID){0};
|
||||
fset->mergeScheduled = false;
|
||||
tsdbFSSetBlockCommit(fset, false);
|
||||
fset->channelOpened = false;
|
||||
if (taosArrayPush(asyncTasks, &fset->mergeTask) == NULL //
|
||||
|| taosArrayPush(asyncTasks, &fset->compactTask) == NULL //
|
||||
|| taosArrayPush(asyncTasks, &fset->retentionTask) == NULL) {
|
||||
taosArrayDestroy(asyncTasks);
|
||||
(void)taosThreadMutexUnlock(&pTsdb->mutex);
|
||||
return terrno;
|
||||
}
|
||||
fset->mergeScheduled = false;
|
||||
tsdbFSSetBlockCommit(fset, false);
|
||||
}
|
||||
|
||||
(void)taosThreadMutexUnlock(&pTsdb->mutex);
|
||||
|
||||
// destroy all channels
|
||||
for (int32_t i = 0; i < taosArrayGetSize(channelArray); i++) {
|
||||
SVAChannelID *channel = taosArrayGet(channelArray, i);
|
||||
int32_t code = vnodeAChannelDestroy(channel, true);
|
||||
if (code) {
|
||||
tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(pTsdb->pVnode), __func__, __LINE__, tstrerror(code));
|
||||
for (int32_t k = 0; k < 2; k++) {
|
||||
for (int32_t i = 0; i < taosArrayGetSize(asyncTasks); i++) {
|
||||
SVATaskID *task = taosArrayGet(asyncTasks, i);
|
||||
if (k == 0) {
|
||||
(void)vnodeACancel(task);
|
||||
} else {
|
||||
vnodeAWait(task);
|
||||
}
|
||||
}
|
||||
}
|
||||
taosArrayDestroy(channelArray);
|
||||
taosArrayDestroy(asyncTasks);
|
||||
|
||||
#ifdef TD_ENTERPRISE
|
||||
tsdbStopAllCompTask(pTsdb);
|
||||
|
@ -934,9 +935,6 @@ int32_t tsdbFSEditCommit(STFileSystem *fs) {
|
|||
// bool skipMerge = false;
|
||||
int32_t numFile = TARRAY2_SIZE(lvl->fobjArr);
|
||||
if (numFile >= sttTrigger && (!fset->mergeScheduled)) {
|
||||
code = tsdbTFileSetOpenChannel(fset);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
|
||||
SMergeArg *arg = taosMemoryMalloc(sizeof(*arg));
|
||||
if (arg == NULL) {
|
||||
code = terrno;
|
||||
|
@ -946,7 +944,7 @@ int32_t tsdbFSEditCommit(STFileSystem *fs) {
|
|||
arg->tsdb = fs->tsdb;
|
||||
arg->fid = fset->fid;
|
||||
|
||||
code = vnodeAsync(&fset->channel, EVA_PRIORITY_HIGH, tsdbMerge, taosAutoMemoryFree, arg, NULL);
|
||||
code = vnodeAsync(MERGE_TASK_ASYNC, EVA_PRIORITY_HIGH, tsdbMerge, taosAutoMemoryFree, arg, &fset->mergeTask);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
fset->mergeScheduled = true;
|
||||
}
|
||||
|
@ -1202,42 +1200,61 @@ _out:
|
|||
|
||||
void tsdbFSDestroyRefRangedSnapshot(TFileSetRangeArray **fsrArr) { tsdbTFileSetRangeArrayDestroy(fsrArr); }
|
||||
|
||||
void tsdbBeginTaskOnFileSet(STsdb *tsdb, int32_t fid, STFileSet **fset) {
|
||||
void tsdbBeginTaskOnFileSet(STsdb *tsdb, int32_t fid, EVATaskT task, STFileSet **fset) {
|
||||
// Here, sttTrigger is protected by tsdb->mutex, so it is safe to read it without lock
|
||||
int16_t sttTrigger = tsdb->pVnode->config.sttTrigger;
|
||||
|
||||
tsdbFSGetFSet(tsdb->pFS, fid, fset);
|
||||
if (sttTrigger == 1 && (*fset)) {
|
||||
for (;;) {
|
||||
if ((*fset)->taskRunning) {
|
||||
(*fset)->numWaitTask++;
|
||||
|
||||
(void)taosThreadCondWait(&(*fset)->beginTask, &tsdb->mutex);
|
||||
|
||||
tsdbFSGetFSet(tsdb->pFS, fid, fset);
|
||||
|
||||
(*fset)->numWaitTask--;
|
||||
} else {
|
||||
(*fset)->taskRunning = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
tsdbInfo("vgId:%d begin task on file set:%d", TD_VID(tsdb->pVnode), fid);
|
||||
if (*fset == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
struct STFileSetCond *cond = NULL;
|
||||
if (sttTrigger == 1 || task == EVA_TASK_COMMIT) {
|
||||
cond = &(*fset)->conds[0];
|
||||
} else {
|
||||
cond = &(*fset)->conds[1];
|
||||
}
|
||||
|
||||
while (1) {
|
||||
if (cond->running) {
|
||||
cond->numWait++;
|
||||
(void)taosThreadCondWait(&cond->cond, &tsdb->mutex);
|
||||
cond->numWait--;
|
||||
} else {
|
||||
cond->running = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
tsdbInfo("vgId:%d begin %s task on file set:%d", TD_VID(tsdb->pVnode), vnodeGetATaskName(task), fid);
|
||||
return;
|
||||
}
|
||||
|
||||
void tsdbFinishTaskOnFileSet(STsdb *tsdb, int32_t fid) {
|
||||
void tsdbFinishTaskOnFileSet(STsdb *tsdb, int32_t fid, EVATaskT task) {
|
||||
// Here, sttTrigger is protected by tsdb->mutex, so it is safe to read it without lock
|
||||
int16_t sttTrigger = tsdb->pVnode->config.sttTrigger;
|
||||
if (sttTrigger == 1) {
|
||||
STFileSet *fset = NULL;
|
||||
tsdbFSGetFSet(tsdb->pFS, fid, &fset);
|
||||
if (fset != NULL && fset->taskRunning) {
|
||||
fset->taskRunning = false;
|
||||
if (fset->numWaitTask > 0) {
|
||||
(void)taosThreadCondSignal(&fset->beginTask);
|
||||
}
|
||||
tsdbInfo("vgId:%d finish task on file set:%d", TD_VID(tsdb->pVnode), fid);
|
||||
}
|
||||
|
||||
STFileSet *fset = NULL;
|
||||
tsdbFSGetFSet(tsdb->pFS, fid, &fset);
|
||||
if (fset == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
struct STFileSetCond *cond = NULL;
|
||||
if (sttTrigger == 1 || task == EVA_TASK_COMMIT) {
|
||||
cond = &fset->conds[0];
|
||||
} else {
|
||||
cond = &fset->conds[1];
|
||||
}
|
||||
|
||||
cond->running = false;
|
||||
if (cond->numWait > 0) {
|
||||
(void)taosThreadCondSignal(&cond->cond);
|
||||
}
|
||||
|
||||
tsdbInfo("vgId:%d finish %s task on file set:%d", TD_VID(tsdb->pVnode), vnodeGetATaskName(task), fid);
|
||||
return;
|
||||
}
|
||||
|
||||
struct SFileSetReader {
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
*/
|
||||
|
||||
#include "tsdbFSet2.h"
|
||||
#include "vnd.h"
|
||||
|
||||
#ifndef _TSDB_FILE_SYSTEM_H
|
||||
#define _TSDB_FILE_SYSTEM_H
|
||||
|
@ -61,8 +62,8 @@ int32_t tsdbFSEditAbort(STFileSystem *fs);
|
|||
// other
|
||||
void tsdbFSGetFSet(STFileSystem *fs, int32_t fid, STFileSet **fset);
|
||||
void tsdbFSCheckCommit(STsdb *tsdb, int32_t fid);
|
||||
void tsdbBeginTaskOnFileSet(STsdb *tsdb, int32_t fid, STFileSet **fset);
|
||||
void tsdbFinishTaskOnFileSet(STsdb *tsdb, int32_t fid);
|
||||
void tsdbBeginTaskOnFileSet(STsdb *tsdb, int32_t fid, EVATaskT task, STFileSet **fset);
|
||||
void tsdbFinishTaskOnFileSet(STsdb *tsdb, int32_t fid, EVATaskT task);
|
||||
// utils
|
||||
int32_t save_fs(const TFileSetArray *arr, const char *fname);
|
||||
void current_fname(STsdb *pTsdb, char *fname, EFCurrentT ftype);
|
||||
|
|
|
@ -480,16 +480,18 @@ int32_t tsdbTFileSetInit(int32_t fid, STFileSet **fset) {
|
|||
fset[0]->maxVerValid = VERSION_MAX;
|
||||
TARRAY2_INIT(fset[0]->lvlArr);
|
||||
|
||||
// background task queue
|
||||
(void)taosThreadCondInit(&(*fset)->beginTask, NULL);
|
||||
(*fset)->taskRunning = false;
|
||||
(*fset)->numWaitTask = 0;
|
||||
|
||||
// block commit variables
|
||||
(void)taosThreadCondInit(&fset[0]->canCommit, NULL);
|
||||
(*fset)->numWaitCommit = 0;
|
||||
(*fset)->blockCommit = false;
|
||||
|
||||
for (int32_t i = 0; i < sizeof((*fset)->conds) / sizeof((*fset)->conds[0]); ++i) {
|
||||
struct STFileSetCond *cond = &(*fset)->conds[i];
|
||||
cond->running = false;
|
||||
cond->numWait = 0;
|
||||
(void)taosThreadCondInit(&cond->cond, NULL);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -648,8 +650,10 @@ void tsdbTFileSetClear(STFileSet **fset) {
|
|||
|
||||
TARRAY2_DESTROY((*fset)->lvlArr, tsdbSttLvlClear);
|
||||
|
||||
(void)taosThreadCondDestroy(&(*fset)->beginTask);
|
||||
(void)taosThreadCondDestroy(&(*fset)->canCommit);
|
||||
for (int32_t i = 0; i < sizeof((*fset)->conds) / sizeof((*fset)->conds[0]); ++i) {
|
||||
(void)taosThreadCondDestroy(&(*fset)->conds[i].cond);
|
||||
}
|
||||
taosMemoryFreeClear(*fset);
|
||||
}
|
||||
}
|
||||
|
@ -703,14 +707,3 @@ bool tsdbTFileSetIsEmpty(const STFileSet *fset) {
|
|||
}
|
||||
return TARRAY2_SIZE(fset->lvlArr) == 0;
|
||||
}
|
||||
|
||||
int32_t tsdbTFileSetOpenChannel(STFileSet *fset) {
|
||||
int32_t code;
|
||||
if (!fset->channelOpened) {
|
||||
if ((code = vnodeAChannelInit(2, &fset->channel))) {
|
||||
return code;
|
||||
}
|
||||
fset->channelOpened = true;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|