提交 86879b57 编写于 作者: B Benguang Zhao

Merge branch '2.6' into FIX/TS-1438

```c
{{#include docs-examples/c/line_example.c:main}}
```
\ No newline at end of file
```c
{{#include docs-examples/c/json_protocol_example.c:main}}
```
\ No newline at end of file
```c
{{#include docs-examples/c/telnet_line_example.c:main}}
```
\ No newline at end of file
```c
{{#include docs-examples/c/insert_example.c}}
```
\ No newline at end of file
```csharp
{{#include docs-examples/csharp/InfluxDBLineExample.cs}}
```
```csharp
{{#include docs-examples/csharp/OptsJsonExample.cs}}
```
```csharp
{{#include docs-examples/csharp/OptsTelnetExample.cs}}
```
```csharp
{{#include docs-examples/csharp/SQLInsertExample.cs}}
```
```csharp
{{#include docs-examples/csharp/StmtInsertExample.cs}}
```
```go
{{#include docs-examples/go/insert/line/main.go}}
```
```go
{{#include docs-examples/go/insert/json/main.go}}
```
```go
{{#include docs-examples/go/insert/telnet/main.go}}
```
```go
{{#include docs-examples/go/insert/sql/main.go}}
```
```js
{{#include docs-examples/node/nativeexample/influxdb_line_example.js}}
```
```js
{{#include docs-examples/node/nativeexample/opentsdb_json_example.js}}
```
```js
{{#include docs-examples/node/nativeexample/opentsdb_telnet_example.js}}
```
```js
{{#include docs-examples/node/nativeexample/insert_example.js}}
```
```php
{{#include docs-examples/php/insert.php}}
```
```php
{{#include docs-examples/php/insert_stmt.php}}
```
```py
{{#include docs-examples/python/line_protocol_example.py}}
```
```py
{{#include docs-examples/python/json_protocol_example.py}}
```
```py
{{#include docs-examples/python/telnet_line_protocol_example.py}}
```
```py
{{#include docs-examples/python/native_insert_example.py}}
```
```rust
{{#include docs-examples/rust/restexample/examples/insert_example.rs}}
```
```rust
{{#include docs-examples/rust/nativeexample/examples/stmt_example.rs}}
```
```c
{{#include docs-examples/c/query_example.c}}
```
\ No newline at end of file
```c
{{#include docs-examples/c/async_query_example.c:demo}}
```
\ No newline at end of file
```csharp
{{#include docs-examples/csharp/QueryExample.cs}}
```
```csharp
{{#include docs-examples/csharp/AsyncQueryExample.cs}}
```
```go
{{#include docs-examples/go/query/sync/main.go}}
```
```go
{{#include docs-examples/go/query/async/main.go}}
```
```js
{{#include docs-examples/node/nativeexample/query_example.js}}
```
```js
{{#include docs-examples/node/nativeexample/async_query_example.js}}
```
```go
{{#include docs-examples/php/query.php}}
```
```rust
{{#include docs-examples/rust/restexample/examples/query_example.rs}}
```
```c
{{#include docs-examples/c/subscribe_demo.c}}
```
\ No newline at end of file
```csharp
{{#include docs-examples/csharp/SubscribeDemo.cs}}
```
\ No newline at end of file
```go
{{#include docs-examples/go/sub/main.go}}
```
\ No newline at end of file
```js
{{#include docs-examples/node/nativeexample/subscribe_demo.js}}
```
\ No newline at end of file
```py
{{#include docs-examples/python/subscribe_demo.py}}
```
\ No newline at end of file
```rs
{{#include docs-examples/rust/nativeexample/examples/subscribe_demo.rs}}
```
\ No newline at end of file
label: 参数限制与保留关键字
\ No newline at end of file
```c
{{#include docs-examples/c/line_example.c:main}}
```
\ No newline at end of file
```c
{{#include docs-examples/c/json_protocol_example.c:main}}
```
\ No newline at end of file
```c
{{#include docs-examples/c/telnet_line_example.c:main}}
```
\ No newline at end of file
```c
{{#include docs-examples/c/insert_example.c}}
```
\ No newline at end of file
```csharp
{{#include docs-examples/csharp/InfluxDBLineExample.cs}}
```
```csharp
{{#include docs-examples/csharp/OptsJsonExample.cs}}
```
```csharp
{{#include docs-examples/csharp/OptsTelnetExample.cs}}
```
```csharp
{{#include docs-examples/csharp/SQLInsertExample.cs}}
```
```csharp
{{#include docs-examples/csharp/StmtInsertExample.cs}}
```
```go
{{#include docs-examples/go/insert/line/main.go}}
```
```go
{{#include docs-examples/go/insert/json/main.go}}
```
```go
{{#include docs-examples/go/insert/telnet/main.go}}
```
```go
{{#include docs-examples/go/insert/sql/main.go}}
```
```js
{{#include docs-examples/node/nativeexample/influxdb_line_example.js}}
```
```js
{{#include docs-examples/node/nativeexample/opentsdb_json_example.js}}
```
```js
{{#include docs-examples/node/nativeexample/opentsdb_telnet_example.js}}
```
```js
{{#include docs-examples/node/nativeexample/insert_example.js}}
```
```py
{{#include docs-examples/python/line_protocol_example.py}}
```
```py
{{#include docs-examples/python/json_protocol_example.py}}
```
```py
{{#include docs-examples/python/telnet_line_protocol_example.py}}
```
```py
{{#include docs-examples/python/native_insert_example.py}}
```
```rust
{{#include docs-examples/rust/restexample/examples/insert_example.rs}}
```
```rust
{{#include docs-examples/rust/nativeexample/examples/stmt_example.rs}}
```
```c
{{#include docs-examples/c/query_example.c}}
```
\ No newline at end of file
```c
{{#include docs-examples/c/async_query_example.c:demo}}
```
\ No newline at end of file
```csharp
{{#include docs-examples/csharp/QueryExample.cs}}
```
```csharp
{{#include docs-examples/csharp/AsyncQueryExample.cs}}
```
```go
{{#include docs-examples/go/query/sync/main.go}}
```
```go
{{#include docs-examples/go/query/async/main.go}}
```
```js
{{#include docs-examples/node/nativeexample/query_example.js}}
```
```js
{{#include docs-examples/node/nativeexample/async_query_example.js}}
```
```rust
{{#include docs-examples/rust/restexample/examples/query_example.rs}}
```
```c
{{#include docs-examples/c/subscribe_demo.c}}
```
\ No newline at end of file
```csharp
{{#include docs-examples/csharp/SubscribeDemo.cs}}
```
\ No newline at end of file
```go
{{#include docs-examples/go/sub/main.go}}
```
\ No newline at end of file
```js
{{#include docs-examples/node/nativeexample/subscribe_demo.js}}
```
\ No newline at end of file
```py
{{#include docs-examples/python/subscribe_demo.py}}
```
\ No newline at end of file
```rs
{{#include docs-examples/rust/nativeexample/examples/subscribe_demo.rs}}
```
\ No newline at end of file
...@@ -110,4 +110,4 @@ As a high-performance, scalable and SQL supported time-series database, TDengine ...@@ -110,4 +110,4 @@ As a high-performance, scalable and SQL supported time-series database, TDengine
- [TDengine vs InfluxDB、OpenTSDB、Cassandra、MySQL、ClickHouse](https://www.tdengine.com/downloads/TDengine_Testing_Report_en.pdf) - [TDengine vs InfluxDB、OpenTSDB、Cassandra、MySQL、ClickHouse](https://www.tdengine.com/downloads/TDengine_Testing_Report_en.pdf)
- [TDengine vs OpenTSDB](https://tdengine.com/2019/09/12/710.html) - [TDengine vs OpenTSDB](https://tdengine.com/2019/09/12/710.html)
- [TDengine vs Cassandra](https://tdengine.com/2019/09/12/708.html) - [TDengine vs Cassandra](https://tdengine.com/2019/09/12/708.html)
- [TDengine vs InfluxDB](https://tdengine.com/2019/09/12/706.html) - [TDengine vs InfluxDB](https://tdengine.com/2019/09/12/706.html)
\ No newline at end of file
--- ---
title: Get Started title: Get Started
description: 'Install TDengine from Docker image, apt-get or package, and run TAOS CLI and taosBenchmark to experience the features' description: 'Install TDengine from Docker image, apt-get or package, and run TDengine CLI and taosBenchmark to experience the features'
--- ---
import Tabs from "@theme/Tabs"; import Tabs from "@theme/Tabs";
...@@ -120,7 +120,7 @@ select * from t; ...@@ -120,7 +120,7 @@ select * from t;
Query OK, 2 row(s) in set (0.003128s) Query OK, 2 row(s) in set (0.003128s)
``` ```
Besides executing SQL commands, system administrators can check running status, add/drop user accounts and manage the running instances. TAOS CLI with client driver can be installed and run on either Linux or Windows machines. For more details on CLI, please [check here](../reference/taos-shell/). Besides executing SQL commands, system administrators can check running status, add/drop user accounts and manage the running instances. TDengine CLI with client driver can be installed and run on either Linux or Windows machines. For more details on CLI, please [check here](../reference/taos-shell/).
## Experience the blazing fast speed ## Experience the blazing fast speed
......
```c title="Native Connection" ```c title="Native Connection"
{{#include docs-examples/c/connect_example.c}} {{#include docs/examples/c/connect_example.c}}
``` ```
```csharp title="Native Connection" ```csharp title="Native Connection"
{{#include docs-examples/csharp/ConnectExample.cs}} {{#include docs/examples/csharp/ConnectExample.cs}}
``` ```
:::info :::info
......
#### Unified Database Access Interface #### Unified Database Access Interface
```go title="Native Connection" ```go title="Native Connection"
{{#include docs-examples/go/connect/cgoexample/main.go}} {{#include docs/examples/go/connect/cgoexample/main.go}}
``` ```
```go title="REST Connection" ```go title="REST Connection"
{{#include docs-examples/go/connect/restexample/main.go}} {{#include docs/examples/go/connect/restexample/main.go}}
``` ```
#### Advanced Features #### Advanced Features
...@@ -13,5 +13,5 @@ ...@@ -13,5 +13,5 @@
The af package of driver-go can also be used to establish connection, with this way some advanced features of TDengine, like parameter binding and subscription, can be used. The af package of driver-go can also be used to establish connection, with this way some advanced features of TDengine, like parameter binding and subscription, can be used.
```go title="Establish native connection using af package" ```go title="Establish native connection using af package"
{{#include docs-examples/go/connect/afconn/main.go}} {{#include docs/examples/go/connect/afconn/main.go}}
``` ```
```java title="Native Connection" ```java title="Native Connection"
{{#include docs-examples/java/src/main/java/com/taos/example/JNIConnectExample.java}} {{#include docs/examples/java/src/main/java/com/taos/example/JNIConnectExample.java}}
``` ```
```java title="REST Connection" ```java title="REST Connection"
{{#include docs-examples/java/src/main/java/com/taos/example/RESTConnectExample.java:main}} {{#include docs/examples/java/src/main/java/com/taos/example/RESTConnectExample.java:main}}
``` ```
When using REST connection, the feature of bulk pulling can be enabled if the size of resulting data set is huge. When using REST connection, the feature of bulk pulling can be enabled if the size of resulting data set is huge.
```java title="Enable Bulk Pulling" {4} ```java title="Enable Bulk Pulling" {4}
{{#include docs-examples/java/src/main/java/com/taos/example/WSConnectExample.java:main}} {{#include docs/examples/java/src/main/java/com/taos/example/WSConnectExample.java:main}}
``` ```
More configuration about connection,please refer to [Java Connector](/reference/connector/java) More configuration about connection,please refer to [Java Connector](/reference/connector/java)
```js title="Native Connection" ```js title="Native Connection"
{{#include docs-examples/node/nativeexample/connect.js}} {{#include docs/examples/node/nativeexample/connect.js}}
``` ```
```js title="REST Connection" ```js title="REST Connection"
{{#include docs-examples/node/restexample/connect.js}} {{#include docs/examples/node/restexample/connect.js}}
``` ```
```python title="Native Connection" ```python title="Native Connection"
{{#include docs-examples/python/connect_example.py}} {{#include docs/examples/python/connect_example.py}}
``` ```
```r title="Native Connection" ```r title="Native Connection"
{{#include docs-examples/R/connect_native.r:demo}} {{#include docs/examples/R/connect_native.r:demo}}
``` ```
```rust title="Native Connection/REST Connection" ```rust title="Native Connection/REST Connection"
{{#include docs-examples/rust/nativeexample/examples/connect.rs}} {{#include docs/examples/rust/nativeexample/examples/connect.rs}}
``` ```
:::note :::note
......
...@@ -37,7 +37,7 @@ USE power; ...@@ -37,7 +37,7 @@ USE power;
## Create STable ## Create STable
In a time-series application, there may be multiple kinds of data collection points. For example, in the electrical power system there are meters, transformers, bus bars, switches, etc. For easy and efficient aggregation of multiple tables, one STable needs to be created for each kind of data collection point. For example, for the meters in [table 1](/tdinternal/arch#model_table1), the SQL statement below can be used to create the super table. In a time-series application, there may be multiple kinds of data collection points. For example, in the electrical power system there are meters, transformers, bus bars, switches, etc. For easy and efficient aggregation of multiple tables, one STable needs to be created for each kind of data collection point. For example, for the meters in [table 1](/concept/#model_table1), the SQL statement below can be used to create the super table.
```sql ```sql
CREATE STable meters (ts timestamp, current float, voltage int, phase float) TAGS (location binary(64), groupId int); CREATE STable meters (ts timestamp, current float, voltage int, phase float) TAGS (location binary(64), groupId int);
......
...@@ -22,7 +22,7 @@ import CStmt from "./_c_stmt.mdx"; ...@@ -22,7 +22,7 @@ import CStmt from "./_c_stmt.mdx";
## Introduction ## Introduction
Application programs can execute `INSERT` statement through connectors to insert rows. The TAOS CLI can also be used to manually insert data. Application programs can execute `INSERT` statement through connectors to insert rows. The TDengine CLI can also be used to manually insert data.
### Insert Single Row ### Insert Single Row
......
```c
{{#include docs/examples/c/line_example.c:main}}
```
\ No newline at end of file
```c
{{#include docs/examples/c/json_protocol_example.c:main}}
```
\ No newline at end of file
```c
{{#include docs/examples/c/telnet_line_example.c:main}}
```
\ No newline at end of file
```c
{{#include docs/examples/c/insert_example.c}}
```
\ No newline at end of file
```c title=Single Row Binding ```c title=Single Row Binding
{{#include docs-examples/c/stmt_example.c}} {{#include docs/examples/c/stmt_example.c}}
``` ```
```c title=Multiple Row Binding 72:117 ```c title=Multiple Row Binding 72:117
{{#include docs-examples/c/multi_bind_example.c}} {{#include docs/examples/c/multi_bind_example.c}}
``` ```
\ No newline at end of file
```csharp
{{#include docs/examples/csharp/InfluxDBLineExample.cs}}
```
```csharp
{{#include docs/examples/csharp/OptsJsonExample.cs}}
```
```csharp
{{#include docs/examples/csharp/OptsTelnetExample.cs}}
```
```csharp
{{#include docs/examples/csharp/SQLInsertExample.cs}}
```
```csharp
{{#include docs/examples/csharp/StmtInsertExample.cs}}
```
```go
{{#include docs/examples/go/insert/line/main.go}}
```
```go
{{#include docs/examples/go/insert/json/main.go}}
```
```go
{{#include docs/examples/go/insert/telnet/main.go}}
```
```go
{{#include docs/examples/go/insert/sql/main.go}}
```
```go ```go
{{#include docs-examples/go/insert/stmt/main.go}} {{#include docs/examples/go/insert/stmt/main.go}}
``` ```
:::tip :::tip
......
```java ```java
{{#include docs-examples/java/src/main/java/com/taos/example/LineProtocolExample.java}} {{#include docs/examples/java/src/main/java/com/taos/example/LineProtocolExample.java}}
``` ```
```java ```java
{{#include docs-examples/java/src/main/java/com/taos/example/JSONProtocolExample.java}} {{#include docs/examples/java/src/main/java/com/taos/example/JSONProtocolExample.java}}
``` ```
```java ```java
{{#include docs-examples/java/src/main/java/com/taos/example/TelnetLineProtocolExample.java}} {{#include docs/examples/java/src/main/java/com/taos/example/TelnetLineProtocolExample.java}}
``` ```
```java ```java
{{#include docs-examples/java/src/main/java/com/taos/example/RestInsertExample.java:insert}} {{#include docs/examples/java/src/main/java/com/taos/example/RestInsertExample.java:insert}}
``` ```
\ No newline at end of file
```java ```java
{{#include docs-examples/java/src/main/java/com/taos/example/StmtInsertExample.java}} {{#include docs/examples/java/src/main/java/com/taos/example/StmtInsertExample.java}}
``` ```
```js
{{#include docs/examples/node/nativeexample/influxdb_line_example.js}}
```
```js
{{#include docs/examples/node/nativeexample/opentsdb_json_example.js}}
```
```js
{{#include docs/examples/node/nativeexample/opentsdb_telnet_example.js}}
```
```js
{{#include docs/examples/node/nativeexample/insert_example.js}}
```
```js title=Single Row Binding ```js title=Single Row Binding
{{#include docs-examples/node/nativeexample/param_bind_example.js}} {{#include docs/examples/node/nativeexample/param_bind_example.js}}
``` ```
```js title=Multiple Row Binding ```js title=Multiple Row Binding
{{#include docs-examples/node/nativeexample/multi_bind_example.js:insertData}} {{#include docs/examples/node/nativeexample/multi_bind_example.js:insertData}}
``` ```
:::info :::info
......
```py
{{#include docs/examples/python/line_protocol_example.py}}
```
```py
{{#include docs/examples/python/json_protocol_example.py}}
```
```py
{{#include docs/examples/python/telnet_line_protocol_example.py}}
```
```py
{{#include docs/examples/python/native_insert_example.py}}
```
```py title=Single Row Binding ```py title=Single Row Binding
{{#include docs-examples/python/bind_param_example.py}} {{#include docs/examples/python/bind_param_example.py}}
``` ```
```py title=Multiple Row Binding ```py title=Multiple Row Binding
{{#include docs-examples/python/multi_bind_example.py:bind_batch}} {{#include docs/examples/python/multi_bind_example.py:bind_batch}}
``` ```
:::info :::info
......
```rust ```rust
{{#include docs-examples/rust/schemalessexample/examples/influxdb_line_example.rs}} {{#include docs/examples/rust/schemalessexample/examples/influxdb_line_example.rs}}
``` ```
```rust ```rust
{{#include docs-examples/rust/schemalessexample/examples/opentsdb_json_example.rs}} {{#include docs/examples/rust/schemalessexample/examples/opentsdb_json_example.rs}}
``` ```
```rust ```rust
{{#include docs-examples/rust/schemalessexample/examples/opentsdb_telnet_example.rs}} {{#include docs/examples/rust/schemalessexample/examples/opentsdb_telnet_example.rs}}
``` ```
```rust
{{#include docs/examples/rust/restexample/examples/insert_example.rs}}
```
```rust
{{#include docs/examples/rust/nativeexample/examples/stmt_example.rs}}
```
```c
{{#include docs/examples/c/query_example.c}}
```
\ No newline at end of file
```c
{{#include docs/examples/c/async_query_example.c:demo}}
```
\ No newline at end of file
```csharp
{{#include docs/examples/csharp/QueryExample.cs}}
```
```csharp
{{#include docs/examples/csharp/AsyncQueryExample.cs}}
```
```go
{{#include docs/examples/go/query/sync/main.go}}
```
```go
{{#include docs/examples/go/query/async/main.go}}
```
```java ```java
{{#include docs-examples/java/src/main/java/com/taos/example/RestQueryExample.java}} {{#include docs/examples/java/src/main/java/com/taos/example/RestQueryExample.java}}
``` ```
```js
{{#include docs/examples/node/nativeexample/query_example.js}}
```
```js
{{#include docs/examples/node/nativeexample/async_query_example.js}}
```
Result set is iterated row by row. Result set is iterated row by row.
```py ```py
{{#include docs-examples/python/query_example.py:iter}} {{#include docs/examples/python/query_example.py:iter}}
``` ```
Result set is retrieved as a whole, each row is converted to a dict and returned. Result set is retrieved as a whole, each row is converted to a dict and returned.
```py ```py
{{#include docs-examples/python/query_example.py:fetch_all}} {{#include docs/examples/python/query_example.py:fetch_all}}
``` ```
\ No newline at end of file
```py ```py
{{#include docs-examples/python/async_query_example.py}} {{#include docs/examples/python/async_query_example.py}}
``` ```
:::note :::note
......
```rust
{{#include docs/examples/rust/restexample/examples/query_example.rs}}
```
```c
{{#include docs/examples/c/subscribe_demo.c}}
```
\ No newline at end of file
```csharp
{{#include docs/examples/csharp/SubscribeDemo.cs}}
```
\ No newline at end of file
```go
{{#include docs/examples/go/sub/main.go}}
```
\ No newline at end of file
```java ```java
{{#include docs-examples/java/src/main/java/com/taos/example/SubscribeDemo.java}} {{#include docs/examples/java/src/main/java/com/taos/example/SubscribeDemo.java}}
``` ```
:::note :::note
For now Java connector doesn't provide asynchronous subscription, but `TimerTask` can be used to achieve similar purpose. For now Java connector doesn't provide asynchronous subscription, but `TimerTask` can be used to achieve similar purpose.
......
```js
{{#include docs/examples/node/nativeexample/subscribe_demo.js}}
```
\ No newline at end of file
```py
{{#include docs/examples/python/subscribe_demo.py}}
```
\ No newline at end of file
```rs
{{#include docs/examples/rust/nativeexample/examples/subscribe_demo.rs}}
```
\ No newline at end of file
...@@ -4,50 +4,275 @@ title: Keywords ...@@ -4,50 +4,275 @@ title: Keywords
There are about 200 keywords reserved by TDengine, they can't be used as the name of database, STable or table with either upper case, lower case or mixed case. There are about 200 keywords reserved by TDengine, they can't be used as the name of database, STable or table with either upper case, lower case or mixed case.
**Keywords List** ## Keyword List
| | | | | | ### A
| ----------- | ---------- | --------- | ---------- | ------------ |
| ABORT | CREATE | IGNORE | NULL | STAR | - ABORT
| ACCOUNT | CTIME | IMMEDIATE | OF | STATE | - ACCOUNT
| ACCOUNTS | DATABASE | IMPORT | OFFSET | STATEMENT | - ACCOUNTS
| ADD | DATABASES | IN | OR | STATE_WINDOW | - ADD
| AFTER | DAYS | INITIALLY | ORDER | STORAGE | - AFTER
| ALL | DBS | INSERT | PARTITIONS | STREAM | - ALL
| ALTER | DEFERRED | INSTEAD | PASS | STREAMS | - ALTER
| AND | DELIMITERS | INT | PLUS | STRING | - AND
| AS | DESC | INTEGER | PPS | SYNCDB | - AS
| ASC | DESCRIBE | INTERVAL | PRECISION | TABLE | - ASC
| ATTACH | DETACH | INTO | PREV | TABLES | - ATTACH
| BEFORE | DISTINCT | IS | PRIVILEGE | TAG |
| BEGIN | DIVIDE | ISNULL | QTIME | TAGS | ### B
| BETWEEN | DNODE | JOIN | QUERIES | TBNAME |
| BIGINT | DNODES | KEEP | QUERY | TIMES | - BEFORE
| BINARY | DOT | KEY | QUORUM | TIMESTAMP | - BEGIN
| BITAND | DOUBLE | KILL | RAISE | TINYINT | - BETWEEN
| BITNOT | DROP | LE | REM | TOPIC | - BIGINT
| BITOR | EACH | LIKE | REPLACE | TOPICS | - BINARY
| BLOCKS | END | LIMIT | REPLICA | TRIGGER | - BITAND
| BOOL | EQ | LINEAR | RESET | TSERIES | - BITNOT
| BY | EXISTS | LOCAL | RESTRICT | UMINUS | - BITOR
| CACHE | EXPLAIN | LP | ROW | UNION | - BLOCKS
| CACHELAST | FAIL | LSHIFT | RP | UNSIGNED | - BOOL
| CASCADE | FILE | LT | RSHIFT | UPDATE | - BY
| CHANGE | FILL | MATCH | SCORES | UPLUS |
| CLUSTER | FLOAT | MAXROWS | SELECT | USE | ### C
| COLON | FOR | MINROWS | SEMI | USER |
| COLUMN | FROM | MINUS | SESSION | USERS | - CACHE
| COMMA | FSYNC | MNODES | SET | USING | - CACHELAST
| COMP | GE | MODIFY | SHOW | VALUES | - CASCADE
| COMPACT | GLOB | MODULES | SLASH | VARIABLE | - CHANGE
| CONCAT | GRANTS | NCHAR | SLIDING | VARIABLES | - CLUSTER
| CONFLICT | GROUP | NE | SLIMIT | VGROUPS | - COLON
| CONNECTION | GT | NONE | SMALLINT | VIEW | - COLUMN
| CONNECTIONS | HAVING | NOT | SOFFSET | VNODES | - COMMA
| CONNS | ID | NOTNULL | STable | WAL | - COMP
| COPY | IF | NOW | STableS | WHERE | - COMPACT
| _C0 | _QSTART | _QSTOP | _QDURATION | _WSTART | - CONCAT
| _WSTOP | _WDURATION | - CONFLICT
- CONNECTION
- CONNECTIONS
- CONNS
- COPY
- CREATE
- CTIME
### D
- DATABASE
- DATABASES
- DAYS
- DBS
- DEFERRED
- DELIMITERS
- DELETE
- DESC
- DESCRIBE
- DETACH
- DISTINCT
- DIVIDE
- DNODE
- DNODES
- DOT
- DOUBLE
- DROP
### E
- END
- EQ
- EXISTS
- EXPLAIN
### F
- FAIL
- FILE
- FILL
- FLOAT
- FOR
- FROM
- FSYNC
### G
- GE
- GLOB
- GRANTS
- GROUP
- GT
### H
- HAVING
### I
- ID
- IF
- IGNORE
- IMMEDIA
- IMPORT
- IN
- INITIAL
- INSERT
- INSTEAD
- INT
- INTEGER
- INTERVA
- INTO
- IS
- ISNULL
### J
- JOIN
### K
- KEEP
- KEY
- KILL
### L
- LE
- LIKE
- LIMIT
- LINEAR
- LOCAL
- LP
- LSHIFT
- LT
### M
- MATCH
- MAXROWS
- MINROWS
- MINUS
- MNODES
- MODIFY
- MODULES
### N
- NE
- NONE
- NOT
- NOTNULL
- NOW
- NULL
### O
- OF
- OFFSET
- OR
- ORDER
### P
- PARTITION
- PASS
- PLUS
- PPS
- PRECISION
- PREV
- PRIVILEGE
### Q
- QTIME
- QUERIE
- QUERY
- QUORUM
### R
- RAISE
- REM
- REPLACE
- REPLICA
- RESET
- RESTRIC
- ROW
- RP
- RSHIFT
### S
- SCORES
- SELECT
- SEMI
- SESSION
- SET
- SHOW
- SLASH
- SLIDING
- SLIMIT
- SMALLIN
- SOFFSET
- STable
- STableS
- STAR
- STATE
- STATEMEN
- STATE_WI
- STORAGE
- STREAM
- STREAMS
- STRING
- SYNCDB
### T
- TABLE
- TABLES
- TAG
- TAGS
- TBNAME
- TIMES
- TIMESTAMP
- TINYINT
- TOPIC
- TOPICS
- TRIGGER
- TSERIES
### U
- UMINUS
- UNION
- UNSIGNED
- UPDATE
- UPLUS
- USE
- USER
- USERS
- USING
### V
- VALUES
- VARIABLE
- VARIABLES
- VGROUPS
- VIEW
- VNODES
### W
- WAL
- WHERE
### _
- _C0
- _QSTART
- _QSTOP
- _QDURATION
- _WSTART
- _WSTOP
- _WDURATION
## Explanations ## Explanations
### TBNAME ### TBNAME
...@@ -56,6 +281,7 @@ There are about 200 keywords reserved by TDengine, they can't be used as the nam ...@@ -56,6 +281,7 @@ There are about 200 keywords reserved by TDengine, they can't be used as the nam
Get the table name and tag values of all subtables in a STable. Get the table name and tag values of all subtables in a STable.
```mysql ```mysql
SELECT TBNAME, location FROM meters; SELECT TBNAME, location FROM meters;
```
Count the number of subtables in a STable. Count the number of subtables in a STable.
```mysql ```mysql
...@@ -86,4 +312,4 @@ The start, stop and duration of a query time window (Since version 2.6.0.0). ...@@ -86,4 +312,4 @@ The start, stop and duration of a query time window (Since version 2.6.0.0).
The start, stop and duration of aggegate query by time window, like interval, session window, state window (Since version 2.6.0.0). The start, stop and duration of aggegate query by time window, like interval, session window, state window (Since version 2.6.0.0).
### _c0 ### _c0
The first column of a table or STable. The first column of a table or STable.
\ No newline at end of file
Go to the `C:\TDengine` directory from `cmd` and execute TDengine CLI program `taos.exe` directly to connect to the TDengine service and enter the TDengine CLI interface, for example, as follows: Go to the `C:\TDengine` directory from `cmd` and execute TDengine CLI program `taos.exe` directly to connect to the TDengine service and enter the TDengine CLI interface, for example, as follows:
```text ```text
C:\TDengine>taos C:\TDengine>taos
Welcome to the TDengine shell from Linux, Client Version:2.0.5.0 Welcome to the TDengine shell from Linux, Client Version:2.0.5.0
Copyright (c) 2017 by TAOS Data, Inc. All rights reserved. Copyright (c) 2017 by TAOS Data, Inc. All rights reserved.
taos> show databases; taos> show databases;
name | created_time | ntables | vgroups | replica | quorum | days | keep1,keep2,keep(D) | cache(MB) | blocks | minrows | maxrows | wallevel | fsync | comp | precision | status | name | created_time | ntables | vgroups | replica | quorum | days | keep1,keep2,keep(D) | cache(MB) | blocks | minrows | maxrows | wallevel | fsync | comp | precision | status |
=================================================================================================================================================================================================================================================================== ===================================================================================================================================================================================================================================================================
test | 2020-10-14 10:35:48.617 | 10 | 1 | 1 | 1 | 2 | 3650,3650,3650 | 16 | 6 | 100 | 4096 | 1 | 3000 | 2 | ms | ready | test | 2020-10-14 10:35:48.617 | 10 | 1 | 1 | 1 | 2 | 3650,3650,3650 | 16 | 6 | 100 | 4096 | 1 | 3000 | 2 | ms | ready |
log | 2020-10-12 09:08:21.651 | 4 | 1 | 1 | 1 | 10 | 30,30,30 | 1 | 3 | 100 | 4096 | 1 | 3000 | 2 | us | ready | log | 2020-10-12 09:08:21.651 | 4 | 1 | 1 | 1 | 10 | 30,30,30 | 1 | 3 | 100 | 4096 | 1 | 3000 | 2 | us | ready |
Query OK, 2 row(s) in set (0.045000s) Query OK, 2 row(s) in set (0.045000s)
taos> taos>
``` ```
...@@ -91,7 +91,7 @@ In this section a few sample programs which use TDengine PHP connector to access ...@@ -91,7 +91,7 @@ In this section a few sample programs which use TDengine PHP connector to access
<summary>Establish Connection</summary> <summary>Establish Connection</summary>
```c ```c
{{#include docs-examples/php/connect.php}} {{#include docs/examples/php/connect.php}}
``` ```
</details> </details>
...@@ -102,7 +102,7 @@ In this section a few sample programs which use TDengine PHP connector to access ...@@ -102,7 +102,7 @@ In this section a few sample programs which use TDengine PHP connector to access
<summary>Insert Data</summary> <summary>Insert Data</summary>
```c ```c
{{#include docs-examples/php/insert.php}} {{#include docs/examples/php/insert.php}}
``` ```
</details> </details>
...@@ -113,7 +113,7 @@ In this section a few sample programs which use TDengine PHP connector to access ...@@ -113,7 +113,7 @@ In this section a few sample programs which use TDengine PHP connector to access
<summary>Synchronous Query</summary> <summary>Synchronous Query</summary>
```c ```c
{{#include docs-examples/php/query.php}} {{#include docs/examples/php/query.php}}
``` ```
</details> </details>
...@@ -124,7 +124,7 @@ In this section a few sample programs which use TDengine PHP connector to access ...@@ -124,7 +124,7 @@ In this section a few sample programs which use TDengine PHP connector to access
<summary>Parameter Binding</summary> <summary>Parameter Binding</summary>
```c ```c
{{#include docs-examples/php/insert_stmt.php}} {{#include docs/examples/php/insert_stmt.php}}
``` ```
</details> </details>
......
...@@ -169,7 +169,7 @@ The following example code assumes that TDengine is installed locally and that t ...@@ -169,7 +169,7 @@ The following example code assumes that TDengine is installed locally and that t
<TabItem value="native" label="native connection" groupId="connect"> <TabItem value="native" label="native connection" groupId="connect">
```python ```python
{{#include docs-examples/python/connect_native_reference.py}} {{#include docs/examples/python/connect_native_reference.py}}
``` ```
All arguments of the `connect()` function are optional keyword arguments. The following are the connection parameters specified. All arguments of the `connect()` function are optional keyword arguments. The following are the connection parameters specified.
...@@ -194,7 +194,7 @@ The `connect()` function returns a `taos.TaosConnection` instance. In client-sid ...@@ -194,7 +194,7 @@ The `connect()` function returns a `taos.TaosConnection` instance. In client-sid
<TabItem value="rest" label="REST connection"> <TabItem value="rest" label="REST connection">
```python ```python
{{#include docs-examples/python/connect_rest_examples.py:connect}} {{#include docs/examples/python/connect_rest_examples.py:connect}}
``` ```
All arguments to the `connect()` function are optional keyword arguments. The following are the connection parameters specified. All arguments to the `connect()` function are optional keyword arguments. The following are the connection parameters specified.
...@@ -219,11 +219,11 @@ All arguments to the `connect()` function are optional keyword arguments. The fo ...@@ -219,11 +219,11 @@ All arguments to the `connect()` function are optional keyword arguments. The fo
The `TaosConnection` class contains both an implementation of the PEP249 Connection interface (e.g., the `cursor()` method and the `close()` method) and many extensions (e.g., the `execute()`, `query()`, `schemaless_insert()`, and `subscribe()` methods). The `TaosConnection` class contains both an implementation of the PEP249 Connection interface (e.g., the `cursor()` method and the `close()` method) and many extensions (e.g., the `execute()`, `query()`, `schemaless_insert()`, and `subscribe()` methods).
```python title="execute method" ```python title="execute method"
{{#include docs-examples/python/connection_usage_native_reference.py:insert}} {{#include docs/examples/python/connection_usage_native_reference.py:insert}}
``` ```
```python title="query method" ```python title="query method"
{{#include docs-examples/python/connection_usage_native_reference.py:query}} {{#include docs/examples/python/connection_usage_native_reference.py:query}}
``` ```
:::tip :::tip
...@@ -235,14 +235,14 @@ The queried results can only be fetched once. For example, only one of `fetch_al ...@@ -235,14 +235,14 @@ The queried results can only be fetched once. For example, only one of `fetch_al
In the above example of using the `TaosConnection` class, we have shown two ways to get the result of a query: `fetch_all()` and `fetch_all_into_dict()`. In addition, `TaosResult` also provides methods to iterate through the result set by rows (`rows_iter`) or by data blocks (`blocks_iter`). Using these two methods will be more efficient in scenarios where the query has a large amount of data. In the above example of using the `TaosConnection` class, we have shown two ways to get the result of a query: `fetch_all()` and `fetch_all_into_dict()`. In addition, `TaosResult` also provides methods to iterate through the result set by rows (`rows_iter`) or by data blocks (`blocks_iter`). Using these two methods will be more efficient in scenarios where the query has a large amount of data.
```python title="blocks_iter method" ```python title="blocks_iter method"
{{#include docs-examples/python/result_set_examples.py}} {{#include docs/examples/python/result_set_examples.py}}
``` ```
##### Use of the TaosCursor class ##### Use of the TaosCursor class
The `TaosConnection` class and the `TaosResult` class already implement all the functionality of the native interface. If you are familiar with the interfaces in the PEP249 specification, you can also use the methods provided by the `TaosCursor` class. The `TaosConnection` class and the `TaosResult` class already implement all the functionality of the native interface. If you are familiar with the interfaces in the PEP249 specification, you can also use the methods provided by the `TaosCursor` class.
```python title="Use of TaosCursor" ```python title="Use of TaosCursor"
{{#include docs-examples/python/cursor_usage_native_reference.py}} {{#include docs/examples/python/cursor_usage_native_reference.py}}
``` ```
:::note :::note
...@@ -258,7 +258,7 @@ The TaosCursor class uses native connections for write and query operations. In ...@@ -258,7 +258,7 @@ The TaosCursor class uses native connections for write and query operations. In
The ``TaosRestCursor`` class is an implementation of the PEP249 Cursor interface. The ``TaosRestCursor`` class is an implementation of the PEP249 Cursor interface.
```python title="Use of TaosRestCursor" ```python title="Use of TaosRestCursor"
{{#include docs-examples/python/connect_rest_examples.py:basic}} {{#include docs/examples/python/connect_rest_examples.py:basic}}
``` ```
- `cursor.execute` : Used to execute arbitrary SQL statements. - `cursor.execute` : Used to execute arbitrary SQL statements.
- `cursor.rowcount` : For write operations, returns the number of successful rows written. For query operations, returns the number of rows in the result set. - `cursor.rowcount` : For write operations, returns the number of successful rows written. For query operations, returns the number of rows in the result set.
...@@ -269,7 +269,7 @@ The ``TaosRestCursor`` class is an implementation of the PEP249 Cursor interface ...@@ -269,7 +269,7 @@ The ``TaosRestCursor`` class is an implementation of the PEP249 Cursor interface
The `RestClient` class is a direct wrapper for the [REST API](/reference/rest-api). It contains only a `sql()` method for executing arbitrary SQL statements and returning the result. The `RestClient` class is a direct wrapper for the [REST API](/reference/rest-api). It contains only a `sql()` method for executing arbitrary SQL statements and returning the result.
```python title="Use of RestClient" ```python title="Use of RestClient"
{{#include docs-examples/python/rest_client_example.py}} {{#include docs/examples/python/rest_client_example.py}}
``` ```
For a more detailed description of the `sql()` method, please refer to [RestClient](https://docs.taosdata.com/api/taospy/taosrest/restclient.html). For a more detailed description of the `sql()` method, please refer to [RestClient](https://docs.taosdata.com/api/taospy/taosrest/restclient.html).
...@@ -283,14 +283,14 @@ For a more detailed description of the `sql()` method, please refer to [RestClie ...@@ -283,14 +283,14 @@ For a more detailed description of the `sql()` method, please refer to [RestClie
<TabItem value="native" label="native connection"> <TabItem value="native" label="native connection">
```python ```python
{{#include docs-examples/python/conn_native_pandas.py}} {{#include docs/examples/python/conn_native_pandas.py}}
``` ```
</TabItem> </TabItem>
<TabItem value="rest" label="REST connection"> <TabItem value="rest" label="REST connection">
```python ```python
{{#include docs-examples/python/conn_rest_pandas.py}} {{#include docs/examples/python/conn_rest_pandas.py}}
``` ```
</TabItem> </TabItem>
...@@ -314,7 +314,7 @@ For a more detailed description of the `sql()` method, please refer to [RestClie ...@@ -314,7 +314,7 @@ For a more detailed description of the `sql()` method, please refer to [RestClie
All errors from database operations are thrown directly as exceptions and the error message from the database is passed up the exception stack. The application is responsible for exception handling. For example: All errors from database operations are thrown directly as exceptions and the error message from the database is passed up the exception stack. The application is responsible for exception handling. For example:
```python ```python
{{#include docs-examples/python/handle_exception.py}} {{#include docs/examples/python/handle_exception.py}}
``` ```
### About nanoseconds ### About nanoseconds
......
...@@ -40,6 +40,16 @@ export TDENGINE_API=http://tdengine.local:6041 ...@@ -40,6 +40,16 @@ export TDENGINE_API=http://tdengine.local:6041
# user + password # user + password
export TDENGINE_USER=user export TDENGINE_USER=user
export TDENGINE_PASSWORD=password export TDENGINE_PASSWORD=password
# Other useful variables
# - If to install TDengine data source, default is true
export TDENGINE_DS_ENABLED=false
# - Data source name to be created, default is TDengine
export TDENGINE_DS_NAME=TDengine
# - Data source organization id, default is 1
export GF_ORG_ID=1
# - Data source is editable in admin ui or not, default is 0 (false)
export TDENGINE_EDITABLE=1
``` ```
Run `install.sh`: Run `install.sh`:
...@@ -48,7 +58,7 @@ Run `install.sh`: ...@@ -48,7 +58,7 @@ Run `install.sh`:
bash -c "$(curl -fsSL https://raw.githubusercontent.com/taosdata/grafanaplugin/master/install.sh)" bash -c "$(curl -fsSL https://raw.githubusercontent.com/taosdata/grafanaplugin/master/install.sh)"
``` ```
With this script, TDengine data source plugin and the Grafana data source will be installed and created automatically with Grafana provisioning configurations. With this script, TDengine data source plugin and the Grafana data source will be installed and created automatically with Grafana provisioning configurations. Save the script and type `./install.sh --help` for the full usage of the script.
And then, restart Grafana service and open Grafana in web-browser, usually <http://localhost:3000>. And then, restart Grafana service and open Grafana in web-browser, usually <http://localhost:3000>.
......
...@@ -108,7 +108,7 @@ Finally, click the "Create" button at bottom left corner saving the rule. ...@@ -108,7 +108,7 @@ Finally, click the "Create" button at bottom left corner saving the rule.
## Compose program to mock data ## Compose program to mock data
```javascript ```javascript
{{#include docs-examples/other/mock.js}} {{#include docs/examples/other/mock.js}}
``` ```
Note: `CLIENT_NUM` in the code can be set to a smaller value at the beginning of the test to avoid hardware performance be not capable to handle a more significant number of concurrent clients. Note: `CLIENT_NUM` in the code can be set to a smaller value at the beginning of the test to avoid hardware performance be not capable to handle a more significant number of concurrent clients.
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
title: 2.4 title: 2.4
--- ---
[2.4.0.26](https://github.com/taosdata/TDengine/releases/tag/ver-2.4.0.26)
[2.4.0.25](https://github.com/taosdata/TDengine/releases/tag/ver-2.4.0.25) [2.4.0.25](https://github.com/taosdata/TDengine/releases/tag/ver-2.4.0.25)
[2.4.0.24](https://github.com/taosdata/TDengine/releases/tag/ver-2.4.0.24) [2.4.0.24](https://github.com/taosdata/TDengine/releases/tag/ver-2.4.0.24)
...@@ -24,4 +26,4 @@ title: 2.4 ...@@ -24,4 +26,4 @@ title: 2.4
[2.4.0.4](https://github.com/taosdata/TDengine/releases/tag/ver-2.4.0.4) [2.4.0.4](https://github.com/taosdata/TDengine/releases/tag/ver-2.4.0.4)
[2.4.0.0](https://github.com/taosdata/TDengine/releases/tag/ver-2.4.0.0) [2.4.0.0](https://github.com/taosdata/TDengine/releases/tag/ver-2.4.0.0)
\ No newline at end of file
--- ---
title: 立即开始 title: 立即开始
description: ' Docker,安装包或使用 apt-get 快速安装 TDengine, 通过命令行程序TAOS CLI和工具 taosdemo 快速体验 TDengine 功能' description: ' Docker,安装包或使用 apt-get 快速安装 TDengine, 通过命令行程序TDengine CLI和工具 taosdemo 快速体验 TDengine 功能'
--- ---
import Tabs from "@theme/Tabs"; import Tabs from "@theme/Tabs";
...@@ -122,7 +122,7 @@ select * from t; ...@@ -122,7 +122,7 @@ select * from t;
Query OK, 2 row(s) in set (0.003128s) Query OK, 2 row(s) in set (0.003128s)
``` ```
除执行 SQL 语句外,系统管理员还可以从 TDengine CLI 进行检查系统运行状态、添加删除用户账号等操作。TAOS CLI 连同应用驱动也可以独立安装在 Linux 或 Windows 机器上运行,更多细节请参考 [这里](../reference/taos-shell/) 除执行 SQL 语句外,系统管理员还可以从 TDengine CLI 进行检查系统运行状态、添加删除用户账号等操作。TDengine CLI 连同应用驱动也可以独立安装在 Linux 或 Windows 机器上运行,更多细节请参考 [这里](../reference/taos-shell/)
## 使用 taosBenchmark 体验写入速度 ## 使用 taosBenchmark 体验写入速度
......
```c title="原生连接" ```c title="原生连接"
{{#include docs-examples/c/connect_example.c}} {{#include docs/examples/c/connect_example.c}}
``` ```
```csharp title="原生连接" ```csharp title="原生连接"
{{#include docs-examples/csharp/ConnectExample.cs}} {{#include docs/examples/csharp/ConnectExample.cs}}
``` ```
:::info :::info
......
#### 使用数据库访问统一接口 #### 使用数据库访问统一接口
```go title="原生连接" ```go title="原生连接"
{{#include docs-examples/go/connect/cgoexample/main.go}} {{#include docs/examples/go/connect/cgoexample/main.go}}
``` ```
```go title="REST 连接" ```go title="REST 连接"
{{#include docs-examples/go/connect/restexample/main.go}} {{#include docs/examples/go/connect/restexample/main.go}}
``` ```
#### 使用高级封装 #### 使用高级封装
...@@ -13,5 +13,5 @@ ...@@ -13,5 +13,5 @@
也可以使用 driver-go 的 af 包建立连接。这个模块封装了 TDengine 的高级功能, 如:参数绑定、订阅等。 也可以使用 driver-go 的 af 包建立连接。这个模块封装了 TDengine 的高级功能, 如:参数绑定、订阅等。
```go title="使用 af 包建立原生连接" ```go title="使用 af 包建立原生连接"
{{#include docs-examples/go/connect/afconn/main.go}} {{#include docs/examples/go/connect/afconn/main.go}}
``` ```
```java title="原生连接" ```java title="原生连接"
{{#include docs-examples/java/src/main/java/com/taos/example/JNIConnectExample.java}} {{#include docs/examples/java/src/main/java/com/taos/example/JNIConnectExample.java}}
``` ```
```java title="REST 连接" ```java title="REST 连接"
{{#include docs-examples/java/src/main/java/com/taos/example/RESTConnectExample.java:main}} {{#include docs/examples/java/src/main/java/com/taos/example/RESTConnectExample.java:main}}
``` ```
使用 REST 连接时,如果查询数据量比较大,还可开启批量拉取功能。 使用 REST 连接时,如果查询数据量比较大,还可开启批量拉取功能。
```java title="开启批量拉取功能" {4} ```java title="开启批量拉取功能" {4}
{{#include docs-examples/java/src/main/java/com/taos/example/WSConnectExample.java:main}} {{#include docs/examples/java/src/main/java/com/taos/example/WSConnectExample.java:main}}
``` ```
更多连接参数配置,参考[Java 连接器](/reference/connector/java) 更多连接参数配置,参考[Java 连接器](/reference/connector/java)
```js title="原生连接" ```js title="原生连接"
{{#include docs-examples/node/nativeexample/connect.js}} {{#include docs/examples/node/nativeexample/connect.js}}
``` ```
```js title="REST 连接" ```js title="REST 连接"
{{#include docs-examples/node/restexample/connect.js}} {{#include docs/examples/node/restexample/connect.js}}
``` ```
```php title="原生连接" ```php title="原生连接"
{{#include docs-examples/php/connect.php}} {{#include docs/examples/php/connect.php}}
``` ```
```python title="原生连接" ```python title="原生连接"
{{#include docs-examples/python/connect_example.py}} {{#include docs/examples/python/connect_example.py}}
``` ```
```r title="原生连接" ```r title="原生连接"
{{#include docs-examples/R/connect_native.r:demo}} {{#include docs/examples/R/connect_native.r:demo}}
``` ```
```rust title="原生连接/REST 连接" ```rust title="原生连接/REST 连接"
{{#include docs-examples/rust/nativeexample/examples/connect.rs}} {{#include docs/examples/rust/nativeexample/examples/connect.rs}}
``` ```
:::note :::note
......
```c
{{#include docs/examples/c/line_example.c:main}}
```
\ No newline at end of file
```c
{{#include docs/examples/c/json_protocol_example.c:main}}
```
\ No newline at end of file
```c
{{#include docs/examples/c/telnet_line_example.c:main}}
```
\ No newline at end of file
```c
{{#include docs/examples/c/insert_example.c}}
```
\ No newline at end of file
```c title=一次绑定一行 ```c title=一次绑定一行
{{#include docs-examples/c/stmt_example.c}} {{#include docs/examples/c/stmt_example.c}}
``` ```
```c title=一次绑定多行 72:117 ```c title=一次绑定多行 72:117
{{#include docs-examples/c/multi_bind_example.c}} {{#include docs/examples/c/multi_bind_example.c}}
``` ```
\ No newline at end of file
```csharp
{{#include docs/examples/csharp/InfluxDBLineExample.cs}}
```
```csharp
{{#include docs/examples/csharp/OptsJsonExample.cs}}
```
```csharp
{{#include docs/examples/csharp/OptsTelnetExample.cs}}
```
```csharp
{{#include docs/examples/csharp/SQLInsertExample.cs}}
```
```csharp
{{#include docs/examples/csharp/StmtInsertExample.cs}}
```
```go
{{#include docs/examples/go/insert/line/main.go}}
```
```go
{{#include docs/examples/go/insert/json/main.go}}
```
```go
{{#include docs/examples/go/insert/telnet/main.go}}
```
```go
{{#include docs/examples/go/insert/sql/main.go}}
```
```go ```go
{{#include docs-examples/go/insert/stmt/main.go}} {{#include docs/examples/go/insert/stmt/main.go}}
``` ```
:::tip :::tip
......
```java ```java
{{#include docs-examples/java/src/main/java/com/taos/example/LineProtocolExample.java}} {{#include docs/examples/java/src/main/java/com/taos/example/LineProtocolExample.java}}
``` ```
```java ```java
{{#include docs-examples/java/src/main/java/com/taos/example/JSONProtocolExample.java}} {{#include docs/examples/java/src/main/java/com/taos/example/JSONProtocolExample.java}}
``` ```
```java ```java
{{#include docs-examples/java/src/main/java/com/taos/example/TelnetLineProtocolExample.java}} {{#include docs/examples/java/src/main/java/com/taos/example/TelnetLineProtocolExample.java}}
``` ```
```java ```java
{{#include docs-examples/java/src/main/java/com/taos/example/RestInsertExample.java:insert}} {{#include docs/examples/java/src/main/java/com/taos/example/RestInsertExample.java:insert}}
``` ```
\ No newline at end of file
```java ```java
{{#include docs-examples/java/src/main/java/com/taos/example/StmtInsertExample.java}} {{#include docs/examples/java/src/main/java/com/taos/example/StmtInsertExample.java}}
``` ```
```js
{{#include docs/examples/node/nativeexample/influxdb_line_example.js}}
```
```js
{{#include docs/examples/node/nativeexample/opentsdb_json_example.js}}
```
```js
{{#include docs/examples/node/nativeexample/opentsdb_telnet_example.js}}
```
```js
{{#include docs/examples/node/nativeexample/insert_example.js}}
```
```js title=一次绑定一行 ```js title=一次绑定一行
{{#include docs-examples/node/nativeexample/param_bind_example.js}} {{#include docs/examples/node/nativeexample/param_bind_example.js}}
``` ```
```js title=一次绑定多行 ```js title=一次绑定多行
{{#include docs-examples/node/nativeexample/multi_bind_example.js:insertData}} {{#include docs/examples/node/nativeexample/multi_bind_example.js:insertData}}
``` ```
:::info :::info
......
```php
{{#include docs/examples/php/insert.php}}
```
```php
{{#include docs/examples/php/insert_stmt.php}}
```
```py
{{#include docs/examples/python/line_protocol_example.py}}
```
```py
{{#include docs/examples/python/json_protocol_example.py}}
```
```py
{{#include docs/examples/python/telnet_line_protocol_example.py}}
```
```py
{{#include docs/examples/python/native_insert_example.py}}
```
```py title=一次绑定一行 ```py title=一次绑定一行
{{#include docs-examples/python/bind_param_example.py}} {{#include docs/examples/python/bind_param_example.py}}
``` ```
```py title=一次绑定多行 ```py title=一次绑定多行
{{#include docs-examples/python/multi_bind_example.py:bind_batch}} {{#include docs/examples/python/multi_bind_example.py:bind_batch}}
``` ```
:::info :::info
......
```rust ```rust
{{#include docs-examples/rust/schemalessexample/examples/influxdb_line_example.rs}} {{#include docs/examples/rust/schemalessexample/examples/influxdb_line_example.rs}}
``` ```
```rust ```rust
{{#include docs-examples/rust/schemalessexample/examples/opentsdb_json_example.rs}} {{#include docs/examples/rust/schemalessexample/examples/opentsdb_json_example.rs}}
``` ```
```rust ```rust
{{#include docs-examples/rust/schemalessexample/examples/opentsdb_telnet_example.rs}} {{#include docs/examples/rust/schemalessexample/examples/opentsdb_telnet_example.rs}}
``` ```
```rust
{{#include docs/examples/rust/restexample/examples/insert_example.rs}}
```
```rust
{{#include docs/examples/rust/nativeexample/examples/stmt_example.rs}}
```
```c
{{#include docs/examples/c/query_example.c}}
```
\ No newline at end of file
```c
{{#include docs/examples/c/async_query_example.c:demo}}
```
\ No newline at end of file
```csharp
{{#include docs/examples/csharp/QueryExample.cs}}
```
```csharp
{{#include docs/examples/csharp/AsyncQueryExample.cs}}
```
```go
{{#include docs/examples/go/query/sync/main.go}}
```
```go
{{#include docs/examples/go/query/async/main.go}}
```
```java ```java
{{#include docs-examples/java/src/main/java/com/taos/example/RestQueryExample.java}} {{#include docs/examples/java/src/main/java/com/taos/example/RestQueryExample.java}}
``` ```
```js
{{#include docs/examples/node/nativeexample/query_example.js}}
```
```js
{{#include docs/examples/node/nativeexample/async_query_example.js}}
```
```go
{{#include docs/examples/php/query.php}}
```
通过迭代逐行获取查询结果。 通过迭代逐行获取查询结果。
```py ```py
{{#include docs-examples/python/query_example.py:iter}} {{#include docs/examples/python/query_example.py:iter}}
``` ```
一次获取所有查询结果,并把每一行转化为一个字典返回。 一次获取所有查询结果,并把每一行转化为一个字典返回。
```py ```py
{{#include docs-examples/python/query_example.py:fetch_all}} {{#include docs/examples/python/query_example.py:fetch_all}}
``` ```
```py ```py
{{#include docs-examples/python/async_query_example.py}} {{#include docs/examples/python/async_query_example.py}}
``` ```
:::note :::note
......
```rust
{{#include docs/examples/rust/restexample/examples/query_example.rs}}
```
```c
{{#include docs/examples/c/subscribe_demo.c}}
```
\ No newline at end of file
```csharp
{{#include docs/examples/csharp/SubscribeDemo.cs}}
```
\ No newline at end of file
```go
{{#include docs/examples/go/sub/main.go}}
```
\ No newline at end of file
```java ```java
{{#include docs-examples/java/src/main/java/com/taos/example/SubscribeDemo.java}} {{#include docs/examples/java/src/main/java/com/taos/example/SubscribeDemo.java}}
``` ```
:::note :::note
目前 Java 接口没有提供异步订阅模式,但用户程序可以通过创建 `TimerTask` 等方式达到同样的效果。 目前 Java 接口没有提供异步订阅模式,但用户程序可以通过创建 `TimerTask` 等方式达到同样的效果。
......
```js
{{#include docs/examples/node/nativeexample/subscribe_demo.js}}
```
\ No newline at end of file
```py
{{#include docs/examples/python/subscribe_demo.py}}
```
\ No newline at end of file
```rs
{{#include docs/examples/rust/nativeexample/examples/subscribe_demo.rs}}
```
\ No newline at end of file
...@@ -45,48 +45,274 @@ title: TDengine 参数限制与保留关键字 ...@@ -45,48 +45,274 @@ title: TDengine 参数限制与保留关键字
目前 TDengine 有将近 200 个内部保留关键字,这些关键字无论大小写均不可以用作库名、表名、STable 名、数据列名及标签列名等。这些关键字列表如下: 目前 TDengine 有将近 200 个内部保留关键字,这些关键字无论大小写均不可以用作库名、表名、STable 名、数据列名及标签列名等。这些关键字列表如下:
| 关键字列表 | | | | | ### A
| ----------- | ---------- | --------- | ---------- | ------------ |
| ABORT | CREATE | IGNORE | NULL | STAR | - ABORT
| ACCOUNT | CTIME | IMMEDIATE | OF | STATE | - ACCOUNT
| ACCOUNTS | DATABASE | IMPORT | OFFSET | STATEMENT | - ACCOUNTS
| ADD | DATABASES | IN | OR | STATE_WINDOW | - ADD
| AFTER | DAYS | INITIALLY | ORDER | STORAGE | - AFTER
| ALL | DBS | INSERT | PARTITIONS | STREAM | - ALL
| ALTER | DEFERRED | INSTEAD | PASS | STREAMS | - ALTER
| AND | DELIMITERS | INT | PLUS | STRING | - AND
| AS | DESC | INTEGER | PPS | SYNCDB | - AS
| ASC | DESCRIBE | INTERVAL | PRECISION | TABLE | - ASC
| ATTACH | DETACH | INTO | PREV | TABLES | - ATTACH
| BEFORE | DISTINCT | IS | PRIVILEGE | TAG |
| BEGIN | DIVIDE | ISNULL | QTIME | TAGS | ### B
| BETWEEN | DNODE | JOIN | QUERIES | TBNAME |
| BIGINT | DNODES | KEEP | QUERY | TIMES | - BEFORE
| BINARY | DOT | KEY | QUORUM | TIMESTAMP | - BEGIN
| BITAND | DOUBLE | KILL | RAISE | TINYINT | - BETWEEN
| BITNOT | DROP | LE | REM | TOPIC | - BIGINT
| BITOR | EACH | LIKE | REPLACE | TOPICS | - BINARY
| BLOCKS | END | LIMIT | REPLICA | TRIGGER | - BITAND
| BOOL | EQ | LINEAR | RESET | TSERIES | - BITNOT
| BY | EXISTS | LOCAL | RESTRICT | UMINUS | - BITOR
| CACHE | EXPLAIN | LP | ROW | UNION | - BLOCKS
| CACHELAST | FAIL | LSHIFT | RP | UNSIGNED | - BOOL
| CASCADE | FILE | LT | RSHIFT | UPDATE | - BY
| CHANGE | FILL | MATCH | SCORES | UPLUS |
| CLUSTER | FLOAT | MAXROWS | SELECT | USE | ### C
| COLON | FOR | MINROWS | SEMI | USER |
| COLUMN | FROM | MINUS | SESSION | USERS | - CACHE
| COMMA | FSYNC | MNODES | SET | USING | - CACHELAST
| COMP | GE | MODIFY | SHOW | VALUES | - CASCADE
| COMPACT | GLOB | MODULES | SLASH | VARIABLE | - CHANGE
| CONCAT | GRANTS | NCHAR | SLIDING | VARIABLES | - CLUSTER
| CONFLICT | GROUP | NE | SLIMIT | VGROUPS | - COLON
| CONNECTION | GT | NONE | SMALLINT | VIEW | - COLUMN
| CONNECTIONS | HAVING | NOT | SOFFSET | VNODES | - COMMA
| CONNS | ID | NOTNULL | STABLE | WAL | - COMP
| COPY | IF | NOW | STABLES | WHERE | - COMPACT
| _C0 | _QSTART | _QSTOP | _QDURATION | _WSTART | - CONCAT
| _WSTOP | _WDURATION | - CONFLICT
- CONNECTION
- CONNECTIONS
- CONNS
- COPY
- CREATE
- CTIME
### D
- DATABASE
- DATABASES
- DAYS
- DBS
- DEFERRED
- DELETE
- DELIMITERS
- DESC
- DESCRIBE
- DETACH
- DISTINCT
- DIVIDE
- DNODE
- DNODES
- DOT
- DOUBLE
- DROP
### E
- END
- EQ
- EXISTS
- EXPLAIN
### F
- FAIL
- FILE
- FILL
- FLOAT
- FOR
- FROM
- FSYNC
### G
- GE
- GLOB
- GRANTS
- GROUP
- GT
### H
- HAVING
### I
- ID
- IF
- IGNORE
- IMMEDIA
- IMPORT
- IN
- INITIAL
- INSERT
- INSTEAD
- INT
- INTEGER
- INTERVA
- INTO
- IS
- ISNULL
### J
- JOIN
### K
- KEEP
- KEY
- KILL
### L
- LE
- LIKE
- LIMIT
- LINEAR
- LOCAL
- LP
- LSHIFT
- LT
### M
- MATCH
- MAXROWS
- MINROWS
- MINUS
- MNODES
- MODIFY
- MODULES
### N
- NE
- NONE
- NOT
- NOTNULL
- NOW
- NULL
### O
- OF
- OFFSET
- OR
- ORDER
### P
- PARTITION
- PASS
- PLUS
- PPS
- PRECISION
- PREV
- PRIVILEGE
### Q
- QTIME
- QUERIE
- QUERY
- QUORUM
### R
- RAISE
- REM
- REPLACE
- REPLICA
- RESET
- RESTRIC
- ROW
- RP
- RSHIFT
### S
- SCORES
- SELECT
- SEMI
- SESSION
- SET
- SHOW
- SLASH
- SLIDING
- SLIMIT
- SMALLIN
- SOFFSET
- STable
- STableS
- STAR
- STATE
- STATEMEN
- STATE_WI
- STORAGE
- STREAM
- STREAMS
- STRING
- SYNCDB
### T
- TABLE
- TABLES
- TAG
- TAGS
- TBNAME
- TIMES
- TIMESTAMP
- TINYINT
- TOPIC
- TOPICS
- TRIGGER
- TSERIES
### U
- UMINUS
- UNION
- UNSIGNED
- UPDATE
- UPLUS
- USE
- USER
- USERS
- USING
### V
- VALUES
- VARIABLE
- VARIABLES
- VGROUPS
- VIEW
- VNODES
### W
- WAL
- WHERE
### _
- _C0
- _QSTART
- _QSTOP
- _QDURATION
- _WSTART
- _WSTOP
- _WDURATION
## 特殊说明 ## 特殊说明
### TBNAME ### TBNAME
...@@ -95,6 +321,7 @@ title: TDengine 参数限制与保留关键字 ...@@ -95,6 +321,7 @@ title: TDengine 参数限制与保留关键字
获取一个超级表所有的子表名及相关的标签信息: 获取一个超级表所有的子表名及相关的标签信息:
```mysql ```mysql
SELECT TBNAME, location FROM meters; SELECT TBNAME, location FROM meters;
```
统计超级表下辖子表数量: 统计超级表下辖子表数量:
```mysql ```mysql
......
在 Linux shell 下直接执行 `taos` 连接到 TDengine 服务,进入到 TDengine CLI 界面,示例如下: 在 Linux shell 下直接执行 `taos` 连接到 TDengine 服务,进入到 TDengine CLI 界面,示例如下:
```text ```text
$ taos $ taos
Welcome to the TDengine shell from Linux, Client Version:2.0.5.0 Welcome to the TDengine shell from Linux, Client Version:2.0.5.0
Copyright (c) 2017 by TAOS Data, Inc. All rights reserved. Copyright (c) 2017 by TAOS Data, Inc. All rights reserved.
taos> show databases; taos> show databases;
name | created_time | ntables | vgroups | replica | quorum | days | keep1,keep2,keep(D) | cache(MB)| blocks | minrows | maxrows | wallevel | fsync | comp | precision | status | name | created_time | ntables | vgroups | replica | quorum | days | keep1,keep2,keep(D) | cache(MB)| blocks | minrows | maxrows | wallevel | fsync | comp | precision | status |
========================================================================================================================================================================================================================= =========================================================================================================================================================================================================================
test | 2020-10-14 10:35:48.617 | 10 | 1 | 1 | 1 | 2 | 3650,3650,3650 | 16| 6 | 100 | 4096 | 1 | 3000 | 2 | ms | ready | test | 2020-10-14 10:35:48.617 | 10 | 1 | 1 | 1 | 2 | 3650,3650,3650 | 16| 6 | 100 | 4096 | 1 | 3000 | 2 | ms | ready |
log | 2020-10-12 09:08:21.651 | 4 | 1 | 1 | 1 | 10 | 30,30,30 | 1| 3 | 100 | 4096 | 1 | 3000 | 2 | us | ready | log | 2020-10-12 09:08:21.651 | 4 | 1 | 1 | 1 | 10 | 30,30,30 | 1| 3 | 100 | 4096 | 1 | 3000 | 2 | us | ready |
Query OK, 2 row(s) in set (0.001198s) Query OK, 2 row(s) in set (0.001198s)
taos> taos>
``` ```
在 cmd 下进入到 C:\TDengine 目录下直接执行 `taos.exe`,连接到 TDengine 服务,进入到 TDengine CLI 界面,示例如下: 在 cmd 下进入到 C:\TDengine 目录下直接执行 `taos.exe`,连接到 TDengine 服务,进入到 TDengine CLI 界面,示例如下:
```text ```text
C:\TDengine>taos C:\TDengine>taos
Welcome to the TDengine shell from Linux, Client Version:2.0.5.0 Welcome to the TDengine shell from Linux, Client Version:2.0.5.0
Copyright (c) 2017 by TAOS Data, Inc. All rights reserved. Copyright (c) 2017 by TAOS Data, Inc. All rights reserved.
taos> show databases; taos> show databases;
name | created_time | ntables | vgroups | replica | quorum | days | keep1,keep2,keep(D) | cache(MB) | blocks | minrows | maxrows | wallevel | fsync | comp | precision | status | name | created_time | ntables | vgroups | replica | quorum | days | keep1,keep2,keep(D) | cache(MB) | blocks | minrows | maxrows | wallevel | fsync | comp | precision | status |
=================================================================================================================================================================================================================================================================== ===================================================================================================================================================================================================================================================================
test | 2020-10-14 10:35:48.617 | 10 | 1 | 1 | 1 | 2 | 3650,3650,3650 | 16 | 6 | 100 | 4096 | 1 | 3000 | 2 | ms | ready | test | 2020-10-14 10:35:48.617 | 10 | 1 | 1 | 1 | 2 | 3650,3650,3650 | 16 | 6 | 100 | 4096 | 1 | 3000 | 2 | ms | ready |
log | 2020-10-12 09:08:21.651 | 4 | 1 | 1 | 1 | 10 | 30,30,30 | 1 | 3 | 100 | 4096 | 1 | 3000 | 2 | us | ready | log | 2020-10-12 09:08:21.651 | 4 | 1 | 1 | 1 | 10 | 30,30,30 | 1 | 3 | 100 | 4096 | 1 | 3000 | 2 | us | ready |
Query OK, 2 row(s) in set (0.045000s) Query OK, 2 row(s) in set (0.045000s)
taos> taos>
``` ```
...@@ -91,7 +91,7 @@ phpize && ./configure --enable-swoole && make -j && make install ...@@ -91,7 +91,7 @@ phpize && ./configure --enable-swoole && make -j && make install
<summary>建立连接</summary> <summary>建立连接</summary>
```c ```c
{{#include docs-examples/php/connect.php}} {{#include docs/examples/php/connect.php}}
``` ```
</details> </details>
...@@ -102,7 +102,7 @@ phpize && ./configure --enable-swoole && make -j && make install ...@@ -102,7 +102,7 @@ phpize && ./configure --enable-swoole && make -j && make install
<summary>插入数据</summary> <summary>插入数据</summary>
```c ```c
{{#include docs-examples/php/insert.php}} {{#include docs/examples/php/insert.php}}
``` ```
</details> </details>
...@@ -113,7 +113,7 @@ phpize && ./configure --enable-swoole && make -j && make install ...@@ -113,7 +113,7 @@ phpize && ./configure --enable-swoole && make -j && make install
<summary>同步查询</summary> <summary>同步查询</summary>
```c ```c
{{#include docs-examples/php/query.php}} {{#include docs/examples/php/query.php}}
``` ```
</details> </details>
...@@ -124,7 +124,7 @@ phpize && ./configure --enable-swoole && make -j && make install ...@@ -124,7 +124,7 @@ phpize && ./configure --enable-swoole && make -j && make install
<summary>参数绑定</summary> <summary>参数绑定</summary>
```c ```c
{{#include docs-examples/php/insert_stmt.php}} {{#include docs/examples/php/insert_stmt.php}}
``` ```
</details> </details>
......
...@@ -169,7 +169,7 @@ curl -u root:taosdata http://<FQDN>:<PORT>/rest/sql -d "select server_version()" ...@@ -169,7 +169,7 @@ curl -u root:taosdata http://<FQDN>:<PORT>/rest/sql -d "select server_version()"
<TabItem value="native" label="原生连接" groupId="connect"> <TabItem value="native" label="原生连接" groupId="connect">
```python ```python
{{#include docs-examples/python/connect_native_reference.py}} {{#include docs/examples/python/connect_native_reference.py}}
``` ```
`connect` 函数的所有参数都是可选的关键字参数。下面是连接参数的具体说明: `connect` 函数的所有参数都是可选的关键字参数。下面是连接参数的具体说明:
...@@ -194,7 +194,7 @@ curl -u root:taosdata http://<FQDN>:<PORT>/rest/sql -d "select server_version()" ...@@ -194,7 +194,7 @@ curl -u root:taosdata http://<FQDN>:<PORT>/rest/sql -d "select server_version()"
<TabItem value="rest" label="REST 连接"> <TabItem value="rest" label="REST 连接">
```python ```python
{{#include docs-examples/python/connect_rest_examples.py:connect}} {{#include docs/examples/python/connect_rest_examples.py:connect}}
``` ```
`connect()` 函数的所有参数都是可选的关键字参数。下面是连接参数的具体说明: `connect()` 函数的所有参数都是可选的关键字参数。下面是连接参数的具体说明:
...@@ -219,11 +219,11 @@ curl -u root:taosdata http://<FQDN>:<PORT>/rest/sql -d "select server_version()" ...@@ -219,11 +219,11 @@ curl -u root:taosdata http://<FQDN>:<PORT>/rest/sql -d "select server_version()"
`TaosConnection` 类既包含对 PEP249 Connection 接口的实现(如:`cursor`方法和 `close` 方法),也包含很多扩展功能(如: `execute`、 `query`、`schemaless_insert` 和 `subscribe` 方法。 `TaosConnection` 类既包含对 PEP249 Connection 接口的实现(如:`cursor`方法和 `close` 方法),也包含很多扩展功能(如: `execute`、 `query`、`schemaless_insert` 和 `subscribe` 方法。
```python title="execute 方法" ```python title="execute 方法"
{{#include docs-examples/python/connection_usage_native_reference.py:insert}} {{#include docs/examples/python/connection_usage_native_reference.py:insert}}
``` ```
```python title="query 方法" ```python title="query 方法"
{{#include docs-examples/python/connection_usage_native_reference.py:query}} {{#include docs/examples/python/connection_usage_native_reference.py:query}}
``` ```
:::tip :::tip
...@@ -235,14 +235,14 @@ curl -u root:taosdata http://<FQDN>:<PORT>/rest/sql -d "select server_version()" ...@@ -235,14 +235,14 @@ curl -u root:taosdata http://<FQDN>:<PORT>/rest/sql -d "select server_version()"
上面 `TaosConnection` 类的使用示例中,我们已经展示了两种获取查询结果的方法: `fetch_all()` 和 `fetch_all_into_dict()`。除此之外 `TaosResult` 还提供了按行迭代(`rows_iter`)或按数据块迭代(`blocks_iter`)结果集的方法。在查询数据量较大的场景,使用这两个方法会更高效。 上面 `TaosConnection` 类的使用示例中,我们已经展示了两种获取查询结果的方法: `fetch_all()` 和 `fetch_all_into_dict()`。除此之外 `TaosResult` 还提供了按行迭代(`rows_iter`)或按数据块迭代(`blocks_iter`)结果集的方法。在查询数据量较大的场景,使用这两个方法会更高效。
```python title="blocks_iter 方法" ```python title="blocks_iter 方法"
{{#include docs-examples/python/result_set_examples.py}} {{#include docs/examples/python/result_set_examples.py}}
``` ```
##### TaosCursor 类的使用 ##### TaosCursor 类的使用
`TaosConnection` 类和 `TaosResult` 类已经实现了原生接口的所有功能。如果你对 PEP249 规范中的接口比较熟悉也可以使用 `TaosCursor` 类提供的方法。 `TaosConnection` 类和 `TaosResult` 类已经实现了原生接口的所有功能。如果你对 PEP249 规范中的接口比较熟悉也可以使用 `TaosCursor` 类提供的方法。
```python title="TaosCursor 的使用" ```python title="TaosCursor 的使用"
{{#include docs-examples/python/cursor_usage_native_reference.py}} {{#include docs/examples/python/cursor_usage_native_reference.py}}
``` ```
:::note :::note
...@@ -258,7 +258,7 @@ TaosCursor 类使用原生连接进行写入、查询操作。在客户端多线 ...@@ -258,7 +258,7 @@ TaosCursor 类使用原生连接进行写入、查询操作。在客户端多线
`TaosRestCursor` 类是对 PEP249 Cursor 接口的实现。 `TaosRestCursor` 类是对 PEP249 Cursor 接口的实现。
```python title="TaosRestCursor 的使用" ```python title="TaosRestCursor 的使用"
{{#include docs-examples/python/connect_rest_examples.py:basic}} {{#include docs/examples/python/connect_rest_examples.py:basic}}
``` ```
- `cursor.execute` : 用来执行任意 SQL 语句。 - `cursor.execute` : 用来执行任意 SQL 语句。
- `cursor.rowcount`: 对于写入操作返回写入成功记录数。对于查询操作,返回结果集行数。 - `cursor.rowcount`: 对于写入操作返回写入成功记录数。对于查询操作,返回结果集行数。
...@@ -269,7 +269,7 @@ TaosCursor 类使用原生连接进行写入、查询操作。在客户端多线 ...@@ -269,7 +269,7 @@ TaosCursor 类使用原生连接进行写入、查询操作。在客户端多线
`RestClient` 类是对于 [REST API](/reference/rest-api) 的直接封装。它只包含一个 `sql()` 方法用于执行任意 SQL 语句, 并返回执行结果。 `RestClient` 类是对于 [REST API](/reference/rest-api) 的直接封装。它只包含一个 `sql()` 方法用于执行任意 SQL 语句, 并返回执行结果。
```python title="RestClient 的使用" ```python title="RestClient 的使用"
{{#include docs-examples/python/rest_client_example.py}} {{#include docs/examples/python/rest_client_example.py}}
``` ```
对于 `sql()` 方法更详细的介绍, 请参考 [RestClient](https://docs.taosdata.com/api/taospy/taosrest/restclient.html)。 对于 `sql()` 方法更详细的介绍, 请参考 [RestClient](https://docs.taosdata.com/api/taospy/taosrest/restclient.html)。
...@@ -285,14 +285,14 @@ TaosCursor 类使用原生连接进行写入、查询操作。在客户端多线 ...@@ -285,14 +285,14 @@ TaosCursor 类使用原生连接进行写入、查询操作。在客户端多线
<TabItem value="native" label="原生连接"> <TabItem value="native" label="原生连接">
```python ```python
{{#include docs-examples/python/conn_native_pandas.py}} {{#include docs/examples/python/conn_native_pandas.py}}
``` ```
</TabItem> </TabItem>
<TabItem value="rest" label="REST 连接"> <TabItem value="rest" label="REST 连接">
```python ```python
{{#include docs-examples/python/conn_rest_pandas.py}} {{#include docs/examples/python/conn_rest_pandas.py}}
``` ```
</TabItem> </TabItem>
...@@ -316,7 +316,7 @@ TaosCursor 类使用原生连接进行写入、查询操作。在客户端多线 ...@@ -316,7 +316,7 @@ TaosCursor 类使用原生连接进行写入、查询操作。在客户端多线
所有数据库操作如果出现异常,都会直接抛出来。由应用程序负责异常处理。比如: 所有数据库操作如果出现异常,都会直接抛出来。由应用程序负责异常处理。比如:
```python ```python
{{#include docs-examples/python/handle_exception.py}} {{#include docs/examples/python/handle_exception.py}}
``` ```
### 关于纳秒 (nanosecond) ### 关于纳秒 (nanosecond)
......
...@@ -38,6 +38,16 @@ export TDENGINE_API=http://tdengine.local:6041 ...@@ -38,6 +38,16 @@ export TDENGINE_API=http://tdengine.local:6041
# user + password # user + password
export TDENGINE_USER=user export TDENGINE_USER=user
export TDENGINE_PASSWORD=password export TDENGINE_PASSWORD=password
# 其他环境变量:
# - 是否安装数据源,默认为 true,表示安装
export TDENGINE_DS_ENABLED=false
# - 数据源名称,默认为 TDengine
export TDENGINE_DS_NAME=TDengine
# - 数据源所属组织 ID,默认为 1
export GF_ORG_ID=1
# - 数据源是否可通过管理面板编辑,默认为 0,表示不可编辑
export TDENGINE_EDITABLE=1
``` ```
运行安装脚本: 运行安装脚本:
...@@ -48,6 +58,8 @@ bash -c "$(curl -fsSL https://raw.githubusercontent.com/taosdata/grafanaplugin/m ...@@ -48,6 +58,8 @@ bash -c "$(curl -fsSL https://raw.githubusercontent.com/taosdata/grafanaplugin/m
该脚本将自动安装 Grafana 插件并配置数据源。安装完毕后,需要重启 Grafana 服务后生效。 该脚本将自动安装 Grafana 插件并配置数据源。安装完毕后,需要重启 Grafana 服务后生效。
保存该脚本并执行 `./install.sh --help` 可查看详细帮助文档。
</TabItem> </TabItem>
<TabItem value="manual" label="手动安装并配置"> <TabItem value="manual" label="手动安装并配置">
......
...@@ -116,7 +116,7 @@ INSERT INTO test.sensor_data VALUES( ...@@ -116,7 +116,7 @@ INSERT INTO test.sensor_data VALUES(
## 编写模拟测试程序 ## 编写模拟测试程序
```javascript ```javascript
{{#include docs-examples/other/mock.js}} {{#include docs/examples/other/mock.js}}
``` ```
注意:代码中 CLIENT_NUM 在开始测试中可以先设置一个较小的值,避免硬件性能不能完全处理较大并发客户端数量。 注意:代码中 CLIENT_NUM 在开始测试中可以先设置一个较小的值,避免硬件性能不能完全处理较大并发客户端数量。
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
title: 2.4 title: 2.4
--- ---
[2.4.0.26](https://github.com/taosdata/TDengine/releases/tag/ver-2.4.0.26)
[2.4.0.25](https://github.com/taosdata/TDengine/releases/tag/ver-2.4.0.25) [2.4.0.25](https://github.com/taosdata/TDengine/releases/tag/ver-2.4.0.25)
[2.4.0.24](https://github.com/taosdata/TDengine/releases/tag/ver-2.4.0.24) [2.4.0.24](https://github.com/taosdata/TDengine/releases/tag/ver-2.4.0.24)
...@@ -24,4 +26,4 @@ title: 2.4 ...@@ -24,4 +26,4 @@ title: 2.4
[2.4.0.4](https://github.com/taosdata/TDengine/releases/tag/ver-2.4.0.4) [2.4.0.4](https://github.com/taosdata/TDengine/releases/tag/ver-2.4.0.4)
[2.4.0.0](https://github.com/taosdata/TDengine/releases/tag/ver-2.4.0.0) [2.4.0.0](https://github.com/taosdata/TDengine/releases/tag/ver-2.4.0.0)
\ No newline at end of file
@echo off
set CUR_DIR=%~dp0
set SHELL_DIR=%cd%
set ENTERPRISE_DIR="%SHELL_DIR%\..\.."
set COMMUNITY_DIR="%SHELL_DIR%\.."
set TOOLS_DIR="%SHELL_DIR%\..\src\kit\taos-tools"
cd %ENTERPRISE_DIR%
git checkout -- .
if exist "enterprise\src\plugins\taosainternal\taosadapter" (
del /f "enterprise\src\plugins\taosainternal\taosadapter"
)
if exist "enterprise\src\plugins\taosainternal\upx.tar.xz" (
del /f "enterprise\src\plugins\taosainternal\upx.tar.xz"
)
cd %COMMUNITY_DIR%
git checkout -- .
cd %TOOLS_DIR%
git checkout -- .
if exist "packaging\tools\install-khtools.sh" (
del /f "packaging\tools\install-khtools.sh"
)
if exist "packaging\tools\uninstall-khtools.sh" (
del /f "packaging/tools/uninstall-khtools.sh"
)
if exist "packaging\tools\install-prodbtools.sh" (
del /f "packaging\tools\install-prodbtools.sh"
)
if exist "packaging\tools\uninstall-prodbtools.sh" (
del /f "packaging\tools\uninstall-prodbtools.sh"
)
cd %CUR_DIR%
\ No newline at end of file
#!/bin/bash
CUR_DIR=$(pwd)
SHELL_DIR=$(dirname $(readlink -f "$0"))
ENTERPRISE_DIR=$SHELL_DIR/../..
COMMUNITY_DIR=$SHELL_DIR/..
TOOLS_DIR=$COMMUNITY_DIR/src/kit/taos-tools
cd $ENTERPRISE_DIR
git checkout -- .
if [[ -e enterprise/src/plugins/taosainternal/taosadapter ]]; then
rm -f enterprise/src/plugins/taosainternal/taosadapter
fi
if [[ -e enterprise/src/plugins/taosainternal/upx.tar.xz ]]; then
rm -f enterprise/src/plugins/taosainternal/upx.tar.xz
fi
cd $COMMUNITY_DIR
git checkout -- .
if [[ -e src/plugins/taosadapter/taosadapter ]]; then
rm -f src/plugins/taosadapter/taosadapter
fi
if [[ -e src/plugins/taosadapter/upx.tar.xz ]]; then
rm -f src/plugins/taosadapter/upx.tar.xz
fi
cd $TOOLS_DIR
git checkout -- .
rm -f $(find packaging/tools/ -name install-*tools.sh | grep -v taos)
rm -f $(find packaging/tools/ -name uninstall-*tools.sh | grep -v taos)
rm -rf $COMMUNITY_DIR/debug/*
rm -rf $COMMUNITY_DIR/release/*
if [[ -e $COMMUNITY_DIR/rpms ]]; then
rm -rf $COMMUNITY_DIR/rpms
fi
if [[ -e $COMMUNITY_DIR/debs ]]; then
rm -rf $COMMUNITY_DIR/debs
fi
cd $CUR_DIR
#!/bin/bash #!/bin/bash
#
# Modified from original source: Elastic Search
# https://github.com/elasticsearch/elasticsearch
# Thank you to the Elastic Search authors
#
# chkconfig: 2345 99 01
#
### BEGIN INIT INFO
# Provides: TDengine
# Required-Start: $local_fs $network $syslog
# Required-Stop: $local_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts TDengine taosd
# Description: Starts TDengine taosd, a time-series database engine
### END INIT INFO
set -e set -e
......
...@@ -6,9 +6,10 @@ cd %community_dir% ...@@ -6,9 +6,10 @@ cd %community_dir%
git checkout -- . git checkout -- .
cd %community_dir%\packaging cd %community_dir%\packaging
:: %1 name %2 version :: %1 name %2 version %3 cpuType
if !%1==! GOTO USAGE if !%1==! GOTO USAGE
if !%2==! GOTO USAGE if !%2==! GOTO USAGE
if !%3==! GOTO USAGE
if %1 == taos GOTO TAOS if %1 == taos GOTO TAOS
if %1 == power GOTO POWER if %1 == power GOTO POWER
if %1 == tq GOTO TQ if %1 == tq GOTO TQ
...@@ -21,42 +22,66 @@ GOTO USAGE ...@@ -21,42 +22,66 @@ GOTO USAGE
goto RELEASE goto RELEASE
:POWER :POWER
cd %internal_dir%\enterprise\packaging\oem
call sed_power.bat %community_dir% call sed_power.bat %community_dir%
cd %community_dir%\packaging
goto RELEASE goto RELEASE
:TQ :TQ
cd %internal_dir%\enterprise\packaging\oem
call sed_tq.bat %community_dir% call sed_tq.bat %community_dir%
cd %community_dir%\packaging
goto RELEASE goto RELEASE
:PRO :PRO
cd %internal_dir%\enterprise\packaging\oem
call sed_pro.bat %community_dir% call sed_pro.bat %community_dir%
cd %community_dir%\packaging
goto RELEASE goto RELEASE
:KH :KH
cd %internal_dir%\enterprise\packaging\oem
call sed_kh.bat %community_dir% call sed_kh.bat %community_dir%
cd %community_dir%\packaging
goto RELEASE goto RELEASE
:JH :JH
cd %internal_dir%\enterprise\packaging\oem
call sed_jh.bat %community_dir% call sed_jh.bat %community_dir%
cd %community_dir%\packaging
goto RELEASE goto RELEASE
:RELEASE :RELEASE
echo release windows-client-64 for %1, version: %2 echo release windows-client for %1, version: %2, cpyType: %3
if not exist %internal_dir%\debug\ver-%2-64bit-%1 ( if not exist %internal_dir%\debug\ver-%2-%1-%3 (
md %internal_dir%\debug\ver-%2-64bit-%1 md %internal_dir%\debug\ver-%2-%1-%3
) else ( ) else (
rd /S /Q %internal_dir%\debug\ver-%2-64bit-%1 rd /S /Q %internal_dir%\debug\ver-%2-%1-%3
md %internal_dir%\debug\ver-%2-64bit-%1 md %internal_dir%\debug\ver-%2-%1-%3
) )
cd %internal_dir%\debug\ver-%2-64bit-%1 cd %internal_dir%\debug\ver-%2-%1-%3
if %3% == x64 GOTO X64
if %3% == x86 GOTO X86
GOTO USAGE
:X86
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
cmake ../../ -G "NMake Makefiles" -DVERNUMBER=%2 -DCPUTYPE=x86
GOTO MAKE_AND_INSTALL
:X64
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64 call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
cmake ../../ -G "NMake Makefiles" -DVERNUMBER=%2 -DCPUTYPE=x64 cmake ../../ -G "NMake Makefiles" -DVERNUMBER=%2 -DCPUTYPE=x64
GOTO MAKE_AND_INSTALL
:MAKE_AND_INSTALL
set CL=/MP4 set CL=/MP4
nmake install nmake install
goto EXIT0 goto EXIT0
:USAGE :USAGE
echo Usage: release.bat $productName $version echo Usage: release.bat $productName $version $cpuType
goto EXIT0 goto EXIT0
:EXIT0 :EXIT0
\ No newline at end of file
...@@ -101,13 +101,13 @@ echo "verMode=${verMode} verType=${verType} cpuType=${cpuType} osType=${osType} ...@@ -101,13 +101,13 @@ echo "verMode=${verMode} verType=${verType} cpuType=${cpuType} osType=${osType}
curr_dir=$(pwd) curr_dir=$(pwd)
if [ "$osType" == "Darwin" ]; then if [ "$osType" == "Darwin" ]; then
script_dir="$(dirname $(readlink -f $0))"
top_dir="$(readlink -f ${script_dir}/..)"
else
script_dir=$(dirname $0) script_dir=$(dirname $0)
cd ${script_dir} cd ${script_dir}
script_dir="$(pwd)" script_dir="$(pwd)"
top_dir=${script_dir}/.. top_dir=${script_dir}/..
else
script_dir="$(dirname $(readlink -f $0))"
top_dir="$(readlink -f ${script_dir}/..)"
fi fi
csudo="" csudo=""
...@@ -198,6 +198,7 @@ else ...@@ -198,6 +198,7 @@ else
allocator_macro="" allocator_macro=""
fi fi
# 3. replace product info
if [[ "$dbName" != "taos" ]]; then if [[ "$dbName" != "taos" ]]; then
source ${enterprise_dir}/packaging/oem/sed_$dbName.sh source ${enterprise_dir}/packaging/oem/sed_$dbName.sh
replace_community_$dbName replace_community_$dbName
......
...@@ -207,7 +207,7 @@ function install_bin() { ...@@ -207,7 +207,7 @@ function install_bin() {
[ -x ${install_main_dir}/bin/${adapterName} ] && ${csudo}ln -s ${install_main_dir}/bin/${adapterName} ${bin_link_dir}/${adapterName} || : [ -x ${install_main_dir}/bin/${adapterName} ] && ${csudo}ln -s ${install_main_dir}/bin/${adapterName} ${bin_link_dir}/${adapterName} || :
[ -x ${install_main_dir}/bin/${benchmarkName} ] && ${csudo}ln -s ${install_main_dir}/bin/${benchmarkName} ${bin_link_dir}/${demoName} || : [ -x ${install_main_dir}/bin/${benchmarkName} ] && ${csudo}ln -s ${install_main_dir}/bin/${benchmarkName} ${bin_link_dir}/${demoName} || :
[ -x ${install_main_dir}/bin/${benchmarkName} ] && ${csudo}ln -s ${install_main_dir}/bin/${benchmarkName} ${bin_link_dir}/${benchmarkName} || : [ -x ${install_main_dir}/bin/${benchmarkName} ] && ${csudo}ln -s ${install_main_dir}/bin/${benchmarkName} ${bin_link_dir}/${benchmarkName} || :
[ -x ${install_main_dir}/bin/${dumpName} ] && ${csudo}ln -s ${install_main_dir}/bin/${dumpName} ${bin_link_dir}/${dumpName} || : # [ -x ${install_main_dir}/bin/${dumpName} ] && ${csudo}ln -s ${install_main_dir}/bin/${dumpName} ${bin_link_dir}/${dumpName} || :
[ -x ${install_main_dir}/bin/TDinsight.sh ] && ${csudo}ln -s ${install_main_dir}/bin/TDinsight.sh ${bin_link_dir}/TDinsight.sh || : [ -x ${install_main_dir}/bin/TDinsight.sh ] && ${csudo}ln -s ${install_main_dir}/bin/TDinsight.sh ${bin_link_dir}/TDinsight.sh || :
[ -x ${install_main_dir}/bin/remove.sh ] && ${csudo}ln -s ${install_main_dir}/bin/remove.sh ${bin_link_dir}/${uninstallScript} || : [ -x ${install_main_dir}/bin/remove.sh ] && ${csudo}ln -s ${install_main_dir}/bin/remove.sh ${bin_link_dir}/${uninstallScript} || :
[ -x ${install_main_dir}/bin/set_core.sh ] && ${csudo}ln -s ${install_main_dir}/bin/set_core.sh ${bin_link_dir}/set_core || : [ -x ${install_main_dir}/bin/set_core.sh ] && ${csudo}ln -s ${install_main_dir}/bin/set_core.sh ${bin_link_dir}/set_core || :
......
...@@ -7,6 +7,9 @@ set -e ...@@ -7,6 +7,9 @@ set -e
#set -x #set -x
# -----------------------Variables definition--------------------- # -----------------------Variables definition---------------------
productName="TDengine"
emailName="taosdata.com"
script_dir=$(dirname $(readlink -f "$0")) script_dir=$(dirname $(readlink -f "$0"))
bin_link_dir="/usr/bin" bin_link_dir="/usr/bin"
...@@ -83,7 +86,7 @@ else ...@@ -83,7 +86,7 @@ else
echo " osinfo: ${osinfo}" echo " osinfo: ${osinfo}"
echo " This is an officially unverified linux system," echo " This is an officially unverified linux system,"
echo " if there are any problems with the installation and operation, " echo " if there are any problems with the installation and operation, "
echo " please feel free to contact taosdata.com for support." echo " please feel free to contact ${emailName} for support."
os_type=1 os_type=1
fi fi
...@@ -241,7 +244,7 @@ function install_service_on_systemd() { ...@@ -241,7 +244,7 @@ function install_service_on_systemd() {
tarbitratord_service_config="${service_config_dir}/tarbitratord.service" tarbitratord_service_config="${service_config_dir}/tarbitratord.service"
${csudo}bash -c "echo '[Unit]' >> ${tarbitratord_service_config}" ${csudo}bash -c "echo '[Unit]' >> ${tarbitratord_service_config}"
${csudo}bash -c "echo 'Description=TDengine arbitrator service' >> ${tarbitratord_service_config}" ${csudo}bash -c "echo 'Description=${productName} arbitrator service' >> ${tarbitratord_service_config}"
${csudo}bash -c "echo 'After=network-online.target' >> ${tarbitratord_service_config}" ${csudo}bash -c "echo 'After=network-online.target' >> ${tarbitratord_service_config}"
${csudo}bash -c "echo 'Wants=network-online.target' >> ${tarbitratord_service_config}" ${csudo}bash -c "echo 'Wants=network-online.target' >> ${tarbitratord_service_config}"
${csudo}bash -c "echo >> ${tarbitratord_service_config}" ${csudo}bash -c "echo >> ${tarbitratord_service_config}"
...@@ -273,9 +276,9 @@ function install_service() { ...@@ -273,9 +276,9 @@ function install_service() {
fi fi
} }
function update_TDengine() { function update_Product() {
# Start to update # Start to update
echo -e "${GREEN}Start to update TDengine's arbitrator ...${NC}" echo -e "${GREEN}Start to update ${productName}'s arbitrator ...${NC}"
# Stop the service if running # Stop the service if running
if pidof tarbitrator &>/dev/null; then if pidof tarbitrator &>/dev/null; then
if ((${service_mod} == 0)); then if ((${service_mod} == 0)); then
...@@ -303,12 +306,12 @@ function update_TDengine() { ...@@ -303,12 +306,12 @@ function update_TDengine() {
echo -e "${GREEN_DARK}To start arbitrator ${NC}: ./tarbitrator${NC}" echo -e "${GREEN_DARK}To start arbitrator ${NC}: ./tarbitrator${NC}"
fi fi
echo echo
echo -e "\033[44;32;1mTDengine's arbitrator is updated successfully!${NC}" echo -e "\033[44;32;1m${productName}'s arbitrator is updated successfully!${NC}"
} }
function install_TDengine() { function install_Product() {
# Start to install # Start to install
echo -e "${GREEN}Start to install TDengine's arbitrator ...${NC}" echo -e "${GREEN}Start to install ${productName}'s arbitrator ...${NC}"
install_main_path install_main_path
#install_header #install_header
...@@ -325,7 +328,7 @@ function install_TDengine() { ...@@ -325,7 +328,7 @@ function install_TDengine() {
echo -e "${GREEN_DARK}To start arbitrator ${NC}: tarbitrator${NC}" echo -e "${GREEN_DARK}To start arbitrator ${NC}: tarbitrator${NC}"
fi fi
echo -e "\033[44;32;1mTDengine's arbitrator is installed successfully!${NC}" echo -e "\033[44;32;1m${productName}'s arbitrator is installed successfully!${NC}"
echo echo
} }
...@@ -333,7 +336,7 @@ function install_TDengine() { ...@@ -333,7 +336,7 @@ function install_TDengine() {
# Install server and client # Install server and client
if [ -x ${bin_dir}/tarbitrator ]; then if [ -x ${bin_dir}/tarbitrator ]; then
update_flag=1 update_flag=1
update_TDengine update_Product
else else
install_TDengine install_Product
fi fi
...@@ -18,22 +18,23 @@ clientName="taos" ...@@ -18,22 +18,23 @@ clientName="taos"
uninstallScript="rmtaos" uninstallScript="rmtaos"
configFile="taos.cfg" configFile="taos.cfg"
tarName="taos.tar.gz" tarName="taos.tar.gz"
demoName="taosdemo"
osType=Linux osType=Linux
pagMode=full pagMode=full
verMode=edge verMode=edge
if [ "$osType" != "Darwin" ]; then if [ "$osType" != "Darwin" ]; then
script_dir=$(dirname $(readlink -f "$0")) script_dir=$(dirname $(readlink -f "$0"))
# Dynamic directory # Dynamic directory
data_dir=${dataDir} data_dir=${dataDir}
log_dir=${logDir} log_dir=${logDir}
else else
script_dir=`dirname $0` script_dir=$(dirname $0)
cd ${script_dir} cd ${script_dir}
script_dir="$(pwd)" script_dir="$(pwd)"
data_dir=${dataDir} data_dir=${dataDir}
log_dir=~/${productName}/log log_dir=~/${productName}/log
fi fi
log_link_dir="${installDir}/log" log_link_dir="${installDir}/log"
...@@ -41,14 +42,14 @@ log_link_dir="${installDir}/log" ...@@ -41,14 +42,14 @@ log_link_dir="${installDir}/log"
cfg_install_dir=${configDir} cfg_install_dir=${configDir}
if [ "$osType" != "Darwin" ]; then if [ "$osType" != "Darwin" ]; then
bin_link_dir="/usr/bin" bin_link_dir="/usr/bin"
lib_link_dir="/usr/lib" lib_link_dir="/usr/lib"
lib64_link_dir="/usr/lib64" lib64_link_dir="/usr/lib64"
inc_link_dir="/usr/include" inc_link_dir="/usr/include"
else else
bin_link_dir="/usr/local/bin" bin_link_dir="/usr/local/bin"
lib_link_dir="/usr/local/lib" lib_link_dir="/usr/local/lib"
inc_link_dir="/usr/local/include" inc_link_dir="/usr/local/include"
fi fi
#install main path #install main path
...@@ -65,8 +66,8 @@ GREEN_UNDERLINE='\033[4;32m' ...@@ -65,8 +66,8 @@ GREEN_UNDERLINE='\033[4;32m'
NC='\033[0m' NC='\033[0m'
csudo="" csudo=""
if command -v sudo > /dev/null; then if command -v sudo >/dev/null; then
csudo="sudo " csudo="sudo "
fi fi
update_flag=0 update_flag=0
...@@ -74,7 +75,7 @@ update_flag=0 ...@@ -74,7 +75,7 @@ update_flag=0
function kill_client() { function kill_client() {
pid=$(ps -ef | grep "${clientName}" | grep -v "grep" | awk '{print $2}') pid=$(ps -ef | grep "${clientName}" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then if [ -n "$pid" ]; then
${csudo}kill -9 $pid || : ${csudo}kill -9 $pid || :
fi fi
} }
...@@ -96,186 +97,184 @@ function install_main_path() { ...@@ -96,186 +97,184 @@ function install_main_path() {
function install_bin() { function install_bin() {
# Remove links # Remove links
${csudo}rm -f ${bin_link_dir}/${clientName} || : ${csudo}rm -f ${bin_link_dir}/${clientName} || :
if [ "$osType" != "Darwin" ]; then if [ "$osType" != "Darwin" ]; then
${csudo}rm -f ${bin_link_dir}/taosdemo || : ${csudo}rm -f ${bin_link_dir}/${demoName} || :
fi fi
${csudo}rm -f ${bin_link_dir}/${uninstallScript} || : ${csudo}rm -f ${bin_link_dir}/${uninstallScript} || :
${csudo}rm -f ${bin_link_dir}/set_core || : ${csudo}rm -f ${bin_link_dir}/set_core || :
${csudo}cp -r ${script_dir}/bin/* ${install_main_dir}/bin && ${csudo}chmod 0555 ${install_main_dir}/bin/* ${csudo}cp -r ${script_dir}/bin/* ${install_main_dir}/bin && ${csudo}chmod 0555 ${install_main_dir}/bin/*
#Make link #Make link
[ -x ${install_main_dir}/bin/${clientName} ] && ${csudo}ln -s ${install_main_dir}/bin/${clientName} ${bin_link_dir}/${clientName} || : [ -x ${install_main_dir}/bin/${clientName} ] && ${csudo}ln -s ${install_main_dir}/bin/${clientName} ${bin_link_dir}/${clientName} || :
if [ "$osType" != "Darwin" ]; then if [ "$osType" != "Darwin" ]; then
[ -x ${install_main_dir}/bin/taosdemo ] && ${csudo}ln -s ${install_main_dir}/bin/taosdemo ${bin_link_dir}/taosdemo || : [ -x ${install_main_dir}/bin/${demoName} ] && ${csudo}ln -s ${install_main_dir}/bin/${demoName} ${bin_link_dir}/${demoName} || :
fi fi
[ -x ${install_main_dir}/bin/remove_client.sh ] && ${csudo}ln -s ${install_main_dir}/bin/remove_client.sh ${bin_link_dir}/${uninstallScript} || : [ -x ${install_main_dir}/bin/remove_client.sh ] && ${csudo}ln -s ${install_main_dir}/bin/remove_client.sh ${bin_link_dir}/${uninstallScript} || :
[ -x ${install_main_dir}/bin/set_core.sh ] && ${csudo}ln -s ${install_main_dir}/bin/set_core.sh ${bin_link_dir}/set_core || : [ -x ${install_main_dir}/bin/set_core.sh ] && ${csudo}ln -s ${install_main_dir}/bin/set_core.sh ${bin_link_dir}/set_core || :
} }
function clean_lib() { function clean_lib() {
sudo rm -f /usr/lib/libtaos.* || : sudo rm -f /usr/lib/libtaos.* || :
sudo rm -rf ${lib_dir} || : sudo rm -rf ${lib_dir} || :
} }
function install_lib() { function install_lib() {
# Remove links # Remove links
${csudo}rm -f ${lib_link_dir}/libtaos.* || : ${csudo}rm -f ${lib_link_dir}/libtaos.* || :
${csudo}rm -f ${lib64_link_dir}/libtaos.* || : ${csudo}rm -f ${lib64_link_dir}/libtaos.* || :
#${csudo}rm -rf ${v15_java_app_dir} || :
${csudo}cp -rf ${script_dir}/driver/* ${install_main_dir}/driver && ${csudo}chmod 777 ${install_main_dir}/driver/* ${csudo}cp -rf ${script_dir}/driver/* ${install_main_dir}/driver && ${csudo}chmod 777 ${install_main_dir}/driver/*
if [ "$osType" != "Darwin" ]; then if [ "$osType" != "Darwin" ]; then
${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.so.1 ${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.so.1
${csudo}ln -s ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so ${csudo}ln -s ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so
if [ -d "${lib64_link_dir}" ]; then if [ -d "${lib64_link_dir}" ]; then
${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib64_link_dir}/libtaos.so.1 || : ${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib64_link_dir}/libtaos.so.1 || :
${csudo}ln -s ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so || : ${csudo}ln -s ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so || :
fi
else
${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.1.dylib
${csudo}ln -s ${lib_link_dir}/libtaos.1.dylib ${lib_link_dir}/libtaos.dylib
fi fi
else
${csudo}ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.1.dylib
${csudo}ln -s ${lib_link_dir}/libtaos.1.dylib ${lib_link_dir}/libtaos.dylib
fi
if [ "$osType" != "Darwin" ]; then if [ "$osType" != "Darwin" ]; then
${csudo}ldconfig ${csudo}ldconfig
else else
${csudo}update_dyld_shared_cache ${csudo}update_dyld_shared_cache
fi fi
} }
function install_header() { function install_header() {
${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h || : ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h || :
${csudo}cp -f ${script_dir}/inc/* ${install_main_dir}/include && ${csudo}chmod 644 ${install_main_dir}/include/* ${csudo}cp -f ${script_dir}/inc/* ${install_main_dir}/include && ${csudo}chmod 644 ${install_main_dir}/include/*
${csudo}ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h ${csudo}ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h
${csudo}ln -s ${install_main_dir}/include/taosdef.h ${inc_link_dir}/taosdef.h ${csudo}ln -s ${install_main_dir}/include/taosdef.h ${inc_link_dir}/taosdef.h
${csudo}ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h ${csudo}ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h
} }
function install_jemalloc() { function install_jemalloc() {
jemalloc_dir=${script_dir}/jemalloc jemalloc_dir=${script_dir}/jemalloc
if [ -d ${jemalloc_dir} ]; then if [ -d ${jemalloc_dir} ]; then
${csudo}/usr/bin/install -c -d /usr/local/bin ${csudo}/usr/bin/install -c -d /usr/local/bin
if [ -f ${jemalloc_dir}/bin/jemalloc-config ]; then if [ -f ${jemalloc_dir}/bin/jemalloc-config ]; then
${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jemalloc-config /usr/local/bin ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jemalloc-config /usr/local/bin
fi fi
if [ -f ${jemalloc_dir}/bin/jemalloc.sh ]; then if [ -f ${jemalloc_dir}/bin/jemalloc.sh ]; then
${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jemalloc.sh /usr/local/bin ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jemalloc.sh /usr/local/bin
fi fi
if [ -f ${jemalloc_dir}/bin/jeprof ]; then if [ -f ${jemalloc_dir}/bin/jeprof ]; then
${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jeprof /usr/local/bin ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jeprof /usr/local/bin
fi fi
if [ -f ${jemalloc_dir}/include/jemalloc/jemalloc.h ]; then if [ -f ${jemalloc_dir}/include/jemalloc/jemalloc.h ]; then
${csudo}/usr/bin/install -c -d /usr/local/include/jemalloc ${csudo}/usr/bin/install -c -d /usr/local/include/jemalloc
${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/include/jemalloc/jemalloc.h /usr/local/include/jemalloc ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/include/jemalloc/jemalloc.h /usr/local/include/jemalloc
fi fi
if [ -f ${jemalloc_dir}/lib/libjemalloc.so.2 ]; then if [ -f ${jemalloc_dir}/lib/libjemalloc.so.2 ]; then
${csudo}/usr/bin/install -c -d /usr/local/lib ${csudo}/usr/bin/install -c -d /usr/local/lib
${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc.so.2 /usr/local/lib ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc.so.2 /usr/local/lib
${csudo}ln -sf libjemalloc.so.2 /usr/local/lib/libjemalloc.so ${csudo}ln -sf libjemalloc.so.2 /usr/local/lib/libjemalloc.so
${csudo}/usr/bin/install -c -d /usr/local/lib ${csudo}/usr/bin/install -c -d /usr/local/lib
if [ -f ${jemalloc_dir}/lib/libjemalloc.a ]; then if [ -f ${jemalloc_dir}/lib/libjemalloc.a ]; then
${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc.a /usr/local/lib ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc.a /usr/local/lib
fi fi
if [ -f ${jemalloc_dir}/lib/libjemalloc_pic.a ]; then if [ -f ${jemalloc_dir}/lib/libjemalloc_pic.a ]; then
${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc_pic.a /usr/local/lib ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc_pic.a /usr/local/lib
fi fi
if [ -f ${jemalloc_dir}/lib/libjemalloc_pic.a ]; then if [ -f ${jemalloc_dir}/lib/libjemalloc_pic.a ]; then
${csudo}/usr/bin/install -c -d /usr/local/lib/pkgconfig ${csudo}/usr/bin/install -c -d /usr/local/lib/pkgconfig
${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/lib/pkgconfig/jemalloc.pc /usr/local/lib/pkgconfig ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/lib/pkgconfig/jemalloc.pc /usr/local/lib/pkgconfig
fi fi
fi
if [ -f ${jemalloc_dir}/share/doc/jemalloc/jemalloc.html ]; then
${csudo}/usr/bin/install -c -d /usr/local/share/doc/jemalloc
${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/share/doc/jemalloc/jemalloc.html /usr/local/share/doc/jemalloc
fi
if [ -f ${jemalloc_dir}/share/man/man3/jemalloc.3 ]; then
${csudo}/usr/bin/install -c -d /usr/local/share/man/man3
${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/share/man/man3/jemalloc.3 /usr/local/share/man/man3
fi
if [ -d /etc/ld.so.conf.d ]; then
echo "/usr/local/lib" | ${csudo}tee /etc/ld.so.conf.d/jemalloc.conf > /dev/null || echo -e "failed to write /etc/ld.so.conf.d/jemalloc.conf"
${csudo}ldconfig
else
echo "/etc/ld.so.conf.d not found!"
fi
fi fi
if [ -f ${jemalloc_dir}/share/doc/jemalloc/jemalloc.html ]; then
${csudo}/usr/bin/install -c -d /usr/local/share/doc/jemalloc
${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/share/doc/jemalloc/jemalloc.html /usr/local/share/doc/jemalloc
fi
if [ -f ${jemalloc_dir}/share/man/man3/jemalloc.3 ]; then
${csudo}/usr/bin/install -c -d /usr/local/share/man/man3
${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/share/man/man3/jemalloc.3 /usr/local/share/man/man3
fi
if [ -d /etc/ld.so.conf.d ]; then
echo "/usr/local/lib" | ${csudo}tee /etc/ld.so.conf.d/jemalloc.conf >/dev/null || echo -e "failed to write /etc/ld.so.conf.d/jemalloc.conf"
${csudo}ldconfig
else
echo "/etc/ld.so.conf.d not found!"
fi
fi
} }
function install_config() { function install_config() {
if [ ! -f ${cfg_install_dir}/${configFile} ]; then if [ ! -f ${cfg_install_dir}/${configFile} ]; then
${csudo}mkdir -p ${cfg_install_dir} ${csudo}mkdir -p ${cfg_install_dir}
[ -f ${script_dir}/cfg/${configFile} ] && ${csudo}cp ${script_dir}/cfg/${configFile} ${cfg_install_dir} [ -f ${script_dir}/cfg/${configFile} ] && ${csudo}cp ${script_dir}/cfg/${configFile} ${cfg_install_dir}
${csudo}chmod 644 ${cfg_install_dir}/* ${csudo}chmod 644 ${cfg_install_dir}/*
fi fi
${csudo}cp -f ${script_dir}/cfg/${configFile} ${install_main_dir}/cfg/${configFile}.org ${csudo}cp -f ${script_dir}/cfg/${configFile} ${install_main_dir}/cfg/${configFile}.org
${csudo}ln -s ${cfg_install_dir}/${configFile} ${install_main_dir}/cfg ${csudo}ln -s ${cfg_install_dir}/${configFile} ${install_main_dir}/cfg
} }
function install_log() { function install_log() {
${csudo}rm -rf ${log_dir} || : ${csudo}rm -rf ${log_dir} || :
if [ "$osType" != "Darwin" ]; then if [ "$osType" != "Darwin" ]; then
${csudo}mkdir -p ${log_dir} && ${csudo}chmod 777 ${log_dir} ${csudo}mkdir -p ${log_dir} && ${csudo}chmod 777 ${log_dir}
else else
mkdir -p ${log_dir} && ${csudo}chmod 777 ${log_dir} mkdir -p ${log_dir} && ${csudo}chmod 777 ${log_dir}
fi fi
${csudo}ln -s ${log_dir} ${install_main_dir}/log ${csudo}ln -s ${log_dir} ${install_main_dir}/log
} }
function install_connector() { function install_connector() {
${csudo}cp -rf ${script_dir}/connector/ ${install_main_dir}/ ${csudo}cp -rf ${script_dir}/connector/ ${install_main_dir}/
} }
function install_examples() { function install_examples() {
if [ -d ${script_dir}/examples ]; then if [ -d ${script_dir}/examples ]; then
${csudo}cp -rf ${script_dir}/examples/* ${install_main_dir}/examples ${csudo}cp -rf ${script_dir}/examples/* ${install_main_dir}/examples
fi fi
} }
function update_TDengine() { function update_Product() {
# Start to update # Start to update
if [ ! -e ${tarName} ]; then if [ ! -e ${tarName} ]; then
echo "File ${tarName} does not exist" echo "File ${tarName} does not exist"
exit 1 exit 1
fi fi
tar -zxf ${tarName} tar -zxf ${tarName}
echo -e "${GREEN}Start to update ${productName} client...${NC}" echo -e "${GREEN}Start to update ${productName} client...${NC}"
# Stop the client shell if running # Stop the client shell if running
if pidof ${clientName} &> /dev/null; then if pidof ${clientName} &>/dev/null; then
kill_client kill_client
sleep 1 sleep 1
fi fi
install_main_path install_main_path
install_log install_log
install_header install_header
install_lib install_lib
install_jemalloc install_jemalloc
if [ "$verMode" == "cluster" ]; then if [ "$verMode" == "cluster" ]; then
install_connector install_connector
fi fi
install_examples install_examples
install_bin install_bin
install_config install_config
echo echo
echo -e "\033[44;32;1m${productName} client is updated successfully!${NC}" echo -e "\033[44;32;1m${productName} client is updated successfully!${NC}"
rm -rf $(tar -tf ${tarName}) rm -rf $(tar -tf ${tarName})
} }
function install_TDengine() { function install_Product() {
# Start to install # Start to install
if [ ! -e ${tarName} ]; then if [ ! -e ${tarName} ]; then
echo "File ${tarName} does not exist" echo "File ${tarName} does not exist"
...@@ -303,18 +302,17 @@ function install_TDengine() { ...@@ -303,18 +302,17 @@ function install_TDengine() {
rm -rf $(tar -tf ${tarName}) rm -rf $(tar -tf ${tarName})
} }
## ==============================Main program starts from here============================ ## ==============================Main program starts from here============================
# Install or updata client and client # Install or updata client and client
# if server is already install, don't install client # if server is already install, don't install client
if [ -e ${bin_dir}/${serverName} ]; then if [ -e ${bin_dir}/${serverName} ]; then
echo -e "\033[44;32;1mThere are already installed ${productName} server, so don't need install client!${NC}" echo -e "\033[44;32;1mThere are already installed ${productName} server, so don't need install client!${NC}"
exit 0 exit 0
fi fi
if [ -x ${bin_dir}/${clientName} ]; then if [ -x ${bin_dir}/${clientName} ]; then
update_flag=1 update_flag=1
update_TDengine update_Product
else else
install_TDengine install_Product
fi fi
...@@ -29,7 +29,11 @@ installDir="/usr/local/taos" ...@@ -29,7 +29,11 @@ installDir="/usr/local/taos"
productName="TDengine" productName="TDengine"
emailName="taosdata.com" emailName="taosdata.com"
uninstallScript="rmtaos" uninstallScript="rmtaos"
adapterName="taosadapter"
demoName="taosdemo"
benchmarkName="taosBenchmark"
# Dynamic directory
if [ "$osType" != "Darwin" ]; then if [ "$osType" != "Darwin" ]; then
data_dir=${dataDir} data_dir=${dataDir}
log_dir=${logDir} log_dir=${logDir}
...@@ -125,14 +129,14 @@ if [ "$osType" != "Darwin" ]; then ...@@ -125,14 +129,14 @@ if [ "$osType" != "Darwin" ]; then
fi fi
fi fi
function kill_taosadapter() { function kill_adapter() {
pid=$(ps -ef | grep "taosadapter" | grep -v "grep" | awk '{print $2}') pid=$(ps -ef | grep "${adapterName}" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then if [ -n "$pid" ]; then
${csudo}kill -9 $pid || : ${csudo}kill -9 $pid || :
fi fi
} }
function kill_taosd() { function kill_server() {
ps -ef | grep ${serverName} ps -ef | grep ${serverName}
pid=$(ps -ef | grep -w ${serverName} | grep -v "grep" | awk '{print $2}') pid=$(ps -ef | grep -w ${serverName} | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then if [ -n "$pid" ]; then
...@@ -168,40 +172,39 @@ function install_bin() { ...@@ -168,40 +172,39 @@ function install_bin() {
# Remove links # Remove links
${csudo}rm -f ${bin_link_dir}/${clientName} || : ${csudo}rm -f ${bin_link_dir}/${clientName} || :
${csudo}rm -f ${bin_link_dir}/${serverName} || : ${csudo}rm -f ${bin_link_dir}/${serverName} || :
${csudo}rm -f ${bin_link_dir}/taosadapter || : ${csudo}rm -f ${bin_link_dir}/${adapterName} || :
${csudo}rm -f ${bin_link_dir}/taosdemo || : ${csudo}rm -f ${bin_link_dir}/${demoName} || :
${csudo}rm -f ${bin_link_dir}/taosdump || :
if [ "$osType" != "Darwin" ]; then if [ "$osType" != "Darwin" ]; then
${csudo}rm -f ${bin_link_dir}/perfMonitor || : ${csudo}rm -f ${bin_link_dir}/perfMonitor || :
${csudo}rm -f ${bin_link_dir}/set_core || : ${csudo}rm -f ${bin_link_dir}/set_core || :
${csudo}rm -f ${bin_link_dir}/run_taosd_and_taosadapter.sh || : ${csudo}rm -f ${bin_link_dir}/run_${serverName}_and_${adapterName}.sh || :
${csudo}rm -f ${bin_link_dir}/${uninstallScript} || : ${csudo}rm -f ${bin_link_dir}/${uninstallScript} || :
${csudo}cp -r ${binary_dir}/build/bin/${clientName} ${install_main_dir}/bin || : ${csudo}cp -r ${binary_dir}/build/bin/${clientName} ${install_main_dir}/bin || :
[ -f ${binary_dir}/build/bin/taosBenchmark ] && ${csudo}cp -r ${binary_dir}/build/bin/taosBenchmark ${install_main_dir}/bin || : [ -f ${binary_dir}/build/bin/${benchmarkName} ] && ${csudo}cp -r ${binary_dir}/build/bin/${benchmarkName} ${install_main_dir}/bin || :
[ -f ${install_main_dir}/bin/taosBenchmark ] && ${csudo}ln -sf ${install_main_dir}/bin/taosBenchmark ${install_main_dir}/bin/taosdemo || : [ -f ${install_main_dir}/bin/${benchmarkName} ] && ${csudo}ln -sf ${install_main_dir}/bin/${benchmarkName} ${install_main_dir}/bin/${demoName} || :
[ -f ${binary_dir}/build/bin/taosdump ] && ${csudo}cp -r ${binary_dir}/build/bin/taosdump ${install_main_dir}/bin || : # [ -f ${binary_dir}/build/bin/taosdump ] && ${csudo}cp -r ${binary_dir}/build/bin/taosdump ${install_main_dir}/bin || :
[ -f ${binary_dir}/build/bin/taosadapter ] && ${csudo}cp -r ${binary_dir}/build/bin/taosadapter ${install_main_dir}/bin || : [ -f ${binary_dir}/build/bin/${adapterName} ] && ${csudo}cp -r ${binary_dir}/build/bin/${adapterName} ${install_main_dir}/bin || :
${csudo}cp -r ${binary_dir}/build/bin/${serverName} ${install_main_dir}/bin || : ${csudo}cp -r ${binary_dir}/build/bin/${serverName} ${install_main_dir}/bin || :
${csudo}cp -r ${binary_dir}/build/bin/tarbitrator ${install_main_dir}/bin || : ${csudo}cp -r ${binary_dir}/build/bin/tarbitrator ${install_main_dir}/bin || :
${csudo}cp -r ${script_dir}/taosd-dump-cfg.gdb ${install_main_dir}/bin ${csudo}cp -r ${script_dir}/taosd-dump-cfg.gdb ${install_main_dir}/bin
${csudo}cp -r ${script_dir}/remove.sh ${install_main_dir}/bin ${csudo}cp -r ${script_dir}/remove.sh ${install_main_dir}/bin
${csudo}cp -r ${script_dir}/set_core.sh ${install_main_dir}/bin ${csudo}cp -r ${script_dir}/set_core.sh ${install_main_dir}/bin
${csudo}cp -r ${script_dir}/run_taosd_and_taosadapter.sh ${install_main_dir}/bin ${csudo}cp -r ${script_dir}/run_${serverName}_and_${adapterName}.sh ${install_main_dir}/bin
${csudo}cp -r ${script_dir}/startPre.sh ${install_main_dir}/bin ${csudo}cp -r ${script_dir}/startPre.sh ${install_main_dir}/bin
${csudo}chmod 0555 ${install_main_dir}/bin/* ${csudo}chmod 0555 ${install_main_dir}/bin/*
#Make link #Make link
[ -x ${install_main_dir}/bin/${clientName} ] && ${csudo}ln -s ${install_main_dir}/bin/${clientName} ${bin_link_dir}/${clientName} || : [ -x ${install_main_dir}/bin/${clientName} ] && ${csudo}ln -s ${install_main_dir}/bin/${clientName} ${bin_link_dir}/${clientName} || :
[ -x ${install_main_dir}/bin/${serverName} ] && ${csudo}ln -s ${install_main_dir}/bin/${serverName} ${bin_link_dir}/${serverName} || : [ -x ${install_main_dir}/bin/${serverName} ] && ${csudo}ln -s ${install_main_dir}/bin/${serverName} ${bin_link_dir}/${serverName} || :
[ -x ${install_main_dir}/bin/taosadapter ] && ${csudo}ln -s ${install_main_dir}/bin/taosadapter ${bin_link_dir}/taosadapter || : [ -x ${install_main_dir}/bin/${adapterName} ] && ${csudo}ln -s ${install_main_dir}/bin/${adapterName} ${bin_link_dir}/${adapterName} || :
[ -x ${install_main_dir}/bin/taosdump ] && ${csudo}ln -s ${install_main_dir}/bin/taosdump ${bin_link_dir}/taosdump || : # [ -x ${install_main_dir}/bin/taosdump ] && ${csudo}ln -s ${install_main_dir}/bin/taosdump ${bin_link_dir}/taosdump || :
[ -x ${install_main_dir}/bin/taosdemo ] && ${csudo}ln -s ${install_main_dir}/bin/taosdemo ${bin_link_dir}/taosdemo || : [ -x ${install_main_dir}/bin/${demoName} ] && ${csudo}ln -s ${install_main_dir}/bin/${demoName} ${bin_link_dir}/${demoName} || :
[ -x ${install_main_dir}/bin/perfMonitor ] && ${csudo}ln -s ${install_main_dir}/bin/perfMonitor ${bin_link_dir}/perfMonitor || : [ -x ${install_main_dir}/bin/perfMonitor ] && ${csudo}ln -s ${install_main_dir}/bin/perfMonitor ${bin_link_dir}/perfMonitor || :
[ -x ${install_main_dir}/set_core.sh ] && ${csudo}ln -s ${install_main_dir}/bin/set_core.sh ${bin_link_dir}/set_core || : [ -x ${install_main_dir}/set_core.sh ] && ${csudo}ln -s ${install_main_dir}/bin/set_core.sh ${bin_link_dir}/set_core || :
[ -x ${install_main_dir}/run_taosd_and_taosadapter.sh ] && ${csudo}ln -s ${install_main_dir}/bin/run_taosd_and_taosadapter.sh ${bin_link_dir}/run_taosd_and_taosadapter.sh || : [ -x ${install_main_dir}/run_${serverName}_and_${adapterName}.sh ] && ${csudo}ln -s ${install_main_dir}/bin/run_${serverName}_and_${adapterName}.sh ${bin_link_dir}/run_${serverName}_and_${adapterName}.sh || :
[ -x ${install_main_dir}/bin/remove.sh ] && ${csudo}ln -s ${install_main_dir}/bin/remove.sh ${bin_link_dir}/${uninstallScript} || : [ -x ${install_main_dir}/bin/remove.sh ] && ${csudo}ln -s ${install_main_dir}/bin/remove.sh ${bin_link_dir}/${uninstallScript} || :
else else
...@@ -212,9 +215,9 @@ function install_bin() { ...@@ -212,9 +215,9 @@ function install_bin() {
#Make link #Make link
[ -x ${install_main_dir}/bin/${clientName} ] || [ -x ${install_main_2_dir}/bin/${clientName} ] && ${csudo}ln -s ${install_main_dir}/bin/${clientName} ${bin_link_dir}/${clientName} || ${csudo}ln -s ${install_main_2_dir}/bin/${clientName} || : [ -x ${install_main_dir}/bin/${clientName} ] || [ -x ${install_main_2_dir}/bin/${clientName} ] && ${csudo}ln -s ${install_main_dir}/bin/${clientName} ${bin_link_dir}/${clientName} || ${csudo}ln -s ${install_main_2_dir}/bin/${clientName} || :
[ -x ${install_main_dir}/bin/${serverName} ] || [ -x ${install_main_2_dir}/bin/${serverName} ] && ${csudo}ln -s ${install_main_dir}/bin/${serverName} ${bin_link_dir}/${serverName} || ${csudo}ln -s ${install_main_2_dir}/bin/${serverName} || : [ -x ${install_main_dir}/bin/${serverName} ] || [ -x ${install_main_2_dir}/bin/${serverName} ] && ${csudo}ln -s ${install_main_dir}/bin/${serverName} ${bin_link_dir}/${serverName} || ${csudo}ln -s ${install_main_2_dir}/bin/${serverName} || :
[ -x ${install_main_dir}/bin/taosadapter ] || [ -x ${install_main_2_dir}/bin/taosadapter ] && ${csudo}ln -s ${install_main_dir}/bin/taosadapter ${bin_link_dir}/taosadapter || ${csudo}ln -s ${install_main_2_dir}/bin/taosadapter || : [ -x ${install_main_dir}/bin/${adapterName} ] || [ -x ${install_main_2_dir}/bin/${adapterName} ] && ${csudo}ln -s ${install_main_dir}/bin/${adapterName} ${bin_link_dir}/${adapterName} || ${csudo}ln -s ${install_main_2_dir}/bin/${adapterName} || :
[ -x ${install_main_dir}/bin/taosdump ] || [ -x ${install_main_2_dir}/bin/taosdump ] && ${csudo}ln -s ${install_main_dir}/bin/taosdump ${bin_link_dir}/taosdump || ln -s ${install_main_2_dir}/bin/taosdump ${bin_link_dir}/taosdump || : # [ -x ${install_main_dir}/bin/taosdump ] || [ -x ${install_main_2_dir}/bin/taosdump ] && ${csudo}ln -s ${install_main_dir}/bin/taosdump ${bin_link_dir}/taosdump || ln -s ${install_main_2_dir}/bin/taosdump ${bin_link_dir}/taosdump || :
[ -x ${install_main_dir}/bin/taosdemo ] || [ -x ${install_main_2_dir}/bin/taosdemo ] && ${csudo}ln -s ${install_main_dir}/bin/taosdemo ${bin_link_dir}/taosdemo || ln -s ${install_main_2_dir}/bin/taosdemo ${bin_link_dir}/taosdemo || : [ -x ${install_main_dir}/bin/${demoName} ] || [ -x ${install_main_2_dir}/bin/${demoName} ] && ${csudo}ln -s ${install_main_dir}/bin/${demoName} ${bin_link_dir}/${demoName} || ln -s ${install_main_2_dir}/bin/${demoName} ${bin_link_dir}/${demoName} || :
fi fi
} }
...@@ -380,23 +383,23 @@ function install_config() { ...@@ -380,23 +383,23 @@ function install_config() {
fi fi
} }
function install_taosadapter_config() { function install_adapter_config() {
if [ ! -f "${cfg_install_dir}/taosadapter.toml" ]; then if [ ! -f "${cfg_install_dir}/${adapterName}.toml" ]; then
${csudo}mkdir -p ${cfg_install_dir} ${csudo}mkdir -p ${cfg_install_dir}
[ -f ${binary_dir}/test/cfg/taosadapter.toml ] && [ -f ${binary_dir}/test/cfg/${adapterName}.toml ] &&
${csudo}cp ${binary_dir}/test/cfg/taosadapter.toml ${cfg_install_dir} ${csudo}cp ${binary_dir}/test/cfg/${adapterName}.toml ${cfg_install_dir}
[ -f ${cfg_install_dir}/taosadapter.toml ] && [ -f ${cfg_install_dir}/${adapterName}.toml ] &&
${csudo}chmod 644 ${cfg_install_dir}/taosadapter.toml ${csudo}chmod 644 ${cfg_install_dir}/${adapterName}.toml
[ -f ${binary_dir}/test/cfg/taosadapter.toml ] && [ -f ${binary_dir}/test/cfg/${adapterName}.toml ] &&
${csudo}cp -f ${binary_dir}/test/cfg/taosadapter.toml \ ${csudo}cp -f ${binary_dir}/test/cfg/${adapterName}.toml \
${cfg_install_dir}/taosadapter.toml.${verNumber} ${cfg_install_dir}/${adapterName}.toml.${verNumber}
[ -f ${cfg_install_dir}/taosadapter.toml ] && [ -f ${cfg_install_dir}/${adapterName}.toml ] &&
${csudo}ln -s ${cfg_install_dir}/taosadapter.toml \ ${csudo}ln -s ${cfg_install_dir}/${adapterName}.toml \
${install_main_dir}/cfg/taosadapter.toml ${install_main_dir}/cfg/${adapterName}.toml
else else
if [ -f "${binary_dir}/test/cfg/taosadapter.toml" ]; then if [ -f "${binary_dir}/test/cfg/${adapterName}.toml" ]; then
${csudo}cp -f ${binary_dir}/test/cfg/taosadapter.toml \ ${csudo}cp -f ${binary_dir}/test/cfg/${adapterName}.toml \
${cfg_install_dir}/taosadapter.toml.${verNumber} ${cfg_install_dir}/${adapterName}.toml.${verNumber}
fi fi
fi fi
} }
...@@ -529,10 +532,10 @@ function install_service_on_systemd() { ...@@ -529,10 +532,10 @@ function install_service_on_systemd() {
${csudo}systemctl enable ${serverName} ${csudo}systemctl enable ${serverName}
} }
function install_taosadapter_service() { function install_adapter_service() {
if ((${service_mod} == 0)); then if ((${service_mod} == 0)); then
[ -f ${binary_dir}/test/cfg/taosadapter.service ] && [ -f ${binary_dir}/test/cfg/${adapterName}.service ] &&
${csudo}cp ${binary_dir}/test/cfg/taosadapter.service \ ${csudo}cp ${binary_dir}/test/cfg/${adapterName}.service \
${service_config_dir}/ || : ${service_config_dir}/ || :
${csudo}systemctl daemon-reload ${csudo}systemctl daemon-reload
fi fi
...@@ -544,11 +547,11 @@ function install_service() { ...@@ -544,11 +547,11 @@ function install_service() {
elif ((${service_mod} == 1)); then elif ((${service_mod} == 1)); then
install_service_on_sysvinit install_service_on_sysvinit
else else
kill_taosd kill_server
fi fi
} }
function update_TDengine() { function update_Product() {
echo -e "${GREEN}Start to update ${productName}...${NC}" echo -e "${GREEN}Start to update ${productName}...${NC}"
# Stop the service if running # Stop the service if running
...@@ -558,8 +561,8 @@ function update_TDengine() { ...@@ -558,8 +561,8 @@ function update_TDengine() {
elif ((${service_mod} == 1)); then elif ((${service_mod} == 1)); then
${csudo}service ${serverName} stop || : ${csudo}service ${serverName} stop || :
else else
kill_taosadapter kill_adapter
kill_taosd kill_server
fi fi
sleep 1 sleep 1
fi fi
...@@ -574,23 +577,23 @@ function update_TDengine() { ...@@ -574,23 +577,23 @@ function update_TDengine() {
install_bin install_bin
install_service install_service
install_taosadapter_service install_adapter_service
install_config install_config
install_taosadapter_config install_adapter_config
echo echo
echo -e "\033[44;32;1m${productName} is updated successfully!${NC}" echo -e "\033[44;32;1m${productName} is updated successfully!${NC}"
echo echo
echo -e "${GREEN_DARK}To configure ${productName} ${NC}: edit ${configDir}/${configFile}" echo -e "${GREEN_DARK}To configure ${productName} ${NC}: edit ${configDir}/${configFile}"
echo -e "${GREEN_DARK}To configure Taos Adapter (if has) ${NC}: edit ${configDir}/taosadapter.toml" echo -e "${GREEN_DARK}To configure ${adapterName} (if has) ${NC}: edit ${configDir}/${adapterName}.toml"
if ((${service_mod} == 0)); then if ((${service_mod} == 0)); then
echo -e "${GREEN_DARK}To start ${productName} ${NC}: ${csudo}systemctl start ${serverName}${NC}" echo -e "${GREEN_DARK}To start ${productName} ${NC}: ${csudo}systemctl start ${serverName}${NC}"
elif ((${service_mod} == 1)); then elif ((${service_mod} == 1)); then
echo -e "${GREEN_DARK}To start ${productName} ${NC}: ${csudo}service ${serverName} start${NC}" echo -e "${GREEN_DARK}To start ${productName} ${NC}: ${csudo}service ${serverName} start${NC}"
else else
echo -e "${GREEN_DARK}To start Taos Adapter (if has)${NC}: taosadapter &${NC}" echo -e "${GREEN_DARK}To start ${adapterName} (if has)${NC}: ${adapterName} &${NC}"
echo -e "${GREEN_DARK}To start ${productName} ${NC}: ${serverName}${NC}" echo -e "${GREEN_DARK}To start ${productName} ${NC}: ${serverName}${NC}"
fi fi
...@@ -599,7 +602,7 @@ function update_TDengine() { ...@@ -599,7 +602,7 @@ function update_TDengine() {
echo -e "\033[44;32;1m${productName} is updated successfully!${NC}" echo -e "\033[44;32;1m${productName} is updated successfully!${NC}"
} }
function install_TDengine() { function install_Product() {
# Start to install # Start to install
echo -e "${GREEN}Start to install ${productName}...${NC}" echo -e "${GREEN}Start to install ${productName}...${NC}"
...@@ -614,23 +617,23 @@ function install_TDengine() { ...@@ -614,23 +617,23 @@ function install_TDengine() {
install_bin install_bin
install_service install_service
install_taosadapter_service install_adapter_service
install_config install_config
install_taosadapter_config install_adapter_config
# Ask if to start the service # Ask if to start the service
echo echo
echo -e "\033[44;32;1m${productName} is installed successfully!${NC}" echo -e "\033[44;32;1m${productName} is installed successfully!${NC}"
echo echo
echo -e "${GREEN_DARK}To configure ${productName} ${NC}: edit ${configDir}/${configFile}" echo -e "${GREEN_DARK}To configure ${productName} ${NC}: edit ${configDir}/${configFile}"
echo -e "${GREEN_DARK}To configure taosadapter (if has) ${NC}: edit ${configDir}/taosadapter.toml" echo -e "${GREEN_DARK}To configure ${adapterName} (if has) ${NC}: edit ${configDir}/${adapterName}.toml"
if ((${service_mod} == 0)); then if ((${service_mod} == 0)); then
echo -e "${GREEN_DARK}To start ${productName} ${NC}: ${csudo}systemctl start ${serverName}${NC}" echo -e "${GREEN_DARK}To start ${productName} ${NC}: ${csudo}systemctl start ${serverName}${NC}"
elif ((${service_mod} == 1)); then elif ((${service_mod} == 1)); then
echo -e "${GREEN_DARK}To start ${productName} ${NC}: ${csudo}service ${serverName} start${NC}" echo -e "${GREEN_DARK}To start ${productName} ${NC}: ${csudo}service ${serverName} start${NC}"
else else
echo -e "${GREEN_DARK}To start Taos Adapter (if has)${NC}: taosadapter &${NC}" echo -e "${GREEN_DARK}To start ${adapterName} (if has)${NC}: ${adapterName} &${NC}"
echo -e "${GREEN_DARK}To start ${productName} ${NC}: ./${serverName}${NC}" echo -e "${GREEN_DARK}To start ${productName} ${NC}: ./${serverName}${NC}"
fi fi
...@@ -644,14 +647,14 @@ echo source directory: $1 ...@@ -644,14 +647,14 @@ echo source directory: $1
echo binary directory: $2 echo binary directory: $2
if [ "$osType" != "Darwin" ]; then if [ "$osType" != "Darwin" ]; then
if [ -x ${bin_dir}/${clientName} ]; then if [ -x ${bin_dir}/${clientName} ]; then
update_TDengine update_Product
else else
install_TDengine install_Product
fi fi
else else
if [ -x ${bin_dir}/${clientName} ] || [ -x ${bin_2_dir}/${clientName} ]; then if [ -x ${bin_dir}/${clientName} ] || [ -x ${bin_2_dir}/${clientName} ]; then
update_TDengine update_Product
else else
install_TDengine install_Product
fi fi
fi fi
...@@ -36,13 +36,11 @@ fi ...@@ -36,13 +36,11 @@ fi
bin_files="${build_dir}/bin/tarbitrator ${script_dir}/remove_arbi.sh" bin_files="${build_dir}/bin/tarbitrator ${script_dir}/remove_arbi.sh"
install_files="${script_dir}/install_arbi.sh" install_files="${script_dir}/install_arbi.sh"
#header_files="${code_dir}/inc/taos.h ${code_dir}/inc/taosdef.h ${code_dir}/inc/taoserror.h"
init_file_tarbitrator_deb=${script_dir}/../deb/tarbitratord init_file_tarbitrator_deb=${script_dir}/../deb/tarbitratord
init_file_tarbitrator_rpm=${script_dir}/../rpm/tarbitratord init_file_tarbitrator_rpm=${script_dir}/../rpm/tarbitratord
# make directories. # make directories.
mkdir -p ${install_dir} && cp ${install_files} ${install_dir} && chmod a+x ${install_dir}/install_arbi.sh || : mkdir -p ${install_dir} && cp ${install_files} ${install_dir} && chmod a+x ${install_dir}/install_arbi.sh || :
#mkdir -p ${install_dir}/inc && cp ${header_files} ${install_dir}/inc || :
mkdir -p ${install_dir}/bin && cp ${bin_files} ${install_dir}/bin && chmod a+x ${install_dir}/bin/* || : mkdir -p ${install_dir}/bin && cp ${bin_files} ${install_dir}/bin && chmod a+x ${install_dir}/bin/* || :
mkdir -p ${install_dir}/init.d && cp ${init_file_tarbitrator_deb} ${install_dir}/init.d/tarbitratord.deb || : mkdir -p ${install_dir}/init.d && cp ${init_file_tarbitrator_deb} ${install_dir}/init.d/tarbitratord.deb || :
mkdir -p ${install_dir}/init.d && cp ${init_file_tarbitrator_rpm} ${install_dir}/init.d/tarbitratord.rpm || : mkdir -p ${install_dir}/init.d && cp ${init_file_tarbitrator_rpm} ${install_dir}/init.d/tarbitratord.rpm || :
......
...@@ -44,7 +44,6 @@ else ...@@ -44,7 +44,6 @@ else
fi fi
# Directories and files. # Directories and files.
if [ "$osType" != "Darwin" ]; then if [ "$osType" != "Darwin" ]; then
if [ "$pagMode" == "lite" ]; then if [ "$pagMode" == "lite" ]; then
strip ${build_dir}/bin/${clientName} strip ${build_dir}/bin/${clientName}
...@@ -182,26 +181,27 @@ if [[ $productName == "TDengine" ]]; then ...@@ -182,26 +181,27 @@ if [[ $productName == "TDengine" ]]; then
fi fi
fi fi
fi fi
# Copy driver # Copy driver
mkdir -p ${install_dir}/driver mkdir -p ${install_dir}/driver
cp ${lib_files} ${install_dir}/driver cp ${lib_files} ${install_dir}/driver
# Copy connector # Copy connector
connector_dir="${code_dir}/connector" #connector_dir="${code_dir}/connector"
mkdir -p ${install_dir}/connector #mkdir -p ${install_dir}/connector
#
if [[ "$pagMode" != "lite" ]] && [[ "$cpuType" != "aarch32" ]]; then #if [[ "$pagMode" != "lite" ]] && [[ "$cpuType" != "aarch32" ]]; then
if [ "$osType" != "Darwin" ]; then # if [ "$osType" != "Darwin" ]; then
cp ${build_dir}/lib/*.jar ${install_dir}/connector || : # cp ${build_dir}/lib/*.jar ${install_dir}/connector || :
fi # fi
if find ${connector_dir}/go -mindepth 1 -maxdepth 1 | read; then # if find ${connector_dir}/go -mindepth 1 -maxdepth 1 | read; then
cp -r ${connector_dir}/go ${install_dir}/connector # cp -r ${connector_dir}/go ${install_dir}/connector
else # else
echo "WARNING: go connector not found, please check if want to use it!" # echo "WARNING: go connector not found, please check if want to use it!"
fi # fi
cp -r ${connector_dir}/python ${install_dir}/connector # cp -r ${connector_dir}/python ${install_dir}/connector
cp -r ${connector_dir}/nodejs ${install_dir}/connector # cp -r ${connector_dir}/nodejs ${install_dir}/connector
fi #fi
# Copy release note # Copy release note
# cp ${script_dir}/release_note ${install_dir} # cp ${script_dir}/release_note ${install_dir}
......
...@@ -16,12 +16,16 @@ serverName="taosd" ...@@ -16,12 +16,16 @@ serverName="taosd"
clientName="taos" clientName="taos"
uninstallScript="rmtaos" uninstallScript="rmtaos"
productName="TDengine" productName="TDengine"
adapterName="taosadapter"
benchmarkName="taosBenchmark"
dumpName="taosdump"
demoName="taosdemo"
#install main path #install main path
install_main_dir=${installDir} install_main_dir=${installDir}
data_link_dir=${installDir}/data data_link_dir="${installDir}/data"
log_link_dir=${installDir}/log log_link_dir="${installDir}/log"
cfg_link_dir=${installDir}/cfg cfg_link_dir="${installDir}/cfg"
bin_link_dir="/usr/bin" bin_link_dir="/usr/bin"
local_bin_link_dir="/usr/local/bin" local_bin_link_dir="/usr/local/bin"
lib_link_dir="/usr/lib" lib_link_dir="/usr/lib"
...@@ -31,7 +35,7 @@ install_nginxd_dir="/usr/local/nginxd" ...@@ -31,7 +35,7 @@ install_nginxd_dir="/usr/local/nginxd"
service_config_dir="/etc/systemd/system" service_config_dir="/etc/systemd/system"
taos_service_name=${serverName} taos_service_name=${serverName}
taosadapter_service_name="taosadapter" taosadapter_service_name=${adapterName}
tarbitrator_service_name="tarbitratord" tarbitrator_service_name="tarbitratord"
nginx_service_name="nginxd" nginx_service_name="nginxd"
csudo="" csudo=""
...@@ -59,22 +63,8 @@ else ...@@ -59,22 +63,8 @@ else
service_mod=2 service_mod=2
fi fi
function kill_taosadapter() { function kill_process() {
pid=$(ps -ef | grep "taosadapter" | grep -v "grep" | awk '{print $2}') pid=$(ps -ef | grep "$1" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then
${csudo}kill -9 $pid || :
fi
}
function kill_taosd() {
pid=$(ps -ef | grep ${serverName} | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then
${csudo}kill -9 $pid || :
fi
}
function kill_tarbitrator() {
pid=$(ps -ef | grep "tarbitrator" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then if [ -n "$pid" ]; then
${csudo}kill -9 $pid || : ${csudo}kill -9 $pid || :
fi fi
...@@ -84,14 +74,14 @@ function clean_bin() { ...@@ -84,14 +74,14 @@ function clean_bin() {
# Remove link # Remove link
${csudo}rm -f ${bin_link_dir}/${clientName} || : ${csudo}rm -f ${bin_link_dir}/${clientName} || :
${csudo}rm -f ${bin_link_dir}/${serverName} || : ${csudo}rm -f ${bin_link_dir}/${serverName} || :
${csudo}rm -f ${bin_link_dir}/taosadapter || : ${csudo}rm -f ${bin_link_dir}/${adapterName} || :
${csudo}rm -f ${bin_link_dir}/taosBenchmark || : ${csudo}rm -f ${bin_link_dir}/${benchmarkName} || :
${csudo}rm -f ${bin_link_dir}/taosdemo || : ${csudo}rm -f ${bin_link_dir}/${demoName} || :
${csudo}rm -f ${bin_link_dir}/taosdump || : ${csudo}rm -f ${bin_link_dir}/${dumpName} || :
${csudo}rm -f ${bin_link_dir}/${uninstallScript} || : ${csudo}rm -f ${bin_link_dir}/${uninstallScript} || :
${csudo}rm -f ${bin_link_dir}/tarbitrator || : ${csudo}rm -f ${bin_link_dir}/tarbitrator || :
${csudo}rm -f ${bin_link_dir}/set_core || : ${csudo}rm -f ${bin_link_dir}/set_core || :
${csudo}rm -f ${bin_link_dir}/run_taosd_and_taosadapter.sh || : ${csudo}rm -f ${bin_link_dir}/run_${serverName}_and_${adapterName}.sh || :
${csudo}rm -f ${bin_link_dir}/TDinsight.sh || : ${csudo}rm -f ${bin_link_dir}/TDinsight.sh || :
} }
...@@ -133,9 +123,9 @@ function clean_service_on_systemd() { ...@@ -133,9 +123,9 @@ function clean_service_on_systemd() {
${csudo}systemctl disable ${taos_service_name} &>/dev/null || echo &>/dev/null ${csudo}systemctl disable ${taos_service_name} &>/dev/null || echo &>/dev/null
${csudo}rm -f ${taosd_service_config} ${csudo}rm -f ${taosd_service_config}
taosadapter_service_config="${service_config_dir}/taosadapter.service" taosadapter_service_config="${service_config_dir}/${adapterName}.service"
if systemctl is-active --quiet ${taosadapter_service_name}; then if systemctl is-active --quiet ${taosadapter_service_name}; then
echo "${productName} taosAdapter is running, stopping it..." echo "${productName} ${adapterName} is running, stopping it..."
${csudo}systemctl stop ${taosadapter_service_name} &>/dev/null || echo &>/dev/null ${csudo}systemctl stop ${taosadapter_service_name} &>/dev/null || echo &>/dev/null
fi fi
${csudo}systemctl disable ${taosadapter_service_name} &>/dev/null || echo &>/dev/null ${csudo}systemctl disable ${taosadapter_service_name} &>/dev/null || echo &>/dev/null
...@@ -210,9 +200,9 @@ function clean_service() { ...@@ -210,9 +200,9 @@ function clean_service() {
elif ((${service_mod} == 1)); then elif ((${service_mod} == 1)); then
clean_service_on_sysvinit clean_service_on_sysvinit
else else
kill_taosadapter kill_process ${adapterName}
kill_taosd kill_process ${serverName}
kill_tarbitrator kill_process "tarbitrator"
fi fi
} }
......
...@@ -23,47 +23,46 @@ lib64_link_dir="/usr/lib64" ...@@ -23,47 +23,46 @@ lib64_link_dir="/usr/lib64"
inc_link_dir="/usr/include" inc_link_dir="/usr/include"
csudo="" csudo=""
if command -v sudo > /dev/null; then if command -v sudo >/dev/null; then
csudo="sudo " csudo="sudo "
fi fi
function kill_client() { function kill_client() {
if [ -n "$(pidof ${clientName})" ]; then if [ -n "$(pidof ${clientName})" ]; then
${csudo}kill -9 $pid || : ${csudo}kill -9 $pid || :
fi fi
} }
function clean_bin() { function clean_bin() {
# Remove link # Remove link
${csudo}rm -f ${bin_link_dir}/${clientName} || : ${csudo}rm -f ${bin_link_dir}/${clientName} || :
${csudo}rm -f ${bin_link_dir}/taosdemo || : ${csudo}rm -f ${bin_link_dir}/taosdemo || :
${csudo}rm -f ${bin_link_dir}/taosdump || : ${csudo}rm -f ${bin_link_dir}/${uninstallScript} || :
${csudo}rm -f ${bin_link_dir}/${uninstallScript} || : ${csudo}rm -f ${bin_link_dir}/set_core || :
${csudo}rm -f ${bin_link_dir}/set_core || :
} }
function clean_lib() { function clean_lib() {
# Remove link # Remove link
${csudo}rm -f ${lib_link_dir}/libtaos.* || : ${csudo}rm -f ${lib_link_dir}/libtaos.* || :
${csudo}rm -f ${lib64_link_dir}/libtaos.* || : ${csudo}rm -f ${lib64_link_dir}/libtaos.* || :
#${csudo}rm -rf ${v15_java_app_dir} || : #${csudo}rm -rf ${v15_java_app_dir} || :
} }
function clean_header() { function clean_header() {
# Remove link # Remove link
${csudo}rm -f ${inc_link_dir}/taos.h || : ${csudo}rm -f ${inc_link_dir}/taos.h || :
${csudo}rm -f ${inc_link_dir}/taosdef.h || : ${csudo}rm -f ${inc_link_dir}/taosdef.h || :
${csudo}rm -f ${inc_link_dir}/taoserror.h || : ${csudo}rm -f ${inc_link_dir}/taoserror.h || :
} }
function clean_config() { function clean_config() {
# Remove link # Remove link
${csudo}rm -f ${cfg_link_dir}/* || : ${csudo}rm -f ${cfg_link_dir}/* || :
} }
function clean_log() { function clean_log() {
# Remove link # Remove link
${csudo}rm -rf ${log_link_dir} || : ${csudo}rm -rf ${log_link_dir} || :
} }
# Stop client. # Stop client.
...@@ -82,4 +81,4 @@ clean_config ...@@ -82,4 +81,4 @@ clean_config
${csudo}rm -rf ${install_main_dir} ${csudo}rm -rf ${install_main_dir}
echo -e "${GREEN}TDengine client is removed successfully!${NC}" echo -e "${GREEN}TDengine client is removed successfully!${NC}"
echo echo
...@@ -17,6 +17,9 @@ ...@@ -17,6 +17,9 @@
#define __SHELL__ #define __SHELL__
#if !(defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)) #if !(defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32))
#include <sys/socket.h> #include <sys/socket.h>
#else
#include <winsock2.h>
#pragma comment(lib,"ws2_32.lib")
#endif #endif
#include "stdbool.h" #include "stdbool.h"
#include "taos.h" #include "taos.h"
...@@ -45,9 +48,11 @@ typedef struct SShellArguments { ...@@ -45,9 +48,11 @@ typedef struct SShellArguments {
char* database; char* database;
char* timezone; char* timezone;
bool restful; bool restful;
char* token; #ifdef WINDOWS
int socket; SOCKET socket;
struct sockaddr_in serv_addr; #else
int socket;
#endif
TAOS* con; TAOS* con;
bool is_raw_time; bool is_raw_time;
bool is_use_passwd; bool is_use_passwd;
...@@ -63,6 +68,11 @@ typedef struct SShellArguments { ...@@ -63,6 +68,11 @@ typedef struct SShellArguments {
int pktNum; int pktNum;
char* pktType; char* pktType;
char* netTestRole; char* netTestRole;
char* cloudDsn;
bool cloud;
char* cloudHost;
char* cloudPort;
char* cloudToken;
} SShellArguments; } SShellArguments;
typedef enum WS_ACTION_TYPE_S { WS_CONN, WS_QUERY, WS_FETCH, WS_FETCH_BLOCK } WS_ACTION_TYPE; typedef enum WS_ACTION_TYPE_S { WS_CONN, WS_QUERY, WS_FETCH, WS_FETCH_BLOCK } WS_ACTION_TYPE;
...@@ -84,9 +94,6 @@ void shellCheck(TAOS* con, SShellArguments* args); ...@@ -84,9 +94,6 @@ void shellCheck(TAOS* con, SShellArguments* args);
void get_history_path(char* history); void get_history_path(char* history);
void shellCheck(TAOS* con, SShellArguments* args); void shellCheck(TAOS* con, SShellArguments* args);
void cleanup_handler(void* arg); void cleanup_handler(void* arg);
int convertHostToServAddr();
char *last_strstr(const char *haystack, const char *needle);
void encode_base_64(char* base64_buf, char* user, char* password);
void exitShell(); void exitShell();
int shellDumpResult(TAOS_RES* con, char* fname, int* error_no, bool printMode); int shellDumpResult(TAOS_RES* con, char* fname, int* error_no, bool printMode);
void shellGetGrantInfo(void* con); void shellGetGrantInfo(void* con);
...@@ -94,6 +101,8 @@ int isCommentLine(char* line); ...@@ -94,6 +101,8 @@ int isCommentLine(char* line);
int wsclient_handshake(); int wsclient_handshake();
int wsclient_conn(); int wsclient_conn();
void wsclient_query(char* command); void wsclient_query(char* command);
int tcpConnect(char* host, int port);
int parse_cloud_dsn();
/**************** Global variable declarations ****************/ /**************** Global variable declarations ****************/
extern char PROMPT_HEADER[]; extern char PROMPT_HEADER[];
......
...@@ -54,13 +54,16 @@ void printHelp() { ...@@ -54,13 +54,16 @@ void printHelp() {
printf("%s%s%s\n", indent, indent, "Script to run without enter the shell."); printf("%s%s%s\n", indent, indent, "Script to run without enter the shell.");
printf("%s%s\n", indent, "-d"); printf("%s%s\n", indent, "-d");
printf("%s%s%s\n", indent, indent, "Database to use when connecting to the server."); printf("%s%s%s\n", indent, indent, "Database to use when connecting to the server.");
printf("%s%s\n", indent, "-t"); printf("%s%s\n", indent, "-z");
printf("%s%s%s\n", indent, indent, "Time zone of the shell, default is local."); printf("%s%s%s\n", indent, indent, "Time zone of the shell, default is local.");
printf("%s%s\n", indent, "-D"); printf("%s%s\n", indent, "-D");
printf("%s%s%s\n", indent, indent, "Use multi-thread to import all SQL files in the directory separately."); printf("%s%s%s\n", indent, indent, "Use multi-thread to import all SQL files in the directory separately.");
printf("%s%s\n", indent, "-T"); printf("%s%s\n", indent, "-T");
printf("%s%s%s\n", indent, indent, "Number of threads when using multi-thread to import data."); printf("%s%s%s\n", indent, indent, "Number of threads when using multi-thread to import data.");
printf("%s%s\n", indent, "-R");
printf("%s%s%s\n", indent, indent, "Connect and interact with TDengine use restful.");
printf("%s%s\n", indent, "-E");
printf("%s%s%s\n", indent, indent, "The DSN to use when connecting TDengine's cloud services.");
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
} }
...@@ -73,12 +76,13 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) { ...@@ -73,12 +76,13 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) {
for (int i = 1; i < argc; i++) { for (int i = 1; i < argc; i++) {
// for host // for host
if (strcmp(argv[i], "-h") == 0) { if (strcmp(argv[i], "-h") == 0) {
if (i < argc - 1) { if (i < argc - 1) {
arguments->host = argv[++i]; arguments->cloud = false;
} else { arguments->host = argv[++i];
fprintf(stderr, "option -h requires an argument\n"); } else {
exit(EXIT_FAILURE); fprintf(stderr, "option -h requires an argument\n");
} exit(EXIT_FAILURE);
}
} }
// for password // for password
else if ((strncmp(argv[i], "-p", 2) == 0) else if ((strncmp(argv[i], "-p", 2) == 0)
...@@ -105,6 +109,7 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) { ...@@ -105,6 +109,7 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) {
// for management port // for management port
else if (strcmp(argv[i], "-P") == 0) { else if (strcmp(argv[i], "-P") == 0) {
if (i < argc - 1) { if (i < argc - 1) {
arguments->cloud = false;
arguments->port = atoi(argv[++i]); arguments->port = atoi(argv[++i]);
} else { } else {
fprintf(stderr, "option -P requires an argument\n"); fprintf(stderr, "option -P requires an argument\n");
...@@ -121,6 +126,7 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) { ...@@ -121,6 +126,7 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) {
} }
} else if (strcmp(argv[i], "-c") == 0) { } else if (strcmp(argv[i], "-c") == 0) {
if (i < argc - 1) { if (i < argc - 1) {
arguments->cloud = false;
if (strlen(argv[++i]) >= TSDB_FILENAME_LEN) { if (strlen(argv[++i]) >= TSDB_FILENAME_LEN) {
fprintf(stderr, "config file path: %s overflow max len %d\n", argv[i], TSDB_FILENAME_LEN - 1); fprintf(stderr, "config file path: %s overflow max len %d\n", argv[i], TSDB_FILENAME_LEN - 1);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
...@@ -159,11 +165,11 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) { ...@@ -159,11 +165,11 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) {
} }
} }
// For time zone // For time zone
else if (strcmp(argv[i], "-t") == 0) { else if (strcmp(argv[i], "-z") == 0) {
if (i < argc - 1) { if (i < argc - 1) {
arguments->timezone = argv[++i]; arguments->timezone = argv[++i];
} else { } else {
fprintf(stderr, "option -t requires an argument\n"); fprintf(stderr, "option -z requires an argument\n");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
...@@ -190,6 +196,21 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) { ...@@ -190,6 +196,21 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) {
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
else if (strcmp(argv[i], "-R") == 0) {
arguments->cloud = false;
arguments->restful = true;
}
else if (strcmp(argv[i], "-E") == 0) {
if (i < argc - 1) {
arguments->cloudDsn = argv[++i];
} else {
fprintf(stderr, "options -E requires an argument\n");
exit(EXIT_FAILURE);
}
}
// For temperory command TODO // For temperory command TODO
else if (strcmp(argv[i], "--help") == 0) { else if (strcmp(argv[i], "--help") == 0) {
printHelp(); printHelp();
...@@ -200,6 +221,16 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) { ...@@ -200,6 +221,16 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) {
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
if (args.cloudDsn == NULL) {
if (args.cloud) {
args.cloudDsn = getenv("TDENGINE_CLOUD_DSN");
if (args.cloudDsn == NULL) {
args.cloud = false;
}
}
} else {
args.cloud = true;
}
} }
int32_t shellReadCommand(TAOS *con, char *command) { int32_t shellReadCommand(TAOS *con, char *command) {
...@@ -547,3 +578,37 @@ void exitShell() { ...@@ -547,3 +578,37 @@ void exitShell() {
tcsetattr(0, TCSANOW, &oldtio); tcsetattr(0, TCSANOW, &oldtio);
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
} }
int tcpConnect(char* host, int port) {
struct sockaddr_in serv_addr;
if (port == 0) {
port = 6041;
args.port = 6041;
}
if (NULL == host) {
host = "localhost";
args.host = "localhost";
}
struct hostent *server = gethostbyname(host);
if ((server == NULL) || (server->h_addr == NULL)) {
fprintf(stderr, "no such host: %s\n", host);
return -1;
}
memset(&serv_addr, 0, sizeof(struct sockaddr_in));
serv_addr.sin_family = AF_INET;
serv_addr.sin_port = htons(port);
memcpy(&(serv_addr.sin_addr.s_addr), server->h_addr, server->h_length);
args.socket = socket(AF_INET, SOCK_STREAM, 0);
if (args.socket < 0) {
fprintf(stderr, "failed to create socket\n");
return -1;
}
int retConn = connect(args.socket, (struct sockaddr *)&serv_addr, sizeof(struct sockaddr));
if (retConn < 0) {
fprintf(stderr, "failed to connect\n");
close(args.socket);
return -1;
}
return 0;
}
\ No newline at end of file
...@@ -72,19 +72,7 @@ void shellInit(SShellArguments *_args) { ...@@ -72,19 +72,7 @@ void shellInit(SShellArguments *_args) {
_args->user = TSDB_DEFAULT_USER; _args->user = TSDB_DEFAULT_USER;
} }
if (_args->restful) { if (_args->restful || _args->cloud) {
_args->database = calloc(1, 128);
_args->socket = socket(AF_INET, SOCK_STREAM, 0);
if (_args->socket < 0) {
fprintf(stderr, "failed to create socket\n");
exit(EXIT_FAILURE);
}
int retConn = connect(_args->socket, (struct sockaddr *)&(_args->serv_addr), sizeof(struct sockaddr));
if (retConn < 0) {
fprintf(stderr, "failed to connect\n");
close(_args->socket);
exit(EXIT_FAILURE);
}
if (wsclient_handshake()) { if (wsclient_handshake()) {
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
...@@ -170,7 +158,7 @@ static int32_t shellRunSingleCommand(TAOS *con, char *command) { ...@@ -170,7 +158,7 @@ static int32_t shellRunSingleCommand(TAOS *con, char *command) {
// Analyse the command. // Analyse the command.
if (regex_match(command, "^[ \t]*(quit|q|exit)[ \t;]*$", REG_EXTENDED | REG_ICASE)) { if (regex_match(command, "^[ \t]*(quit|q|exit)[ \t;]*$", REG_EXTENDED | REG_ICASE)) {
if (args.restful) { if (args.restful || args.cloud) {
close(args.socket); close(args.socket);
} else { } else {
taos_close(con); taos_close(con);
...@@ -320,7 +308,7 @@ void shellRunCommandOnServer(TAOS *con, char command[]) { ...@@ -320,7 +308,7 @@ void shellRunCommandOnServer(TAOS *con, char command[]) {
printMode = true; // When output to a file, the switch does not work. printMode = true; // When output to a file, the switch does not work.
} }
if (args.restful) { if (args.restful || args.cloud) {
wsclient_query(command); wsclient_query(command);
return; return;
} }
...@@ -1164,42 +1152,39 @@ int taos_base64_encode(unsigned char *source, size_t sourcelen, char *target, si ...@@ -1164,42 +1152,39 @@ int taos_base64_encode(unsigned char *source, size_t sourcelen, char *target, si
return 1; return 1;
} }
char *last_strstr(const char *haystack, const char *needle) { int parse_cloud_dsn() {
if (*needle == '\0') if (args.cloudDsn == NULL) {
return (char *) haystack; fprintf(stderr, "Cannot read cloud service info\n");
return 1;
char *res = NULL; } else {
for (;;) { char *start = strstr(args.cloudDsn, "http://");
char *p = strstr(haystack, needle); if (start != NULL) {
if (p == NULL) break; args.cloudHost = start + strlen("http://");
res = p; } else {
haystack = p + 1; start = strstr(args.cloudDsn, "https://");
if (start != NULL) {
args.cloudHost = start + strlen("https://");
} else {
args.cloudHost = args.cloudDsn;
}
}
char *port = strstr(args.cloudHost, ":");
if ((port == NULL) || (port + strlen(":")) == NULL) {
fprintf(stderr, "Invalid format in TDengine cloud dsn: %s\n", args.cloudDsn);
return 1;
}
char *token = strstr(port + strlen(":"), "?token=");
if ((token == NULL) || (token + strlen("?token=")) == NULL ||
(strlen(token + strlen("?token=")) == 0)) {
fprintf(stderr, "Invalid format in TDengine cloud dsn: %s\n", args.cloudDsn);
return -1;
}
port[0] = '\0';
args.cloudPort = port + strlen(":");
token[0] = '\0';
args.cloudToken = token + strlen("?token=");
} }
return res; return 0;
}
int convertHostToServAddr() {
if (args.port == 0) {
args.port = 6041;
}
if (NULL == args.host) {
args.host = "127.0.0.1";
}
struct hostent *server = gethostbyname(args.host);
if ((server == NULL) || (server->h_addr == NULL)) {
fprintf(stderr, "no such host: %s\n", args.host);
return -1;
}
memset(&(args.serv_addr), 0, sizeof(struct sockaddr_in));
args.serv_addr.sin_family = AF_INET;
args.serv_addr.sin_port = htons(args.port);
#ifdef WINDOWS
args.serv_addr.sin_addr.s_addr = inet_addr(args.host);
#else
memcpy(&(args.serv_addr.sin_addr.s_addr), server->h_addr, server->h_length);
#endif
return 0;
} }
int wsclient_handshake() { int wsclient_handshake() {
...@@ -1215,12 +1200,12 @@ int wsclient_handshake() { ...@@ -1215,12 +1200,12 @@ int wsclient_handshake() {
key_nonce[i] = rand() & 0xff; key_nonce[i] = rand() & 0xff;
} }
taos_base64_encode(key_nonce, 16, websocket_key, 256); taos_base64_encode(key_nonce, 16, websocket_key, 256);
if (args.token) { if (args.cloud) {
snprintf(request_header, 1024, snprintf(request_header, 1024,
"GET /rest/ws?token=%s HTTP/1.1\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nHost: " "GET /rest/ws?token=%s HTTP/1.1\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nHost: "
"%s:%d\r\nSec-WebSocket-Key: " "%s:%s\r\nSec-WebSocket-Key: "
"%s\r\nSec-WebSocket-Version: 13\r\n\r\n", "%s\r\nSec-WebSocket-Version: 13\r\n\r\n",
args.token, args.host, args.port, websocket_key); args.cloudToken, args.cloudHost, args.cloudPort, websocket_key);
} else { } else {
snprintf(request_header, 1024, snprintf(request_header, 1024,
"GET /rest/ws HTTP/1.1\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nHost: %s:%d\r\nSec-WebSocket-Key: " "GET /rest/ws HTTP/1.1\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nHost: %s:%d\r\nSec-WebSocket-Key: "
...@@ -1229,8 +1214,12 @@ int wsclient_handshake() { ...@@ -1229,8 +1214,12 @@ int wsclient_handshake() {
} }
ssize_t n = send(args.socket, request_header, strlen(request_header), 0); ssize_t n = send(args.socket, request_header, strlen(request_header), 0);
if (n == 0) { if (n <= 0) {
fprintf(stderr, "web socket handshake error\n"); #ifdef WINDOWS
fprintf(stderr, "send failed with error: %d\n", WSAGetLastError());
#else
fprintf(stderr, "web socket handshake error\n");
#endif
return -1; return -1;
} }
n = recv(args.socket, recv_buf, 1023, 0); n = recv(args.socket, recv_buf, 1023, 0);
...@@ -1317,9 +1306,9 @@ int wsclient_send_sql(char *command, WS_ACTION_TYPE type, int id) { ...@@ -1317,9 +1306,9 @@ int wsclient_send_sql(char *command, WS_ACTION_TYPE type, int id) {
switch (type) { switch (type) {
case WS_CONN: case WS_CONN:
cJSON_AddStringToObject(json, "action", "conn"); cJSON_AddStringToObject(json, "action", "conn");
cJSON_AddStringToObject(_args, "user", "root"); cJSON_AddStringToObject(_args, "user", args.user);
cJSON_AddStringToObject(_args, "password", "taosdata"); cJSON_AddStringToObject(_args, "password", args.password);
cJSON_AddStringToObject(_args, "db", ""); cJSON_AddStringToObject(_args, "db", args.database);
break; break;
case WS_QUERY: case WS_QUERY:
...@@ -1372,6 +1361,12 @@ int wsclient_conn() { ...@@ -1372,6 +1361,12 @@ int wsclient_conn() {
} }
if (code->valueint == 0) { if (code->valueint == 0) {
cJSON_Delete(root); cJSON_Delete(root);
if (args.cloud) {
fprintf(stdout, "Successfully connect to %s:%s in restful mode\n\n", args.cloudHost, args.cloudPort);
} else {
fprintf(stdout, "Successfully connect to %s:%d in restful mode\n\n", args.host, args.port);
}
return 0; return 0;
} else { } else {
cJSON *message = cJSON_GetObjectItem(root, "message"); cJSON *message = cJSON_GetObjectItem(root, "message");
...@@ -1637,4 +1632,4 @@ void wsclient_query(char *command) { ...@@ -1637,4 +1632,4 @@ void wsclient_query(char *command) {
} }
cJSON_Delete(query); cJSON_Delete(query);
return; return;
} }
\ No newline at end of file
...@@ -53,8 +53,8 @@ static struct argp_option options[] = { ...@@ -53,8 +53,8 @@ static struct argp_option options[] = {
{"pktlen", 'l', "PKTLEN", 0, "Packet length used for net test, default is 1000 bytes."}, {"pktlen", 'l', "PKTLEN", 0, "Packet length used for net test, default is 1000 bytes."},
{"pktnum", 'N', "PKTNUM", 0, "Packet numbers used for net test, default is 100."}, {"pktnum", 'N', "PKTNUM", 0, "Packet numbers used for net test, default is 100."},
{"pkttype", 'S', "PKTTYPE", 0, "Choose packet type used for net test, default is TCP. Only speed test could be either TCP or UDP."}, {"pkttype", 'S', "PKTTYPE", 0, "Choose packet type used for net test, default is TCP. Only speed test could be either TCP or UDP."},
{"restful", 'R', 0, 0, "Connect and interact with TDengine use restful"}, {"restful", 'R', 0, 0, "Connect and interact with TDengine use restful."},
{"token", 't', "TOKEN", 0, "The token to use when connecting TDengine's cloud services"}, {0, 'E', "DSN", 0, "The DSN to use when connecting TDengine's cloud services."},
{0}}; {0}};
static error_t parse_opt(int key, char *arg, struct argp_state *state) { static error_t parse_opt(int key, char *arg, struct argp_state *state) {
...@@ -64,21 +64,20 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) { ...@@ -64,21 +64,20 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) {
wordexp_t full_path; wordexp_t full_path;
switch (key) { switch (key) {
case 'h':{ case 'h':
char* tmp = strstr(arg, ":"); if (arg) {
if (tmp == NULL) { args.cloud = false;
arguments->host = arg; args.host = arg;
} else if ((tmp + 1) != NULL) { } else {
arguments->port = atoi(tmp + 1); fprintf(stderr, "Invalid host\n");
tmp[0] = '\0'; return -1;
arguments->host = arg; }
} break;
break;
}
case 'p': case 'p':
break; break;
case 'P': case 'P':
if (arg) { if (arg) {
args.cloud = false;
tsDnodeShellPort = atoi(arg); tsDnodeShellPort = atoi(arg);
p_port = atoi(arg); p_port = atoi(arg);
} else { } else {
...@@ -106,6 +105,7 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) { ...@@ -106,6 +105,7 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) {
wordfree(&full_path); wordfree(&full_path);
return -1; return -1;
} }
args.cloud = false;
tstrncpy(configDir, full_path.we_wordv[0], TSDB_FILENAME_LEN); tstrncpy(configDir, full_path.we_wordv[0], TSDB_FILENAME_LEN);
wordfree(&full_path); wordfree(&full_path);
break; break;
...@@ -173,11 +173,17 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) { ...@@ -173,11 +173,17 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) {
case OPT_ABORT: case OPT_ABORT:
arguments->abort = 1; arguments->abort = 1;
break; break;
case 't':
arguments->token = arg;
break;
case 'R': case 'R':
arguments->restful = true; arguments->restful = true;
arguments->cloud = false;
break;
case 'E':
if (arg) {
arguments->cloudDsn = arg;
} else {
fprintf(stderr, "Invalid -E option\n");
return -1;
}
break; break;
default: default:
return ARGP_ERR_UNKNOWN; return ARGP_ERR_UNKNOWN;
...@@ -231,8 +237,16 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) { ...@@ -231,8 +237,16 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) {
} }
argp_parse(&argp, argc, argv, 0, 0, arguments); argp_parse(&argp, argc, argv, 0, 0, arguments);
if (arguments->token == NULL) {
arguments->port = p_port; if (args.cloudDsn == NULL) {
if (args.cloud) {
args.cloudDsn = getenv("TDENGINE_CLOUD_DSN");
if (args.cloudDsn == NULL) {
args.cloud = false;
}
}
} else {
args.cloud = true;
} }
if (arguments->abort) { if (arguments->abort) {
...@@ -594,3 +608,37 @@ void exitShell() { ...@@ -594,3 +608,37 @@ void exitShell() {
taos_cleanup(); taos_cleanup();
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
} }
int tcpConnect(char* host, int port) {
struct sockaddr_in serv_addr;
if (port == 0) {
port = 6041;
args.port = 6041;
}
if (NULL == host) {
host = "localhost";
args.host = "localhost";
}
struct hostent *server = gethostbyname(host);
if ((server == NULL) || (server->h_addr == NULL)) {
fprintf(stderr, "no such host: %s\n", host);
return -1;
}
memset(&serv_addr, 0, sizeof(struct sockaddr_in));
serv_addr.sin_family = AF_INET;
serv_addr.sin_port = htons(port);
memcpy(&(serv_addr.sin_addr.s_addr), server->h_addr, server->h_length);
args.socket = socket(AF_INET, SOCK_STREAM, 0);
if (args.socket < 0) {
fprintf(stderr, "failed to create socket\n");
return -1;
}
int retConn = connect(args.socket, (struct sockaddr *)&serv_addr, sizeof(struct sockaddr));
if (retConn < 0) {
fprintf(stderr, "failed to connect\n");
close(args.socket);
return -1;
}
return 0;
}
...@@ -76,7 +76,6 @@ SShellArguments args = {.host = NULL, ...@@ -76,7 +76,6 @@ SShellArguments args = {.host = NULL,
.database = NULL, .database = NULL,
.timezone = NULL, .timezone = NULL,
.restful = false, .restful = false,
.token = NULL,
.is_raw_time = false, .is_raw_time = false,
.is_use_passwd = false, .is_use_passwd = false,
.dump_config = false, .dump_config = false,
...@@ -87,7 +86,12 @@ SShellArguments args = {.host = NULL, ...@@ -87,7 +86,12 @@ SShellArguments args = {.host = NULL,
.pktLen = 1000, .pktLen = 1000,
.pktNum = 100, .pktNum = 100,
.pktType = "TCP", .pktType = "TCP",
.netTestRole = NULL}; .netTestRole = NULL,
.cloud = true,
.cloudHost = NULL,
.cloudPort = NULL,
.cloudToken = NULL,
};
/* /*
* Main function. * Main function.
...@@ -102,35 +106,6 @@ int main(int argc, char* argv[]) { ...@@ -102,35 +106,6 @@ int main(int argc, char* argv[]) {
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
char* cloud_url = getenv("TDENGINE_CLOUD_URL");
if (cloud_url != NULL) {
char* start = strstr(cloud_url, "http://");
if (start != NULL) {
cloud_url = start + strlen("http://");
} else {
start = strstr(cloud_url, "https://");
if (start != NULL) {
cloud_url = start + strlen("https://");
}
}
char* tmp = last_strstr(cloud_url, ":");
if ((tmp == NULL) && ((tmp + 1) != NULL )) {
fprintf(stderr, "Invalid format in environment variable TDENGINE_CLOUD_URL: %s\n", cloud_url);
exit(EXIT_FAILURE);
} else {
args.port = atoi(tmp + 1);
tmp[0] = '\0';
args.host = cloud_url;
}
}
char* cloud_token = getenv("TDENGINE_CLOUD_TOKEN");
if (cloud_token != NULL) {
args.token = cloud_token;
}
shellParseArgument(argc, argv, &args); shellParseArgument(argc, argv, &args);
if (args.dump_config) { if (args.dump_config) {
...@@ -155,10 +130,17 @@ int main(int argc, char* argv[]) { ...@@ -155,10 +130,17 @@ int main(int argc, char* argv[]) {
exit(0); exit(0);
} }
if (args.restful) { if (args.cloud) {
if (convertHostToServAddr()) { if (parse_cloud_dsn()) {
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
if (tcpConnect(args.cloudHost, atoi(args.cloudPort))) {
exit(EXIT_FAILURE);
}
} else if (args.restful) {
if (tcpConnect(args.host, args.port)) {
exit(EXIT_FAILURE);
}
} }
/* Initialize the shell */ /* Initialize the shell */
......
...@@ -54,7 +54,7 @@ void printHelp() { ...@@ -54,7 +54,7 @@ void printHelp() {
printf("%s%s%s\n", indent, indent, "Script to run without enter the shell."); printf("%s%s%s\n", indent, indent, "Script to run without enter the shell.");
printf("%s%s\n", indent, "-d"); printf("%s%s\n", indent, "-d");
printf("%s%s%s\n", indent, indent, "Database to use when connecting to the server."); printf("%s%s%s\n", indent, indent, "Database to use when connecting to the server.");
printf("%s%s\n", indent, "-t"); printf("%s%s\n", indent, "-z");
printf("%s%s%s\n", indent, indent, "Time zone of the shell, default is local."); printf("%s%s%s\n", indent, indent, "Time zone of the shell, default is local.");
printf("%s%s\n", indent, "-n"); printf("%s%s\n", indent, "-n");
printf("%s%s%s\n", indent, indent, "Net role when network connectivity test, default is startup, options: client|server|rpc|startup|sync|speed|fqdn."); printf("%s%s%s\n", indent, indent, "Net role when network connectivity test, default is startup, options: client|server|rpc|startup|sync|speed|fqdn.");
...@@ -62,11 +62,14 @@ void printHelp() { ...@@ -62,11 +62,14 @@ void printHelp() {
printf("%s%s%s\n", indent, indent, "Packet length used for net test, default is 1000 bytes."); printf("%s%s%s\n", indent, indent, "Packet length used for net test, default is 1000 bytes.");
printf("%s%s\n", indent, "-N"); printf("%s%s\n", indent, "-N");
printf("%s%s%s\n", indent, indent, "Packet numbers used for net test, default is 100."); printf("%s%s%s\n", indent, indent, "Packet numbers used for net test, default is 100.");
printf("%s%s\n", indent, "-R");
printf("%s%s%s\n", indent, indent, "Connect and interact with TDengine use restful.");
printf("%s%s\n", indent, "-E");
printf("%s%s%s\n", indent, indent, "The DSN to use when connecting TDengine's cloud services.");
printf("%s%s\n", indent, "-S"); printf("%s%s\n", indent, "-S");
printf("%s%s%s\n", indent, indent, "Packet type used for net test, default is TCP."); printf("%s%s%s\n", indent, indent, "Packet type used for net test, default is TCP.");
printf("%s%s\n", indent, "-V"); printf("%s%s\n", indent, "-V");
printf("%s%s%s\n", indent, indent, "Print program version."); printf("%s%s%s\n", indent, indent, "Print program version.");
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
} }
...@@ -77,7 +80,8 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) { ...@@ -77,7 +80,8 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) {
// for host // for host
if (strcmp(argv[i], "-h") == 0) { if (strcmp(argv[i], "-h") == 0) {
if (i < argc - 1) { if (i < argc - 1) {
arguments->host = argv[++i]; arguments->cloud = false;
arguments->host = argv[++i];
} else { } else {
fprintf(stderr, "option -h requires an argument\n"); fprintf(stderr, "option -h requires an argument\n");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
...@@ -108,6 +112,7 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) { ...@@ -108,6 +112,7 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) {
// for management port // for management port
else if (strcmp(argv[i], "-P") == 0) { else if (strcmp(argv[i], "-P") == 0) {
if (i < argc - 1) { if (i < argc - 1) {
arguments->cloud = false;
arguments->port = atoi(argv[++i]); arguments->port = atoi(argv[++i]);
} else { } else {
fprintf(stderr, "option -P requires an argument\n"); fprintf(stderr, "option -P requires an argument\n");
...@@ -131,6 +136,7 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) { ...@@ -131,6 +136,7 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) {
} }
} else if (strcmp(argv[i], "-c") == 0) { } else if (strcmp(argv[i], "-c") == 0) {
if (i < argc - 1) { if (i < argc - 1) {
arguments->cloud = false;
char *tmp = argv[++i]; char *tmp = argv[++i];
if (strlen(tmp) >= TSDB_FILENAME_LEN) { if (strlen(tmp) >= TSDB_FILENAME_LEN) {
fprintf(stderr, "config file path: %s overflow max len %d\n", tmp, TSDB_FILENAME_LEN - 1); fprintf(stderr, "config file path: %s overflow max len %d\n", tmp, TSDB_FILENAME_LEN - 1);
...@@ -172,11 +178,11 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) { ...@@ -172,11 +178,11 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) {
} }
} }
// For time zone // For time zone
else if (strcmp(argv[i], "-t") == 0) { else if (strcmp(argv[i], "-z") == 0) {
if (i < argc - 1) { if (i < argc - 1) {
arguments->timezone = argv[++i]; arguments->timezone = argv[++i];
} else { } else {
fprintf(stderr, "option -t requires an argument\n"); fprintf(stderr, "option -z requires an argument\n");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
...@@ -212,6 +218,21 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) { ...@@ -212,6 +218,21 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) {
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
else if (strcmp(argv[i], "-R") == 0) {
arguments->cloud = false;
arguments->restful = true;
}
else if (strcmp(argv[i], "-E") == 0) {
if (i < argc - 1) {
arguments->cloudDsn = argv[++i];
} else {
fprintf(stderr, "options -E requires an argument\n");
exit(EXIT_FAILURE);
}
}
else if (strcmp(argv[i], "-V") == 0) { else if (strcmp(argv[i], "-V") == 0) {
printVersion(); printVersion();
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
...@@ -226,6 +247,16 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) { ...@@ -226,6 +247,16 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) {
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
if (args.cloudDsn == NULL) {
if (args.cloud) {
args.cloudDsn = getenv("TDENGINE_CLOUD_DSN");
if (args.cloudDsn == NULL) {
args.cloud = false;
}
}
} else {
args.cloud = true;
}
} }
void shellPrintContinuePrompt() { printf("%s", CONTINUE_PROMPT); } void shellPrintContinuePrompt() { printf("%s", CONTINUE_PROMPT); }
...@@ -337,3 +368,64 @@ void get_history_path(char *history) { ...@@ -337,3 +368,64 @@ void get_history_path(char *history) {
} }
void exitShell() { exit(EXIT_SUCCESS); } void exitShell() { exit(EXIT_SUCCESS); }
int tcpConnect(char* host, int iport) {
int iResult;
WSADATA wsaData;
struct addrinfo *aResult = NULL,
*ptr = NULL,
hints;
if (iport == 0) {
iport = 6041;
args.port = iport;
}
if (NULL == host) {
host = "localhost";
args.host = "localhost";
}
char port[10] = {0};
sprintf_s(port, 10, "%d", iport);
iResult = WSAStartup(MAKEWORD(2,2), &wsaData);
if (iResult != 0) {
printf("WSAStartup failed with error: %d\n", iResult);
return 1;
}
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = IPPROTO_TCP;
iResult = getaddrinfo(host, port, &hints, &aResult);
if ( iResult != 0 ) {
printf("getaddrinfo failed with error: %d\n", iResult);
WSACleanup();
return 1;
}
for(ptr=aResult; ptr != NULL ; ptr=ptr->ai_next) {
// Create a SOCKET for connecting to server
args.socket = socket(ptr->ai_family, ptr->ai_socktype,
ptr->ai_protocol);
if (args.socket == INVALID_SOCKET) {
printf("socket failed with error: %ld\n", WSAGetLastError());
WSACleanup();
return 1;
}
// Connect to server.
iResult = connect( args.socket, ptr->ai_addr, (int)ptr->ai_addrlen);
if (iResult == SOCKET_ERROR) {
closesocket(args.socket);
args.socket = INVALID_SOCKET;
continue;
}
break;
}
if (args.socket == INVALID_SOCKET) {
printf("Unable to connect to server!\n");
WSACleanup();
return 1;
}
return 0;
}
\ No newline at end of file
Subproject commit 3d5aa76f8c718dcffa100b45e4cbf313d499c356 Subproject commit 0a81480420d6601bbdb57770ee64e40f24c4ea83
...@@ -3347,6 +3347,12 @@ static void col_project_function(SQLFunctionCtx *pCtx) { ...@@ -3347,6 +3347,12 @@ static void col_project_function(SQLFunctionCtx *pCtx) {
memcpy(pCtx->pOutput, pData, (size_t) numOfRows * pCtx->inputBytes); memcpy(pCtx->pOutput, pData, (size_t) numOfRows * pCtx->inputBytes);
} else { } else {
// DESC // DESC
if (pCtx->param[0].i64 == 1) {
// only output one row, copy first row to output
memcpy(pCtx->pOutput, pData, (size_t)pCtx->inputBytes);
return ;
}
for(int32_t i = 0; i < pCtx->size; ++i) { for(int32_t i = 0; i < pCtx->size; ++i) {
char* dst = pCtx->pOutput + (pCtx->size - 1 - i) * pCtx->inputBytes; char* dst = pCtx->pOutput + (pCtx->size - 1 - i) * pCtx->inputBytes;
char* src = pData + i * pCtx->inputBytes; char* src = pData + i * pCtx->inputBytes;
......
...@@ -1713,7 +1713,8 @@ static void doHashGroupbyAgg(SOperatorInfo* pOperator, SGroupbyOperatorInfo *pIn ...@@ -1713,7 +1713,8 @@ static void doHashGroupbyAgg(SOperatorInfo* pOperator, SGroupbyOperatorInfo *pIn
longjmp(pRuntimeEnv->env, TSDB_CODE_QRY_APP_ERROR); longjmp(pRuntimeEnv->env, TSDB_CODE_QRY_APP_ERROR);
} }
doApplyFunctions(pRuntimeEnv, pInfo->binfo.pCtx, &w, j - num, num, tsList, pSDataBlock->info.rows, pOperator->numOfOutput); int32_t offset = QUERY_IS_ASC_QUERY(pQueryAttr) ? j - num : j - 1;
doApplyFunctions(pRuntimeEnv, pInfo->binfo.pCtx, &w, offset, num, tsList, pSDataBlock->info.rows, pOperator->numOfOutput);
num = 1; num = 1;
...@@ -1733,7 +1734,8 @@ static void doHashGroupbyAgg(SOperatorInfo* pOperator, SGroupbyOperatorInfo *pIn ...@@ -1733,7 +1734,8 @@ static void doHashGroupbyAgg(SOperatorInfo* pOperator, SGroupbyOperatorInfo *pIn
if (ret != TSDB_CODE_SUCCESS) { // null data, too many state code if (ret != TSDB_CODE_SUCCESS) { // null data, too many state code
longjmp(pRuntimeEnv->env, TSDB_CODE_QRY_APP_ERROR); longjmp(pRuntimeEnv->env, TSDB_CODE_QRY_APP_ERROR);
} }
doApplyFunctions(pRuntimeEnv, pInfo->binfo.pCtx, &w, pSDataBlock->info.rows - num, num, tsList, pSDataBlock->info.rows, pOperator->numOfOutput); int32_t offset = QUERY_IS_ASC_QUERY(pQueryAttr) ? pSDataBlock->info.rows - num : pSDataBlock->info.rows - 1;
doApplyFunctions(pRuntimeEnv, pInfo->binfo.pCtx, &w, offset, num, tsList, pSDataBlock->info.rows, pOperator->numOfOutput);
} }
} }
......
...@@ -257,7 +257,13 @@ static FORCE_INLINE int tsdbAppendDFile(SDFile* pDFile, void* buf, int64_t nbyte ...@@ -257,7 +257,13 @@ static FORCE_INLINE int tsdbAppendDFile(SDFile* pDFile, void* buf, int64_t nbyte
return -1; return -1;
} }
ASSERT(pDFile->info.size == toffset); //bug fix. To avoid data corruption,
//the end offset of current file should be checked with file size,
//if not equal, known as file corrupted and return error.
if (pDFile->info.size != toffset) {
terrno = TSDB_CODE_TDB_FILE_CORRUPTED;
return -1;
}
if (offset) { if (offset) {
*offset = toffset; *offset = toffset;
......
...@@ -5,9 +5,9 @@ set -e ...@@ -5,9 +5,9 @@ set -e
pgrep taosd || taosd >> /dev/null 2>&1 & pgrep taosd || taosd >> /dev/null 2>&1 &
pgrep taosadapter || taosadapter >> /dev/null 2>&1 & pgrep taosadapter || taosadapter >> /dev/null 2>&1 &
cd ../../docs-examples/R cd ../../docs/examples/R
jar_path=`find ../../../debug/build -name taos-jdbcdriver-*-dist.jar` jar_path=`find ../../../../debug/build -name taos-jdbcdriver-*-dist.jar`
echo jar_path=$jar_path echo jar_path=$jar_path
R -f connect_native.r --args $jar_path R -f connect_native.r --args $jar_path
# R -f connect_rest.r --args $jar_path # bug 14704 # R -f connect_rest.r --args $jar_path # bug 14704
......
...@@ -5,7 +5,7 @@ set -e ...@@ -5,7 +5,7 @@ set -e
taosd >> /dev/null 2>&1 & taosd >> /dev/null 2>&1 &
taosadapter >> /dev/null 2>&1 & taosadapter >> /dev/null 2>&1 &
cd ../../docs-examples/c cd ../../docs/examples/c
# 1 # 1
gcc connect_example.c -o connect_example -ltaos gcc connect_example.c -o connect_example -ltaos
......
...@@ -4,7 +4,7 @@ set -e ...@@ -4,7 +4,7 @@ set -e
pgrep taosd || taosd >> /dev/null 2>&1 & pgrep taosd || taosd >> /dev/null 2>&1 &
pgrep taosadapter || taosadapter >> /dev/null 2>&1 & pgrep taosadapter || taosadapter >> /dev/null 2>&1 &
cd ../../docs-examples/csharp cd ../../docs/examples/csharp
dotnet run --project connect.csproj dotnet run --project connect.csproj
......
...@@ -5,7 +5,7 @@ set -e ...@@ -5,7 +5,7 @@ set -e
taosd >> /dev/null 2>&1 & taosd >> /dev/null 2>&1 &
taosadapter >> /dev/null 2>&1 & taosadapter >> /dev/null 2>&1 &
cd ../../docs-examples/go cd ../../docs/examples/go
go mod tidy go mod tidy
......
...@@ -4,6 +4,6 @@ set -e ...@@ -4,6 +4,6 @@ set -e
taosd >> /dev/null 2>&1 & taosd >> /dev/null 2>&1 &
taosadapter >> /dev/null 2>&1 & taosadapter >> /dev/null 2>&1 &
cd ../../docs-examples/java cd ../../docs/examples/java
mvn test mvn test
\ No newline at end of file
...@@ -5,7 +5,7 @@ set -e ...@@ -5,7 +5,7 @@ set -e
pgrep taosd || taosd >> /dev/null 2>&1 & pgrep taosd || taosd >> /dev/null 2>&1 &
pgrep taosadapter || taosadapter >> /dev/null 2>&1 & pgrep taosadapter || taosadapter >> /dev/null 2>&1 &
cd ../../docs-examples/node cd ../../docs/examples/node
npm install npm install
cd restexample; cd restexample;
......
...@@ -5,7 +5,7 @@ set -e ...@@ -5,7 +5,7 @@ set -e
taosd >> /dev/null 2>&1 & taosd >> /dev/null 2>&1 &
taosadapter >> /dev/null 2>&1 & taosadapter >> /dev/null 2>&1 &
cd ../../docs-examples/python cd ../../docs/examples/python
# 1 # 1
taos -s "create database if not exists log" taos -s "create database if not exists log"
......
...@@ -5,7 +5,7 @@ set -e ...@@ -5,7 +5,7 @@ set -e
pgrep taosd || taosd >> /dev/null 2>&1 & pgrep taosd || taosd >> /dev/null 2>&1 &
pgrep taosadapter || taosadapter >> /dev/null 2>&1 & pgrep taosadapter || taosadapter >> /dev/null 2>&1 &
cd ../../docs-examples/rust cd ../../docs/examples/rust
cargo run -p nativeexample --example connect cargo run -p nativeexample --example connect
cargo run -p restexample --example connect cargo run -p restexample --example connect
......
...@@ -95,7 +95,7 @@ docker run \ ...@@ -95,7 +95,7 @@ docker run \
-v $REPDIR/packaging/cfg/taos.cfg:/etc/taos/taos.cfg:ro \ -v $REPDIR/packaging/cfg/taos.cfg:/etc/taos/taos.cfg:ro \
-v $REPDIR/packaging:$CONTAINER_TESTDIR/packaging:ro \ -v $REPDIR/packaging:$CONTAINER_TESTDIR/packaging:ro \
-v $REPDIR/README.md:$CONTAINER_TESTDIR/README.md:ro \ -v $REPDIR/README.md:$CONTAINER_TESTDIR/README.md:ro \
-v $REPDIR/docs-examples:$CONTAINER_TESTDIR/docs-examples \ -v $REPDIR/docs:$CONTAINER_TESTDIR/docs \
-v $REPDIR/src/connector/python/taos:/usr/local/lib/python3.8/site-packages/taos:ro \ -v $REPDIR/src/connector/python/taos:/usr/local/lib/python3.8/site-packages/taos:ro \
-e LD_LIBRARY_PATH=/home/debug/build/lib:/home/debug/build/lib64 \ -e LD_LIBRARY_PATH=/home/debug/build/lib:/home/debug/build/lib64 \
--rm --ulimit core=-1 taos_test:v1.0 $CONTAINER_TESTDIR/tests/parallel_test/run_case.sh -d "$exec_dir" -c "$cmd" $timeout_param --rm --ulimit core=-1 taos_test:v1.0 $CONTAINER_TESTDIR/tests/parallel_test/run_case.sh -d "$exec_dir" -c "$cmd" $timeout_param
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册