Merge from develop into feature/os
This commit is contained in:
commit
00d6291eb7
|
@ -21,7 +21,7 @@ TDengine is an open-sourced big data platform under [GNU AGPL v3.0](http://www.g
|
|||
- **Zero Management, No Learning Curve**: It takes only seconds to download, install, and run it successfully; there are no other dependencies. Automatic partitioning on tables or DBs. Standard SQL is used, with C/C++, Python, JDBC, Go and RESTful connectors.
|
||||
|
||||
# Documentation
|
||||
For user manual, system design and architecture, engineering blogs, refer to [TDengine Documentation](https://www.taosdata.com/en/documentation/)
|
||||
For user manual, system design and architecture, engineering blogs, refer to [TDengine Documentation](https://www.taosdata.com/en/documentation/)(中文版请点击[这里](https://www.taosdata.com/cn/documentation20/))
|
||||
for details. The documentation from our website can also be downloaded locally from *documentation/tdenginedocs-en* or *documentation/tdenginedocs-cn*.
|
||||
|
||||
# Building
|
||||
|
|
|
@ -119,7 +119,7 @@ WantedBy=multi-user.target
|
|||
return nil
|
||||
}
|
||||
|
||||
const version = "TDengine alert v1.0.0"
|
||||
const version = "TDengine alert v2.0.0.0"
|
||||
|
||||
func main() {
|
||||
var (
|
||||
|
|
|
@ -5,7 +5,7 @@ go 1.14
|
|||
require (
|
||||
github.com/jmoiron/sqlx v1.2.0
|
||||
github.com/mattn/go-sqlite3 v2.0.3+incompatible
|
||||
github.com/taosdata/driver-go master
|
||||
github.com/taosdata/driver-go v0.0.0-20200727182616-1a3b1941c206
|
||||
go.uber.org/zap v1.14.1
|
||||
google.golang.org/appengine v1.6.5 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
set -e
|
||||
|
||||
# releash.sh -c [arm | arm64 | x64 | x86]
|
||||
# releash.sh -c [armv6l | arm64 | amd64 | 386]
|
||||
# -o [linux | darwin | windows]
|
||||
|
||||
# set parameters by default value
|
||||
cpuType=x64 # [arm | arm64 | x64 | x86]
|
||||
cpuType=amd64 # [armv6l | arm64 | amd64 | 386]
|
||||
osType=linux # [linux | darwin | windows]
|
||||
|
||||
declare -A archMap=(["armv6l"]="arm" ["arm64"]="arm64" ["amd64"]="x64" ["386"]="x86")
|
||||
while getopts "h:c:o:" arg
|
||||
do
|
||||
case $arg in
|
||||
|
@ -19,7 +20,7 @@ do
|
|||
osType=$(echo $OPTARG)
|
||||
;;
|
||||
h)
|
||||
echo "Usage: `basename $0` -c [arm | arm64 | x64 | x86] -o [linux | darwin | windows]"
|
||||
echo "Usage: `basename $0` -c [armv6l | arm64 | amd64 | 386] -o [linux | darwin | windows]"
|
||||
exit 0
|
||||
;;
|
||||
?) #unknown option
|
||||
|
@ -35,6 +36,7 @@ scriptdir=$(dirname $(readlink -f $0))
|
|||
cd ${scriptdir}/cmd/alert
|
||||
version=$(grep 'const version =' main.go | awk '{print $NF}')
|
||||
version=${version%\"}
|
||||
version=${version:1}
|
||||
|
||||
echo "cpuType=${cpuType}"
|
||||
echo "osType=${osType}"
|
||||
|
@ -42,4 +44,4 @@ echo "version=${version}"
|
|||
|
||||
GOOS=${osType} GOARCH=${cpuType} go build
|
||||
|
||||
GZIP=-9 tar -zcf ${startdir}/tdengine-alert-${version}-${osType}-${cpuType}.tar.gz alert alert.cfg install_driver.sh driver/
|
||||
tar -I 'gzip -9' -cf ${startdir}/TDengine-alert-${version}-${osType^}-${archMap[${cpuType}]}.tar.gz alert alert.cfg install_driver.sh driver/
|
||||
|
|
|
@ -31,7 +31,7 @@ TDengine的Grafana插件在安装包的/usr/local/taos/connector/grafana目录
|
|||
|
||||

|
||||
|
||||
* Host: TDengine 集群的中任意一台服务器的 IP 地址与 TDengine RESTful 接口的端口号(6020),默认 http://localhost:6020。
|
||||
* Host: TDengine 集群的中任意一台服务器的 IP 地址与 TDengine RESTful 接口的端口号(6041),默认 http://localhost:6041
|
||||
* User:TDengine 用户名。
|
||||
* Password:TDengine 用户密码。
|
||||
|
||||
|
|
|
@ -53,9 +53,12 @@ systemctl start taosd
|
|||
systemctl status taosd
|
||||
```
|
||||
|
||||
如果TDengine服务正常工作,那么您可以通过TDengine的命令行程序`taos`来访问并体验TDengine。
|
||||
|
||||
**注:_systemctl_ 命令需要 _root_ 权限来运行,如果您非 _root_ 用户,请在命令前添加 _sudo_**
|
||||
如果TDengine服务正常工作,那么您可以通过TDengine的命令行程序`taos`来访问并体验TDengine。
|
||||
|
||||
**注意:**
|
||||
|
||||
- systemctl命令需要 _root_ 权限来运行,如果您非 _root_ 用户,请在命令前添加 sudo
|
||||
- 为更好的获得产品反馈,改善产品,TDengine会采集基本的使用信息,但您可以修改系统配置文件taos.cfg里的配置参数telemetryReporting, 将其设为0,就可将其关闭。
|
||||
|
||||
## TDengine命令行程序
|
||||
|
||||
|
|
|
@ -11,8 +11,16 @@ TDengine采用关系型数据模型,需要建库、建表。因此对于一个
|
|||
```cmd
|
||||
CREATE DATABASE power KEEP 365 DAYS 10 REPLICA 3 BLOCKS 4;
|
||||
```
|
||||
上述语句将创建一个名为power的库,这个库的数据将保留365天(超过365天将被自动删除),每10天一个数据文件,副本数为3, 内存块数为4。详细的语法及参数请见<a href="https://www.taosdata.com/cn/documentation20/taos-sql/">TAOS SQL</a>
|
||||
上述语句将创建一个名为power的库,这个库的数据将保留365天(超过365天将被自动删除),每10天一个数据文件,副本数为3, 内存块数为4。详细的语法及参数请见<a href="https://www.taosdata.com/cn/documentation20/taos-sql/">TAOS SQL</a>
|
||||
|
||||
创建库之后,需要使用SQL命令USE将当前库切换过来,例如:
|
||||
|
||||
```cmd
|
||||
USE power;
|
||||
```
|
||||
|
||||
就当前链接里操作的库换为power,否则对具体表操作前,需要使用“库名.表名”来指定库的名字。
|
||||
|
||||
**注意:**
|
||||
|
||||
- 任何一张表或超级表是属于一个库的,在创建表之前,必须先创建库。
|
||||
|
|
|
@ -39,7 +39,7 @@ Raw DataSize = numOfTables * rowSizePerTable * rowsPerTable
|
|||
|
||||
用户可以通过参数keep,设置数据在磁盘中的最大保存时长。为进一步减少存储成本,TDengine还提供多级存储,最冷的数据可以存放在最廉价的存储介质上,应用的访问不用做任何调整,只是读取速度降低了。
|
||||
|
||||
为提高速度,可以配置多快硬盘,这样可以并发写入或读取数据。
|
||||
为提高速度,可以配置多快硬盘,这样可以并发写入或读取数据。需要提醒的是,TDengine采取多副本的方式提供数据的高可靠,因此不再需要采用昂贵的磁盘阵列。
|
||||
|
||||
### 物理机或虚拟机台数
|
||||
|
||||
|
@ -80,11 +80,11 @@ TDengine系统后台服务由taosd提供,可以在配置文件taos.cfg里修
|
|||
|
||||
下面仅仅列出一些重要的配置参数,更多的参数请看配置文件里的说明。各个参数的详细介绍及作用请看前述章节,而且这些参数的缺省配置都是工作的,一般无需设置。**注意:配置修改后,需要重启*taosd*服务才能生效。**
|
||||
|
||||
- firstEp: taosd启动时,主动连接的集群中第一个dnode的end point, 缺省值为 localhost:6030。
|
||||
- secondEp: taosd启动时,如果first连接不上,尝试连接集群中第二个dnode的end point, 缺省值为空。
|
||||
- fqdn:数据节点的FQDN。如果为空,将自动获取操作系统配置的第一个, 缺省值为空。
|
||||
- firstEp: taosd启动时,主动连接的集群中第一个dnode的end point, 默认值为localhost:6030。
|
||||
- secondEp: taosd启动时,如果first连接不上,尝试连接集群中第二个dnode的end point, 默认值为空。
|
||||
- fqdn:数据节点的FQDN。如果为空,将自动获取操作系统配置的第一个, 默认值为空。
|
||||
- serverPort:taosd启动后,对外服务的端口号,默认值为6030。
|
||||
- httpPort: RESTful服务使用的端口号,所有的HTTP请求(TCP)都需要向该接口发起查询/写入请求。
|
||||
- httpPort: RESTful服务使用的端口号,所有的HTTP请求(TCP)都需要向该接口发起查询/写入请求, 默认值为6041。
|
||||
- dataDir: 数据文件目录,所有的数据文件都将写入该目录。默认值:/var/lib/taos。
|
||||
- logDir:日志文件目录,客户端和服务器的运行日志文件将写入该目录。默认值:/var/log/taos。
|
||||
- arbitrator:系统中裁决器的end point, 缺省值为空。
|
||||
|
@ -92,9 +92,9 @@ TDengine系统后台服务由taosd提供,可以在配置文件taos.cfg里修
|
|||
- debugFlag:运行日志开关。131(输出错误和警告日志),135( 输出错误、警告和调试日志),143( 输出错误、警告、调试和跟踪日志)。默认值:131或135(不同模块有不同的默认值)。
|
||||
- numOfLogLines:单个日志文件允许的最大行数。默认值:10,000,000行。
|
||||
- maxSQLLength:单条SQL语句允许最长限制。默认值:65380字节。
|
||||
- maxBinaryDisplayWidth:Shell中binary 和 nchar字段的显示宽度上限,超过此限制的部分将被隐藏。默认值:30。可在 shell 中通过命令 set max_binary_display_width nn动态修改此选项。
|
||||
- telemetryReporting: 是否允许 TDengine 采集和上报基本使用信息,0表示不允许,1表示允许。 默认值:1。
|
||||
|
||||
**注意:**对于端口,TDengine会使用从serverPort起11个连续的TCP和UDP端口号,请务必在防火墙打开。因此如果是缺省配置,需要打开从6030都6040共11个端口,而且必须TCP和UDP都打开。
|
||||
**注意:**对于端口,TDengine会使用从serverPort起12个连续的TCP和UDP端口号,请务必在防火墙打开。因此如果是缺省配置,需要打开从6030都6041共12个端口,而且必须TCP和UDP都打开。
|
||||
|
||||
不同应用场景的数据往往具有不同的数据特征,比如保留天数、副本数、采集频次、记录大小、采集点的数量、压缩等都可完全不同。为获得在存储上的最高效率,TDengine提供如下存储相关的系统配置参数:
|
||||
|
||||
|
@ -142,6 +142,7 @@ TDengine系统的前台交互客户端应用程序为taos,它与taosd共享同
|
|||
- secondEp: taos启动时,如果first连接不上,尝试连接集群中第二个taosd实例的end point, 缺省值为空。
|
||||
- charset:字符集编码。系统中动态获取,如果自动获取失败,需要用户在配置文件设置或通过API设置。
|
||||
- locale:系统区位信息及编码格式。系统中动态获取,如果自动获取失败,需要用户在配置文件设置或通过API设置。
|
||||
- maxBinaryDisplayWidth:Shell中binary 和 nchar字段的显示宽度上限,超过此限制的部分将被隐藏。默认值:30。可在 shell 中通过命令 set max_binary_display_width *nn* 动态修改此选项。
|
||||
|
||||
日志的配置参数,与server的配置参数完全一样。
|
||||
|
||||
|
@ -152,19 +153,19 @@ TDengine系统的前台交互客户端应用程序为taos,它与taosd共享同
|
|||
系统管理员可以在CLI界面里添加、删除用户,也可以修改密码。CLI里SQL语法如下:
|
||||
|
||||
```
|
||||
CREATE USER user_name PASS ‘password’;
|
||||
CREATE USER <user_name> PASS <‘password’>;
|
||||
```
|
||||
|
||||
创建用户,并指定用户名和密码,密码需要用单引号引起来
|
||||
|
||||
```
|
||||
DROP USER user_name;
|
||||
DROP USER <user_name>;
|
||||
```
|
||||
|
||||
删除用户,限root用户使用
|
||||
|
||||
```
|
||||
ALTER USER user_name PASS ‘password’;
|
||||
ALTER USER <user_name> PASS <‘password’>;
|
||||
```
|
||||
|
||||
修改用户密码, 为避免被转换为小写,密码需要用单引号引用
|
||||
|
@ -173,7 +174,9 @@ ALTER USER user_name PASS ‘password’;
|
|||
SHOW USERS;
|
||||
```
|
||||
|
||||
显示所有用户
|
||||
显示所有用户
|
||||
|
||||
**注意:**SQL 语法中,< >表示需要用户输入的部分,但请不要输入< >本身
|
||||
|
||||
## 数据导入
|
||||
|
||||
|
|
|
@ -282,60 +282,320 @@ TDengine提供时间驱动的实时流式计算API。可以每隔一指定的时
|
|||
|
||||
## Java Connector
|
||||
|
||||
### JDBC接口
|
||||
TDengine 为了方便 Java 应用使用,提供了遵循 JDBC 标准(3.0)API 规范的 `taos-jdbcdriver` 实现。目前可以通过 [Sonatype Repository][1] 搜索并下载。
|
||||
|
||||
如果用户使用Java开发企业级应用,可选用TDengine提供的JDBC Driver来调用服务。TDengine提供的JDBC Driver是标准JDBC规范的子集,遵循JDBC 标准(3.0)API规范,支持现有的各种Java开发框架。目前TDengine的JDBC driver并未发布到在线依赖仓库比如maven的中心仓库。因此用户开发时,需要手动把驱动包`taos-jdbcdriver-x.x.x-dist.jar`安装到开发环境的依赖仓库中。
|
||||
由于 TDengine 是使用 c 语言开发的,使用 taos-jdbcdriver 驱动包时需要依赖系统对应的本地函数库。
|
||||
|
||||
TDengine 的驱动程序包的在不同操作系统上依赖不同的本地函数库(均由C语言编写)。Linux系统上,依赖一个名为`libtaos.so` 的本地库,.so即"Shared Object"缩写。成功安装TDengine后,`libtaos.so` 文件会被自动拷贝至`/usr/local/lib/taos`目录下,该目录也包含在Linux上自动扫描路径上。Windows系统上,JDBC驱动程序依赖于一个名为`taos.dll` 的本地库,.dll是动态链接库"Dynamic Link Library"的缩写。Windows上成功安装客户端后,JDBC驱动程序包默认位于`C:/TDengine/driver/JDBC/`目录下;其依赖的动态链接库`taos.dll`文件位于`C:/TDengine/driver/C`目录下,`taos.dll` 会被自动拷贝至系统默认搜索路径`C:/Windows/System32`下。
|
||||
* libtaos.so
|
||||
在 linux 系统中成功安装 TDengine 后,依赖的本地函数库 libtaos.so 文件会被自动拷贝至 /usr/lib/libtaos.so,该目录包含在 Linux 自动扫描路径上,无需单独指定。
|
||||
|
||||
* taos.dll
|
||||
在 windows 系统中安装完客户端之后,驱动包依赖的 taos.dll 文件会自动拷贝到系统默认搜索路径 C:/Windows/System32 下,同样无需要单独指定。
|
||||
|
||||
> 注意:在 windows 环境开发时需要安装 TDengine 对应的 [windows 客户端][14],Linux 服务器安装完 TDengine 之后默认已安装 client,也可以单独安装 [Linux 客户端][15] 连接远程 TDengine Server。
|
||||
|
||||
TDengine的JDBC Driver遵循标准JDBC规范,开发人员可以参考Oracle官方的JDBC相关文档来找到具体的接口和方法的定义与用法。TDengine的JDBC驱动在连接配置和支持的方法上与传统数据库驱动稍有不同。
|
||||
TDengine 的 JDBC 驱动实现尽可能的与关系型数据库驱动保持一致,但时序空间数据库与关系对象型数据库服务的对象和技术特征的差异导致 taos-jdbcdriver 并未完全实现 JDBC 标准规范。在使用时需要注意以下几点:
|
||||
|
||||
TDengine的JDBC URL规范格式为:
|
||||
* TDengine 不提供针对单条数据记录的删除和修改的操作,驱动中也没有支持相关方法。
|
||||
* 由于不支持删除和修改,所以也不支持事务操作。
|
||||
* 目前不支持表间的 union 操作。
|
||||
* 目前不支持嵌套查询(nested query),对每个 Connection 的实例,至多只能有一个打开的 ResultSet 实例;如果在 ResultSet还没关闭的情况下执行了新的查询,TSDBJDBCDriver 则会自动关闭上一个 ResultSet。
|
||||
|
||||
`jdbc:TSDB://{host_ip}:{port}/{database_name}?[user={user}|&password={password}|&charset={charset}|&cfgdir={config_dir}|&locale={locale}|&timezone={timezone}]`
|
||||
|
||||
其中,`{}`中的内容必须,`[]`中为可选。配置参数说明如下:
|
||||
## TAOS-JDBCDriver 版本以及支持的 TDengine 版本和 JDK 版本
|
||||
|
||||
- user:登陆TDengine所用用户名;默认值root
|
||||
- password:用户登陆密码;默认值taosdata
|
||||
- charset:客户端使用的字符集;默认值为系统字符集
|
||||
- cfgdir:客户端配置文件目录路径;Linux OS上默认值`/etc/taos` ,Windows OS上默认值 `C:/TDengine/cfg`
|
||||
- locale:客户端语言环境;默认值系统当前locale
|
||||
- timezone:客户端使用的时区;默认值为系统当前时区
|
||||
| taos-jdbcdriver 版本 | TDengine 版本 | JDK 版本 |
|
||||
| --- | --- | --- |
|
||||
| 2.0.0 | 2.0.0.x 及以上 | 1.8.x |
|
||||
| 1.0.3 | 1.6.1.x 及以上 | 1.8.x |
|
||||
| 1.0.2 | 1.6.1.x 及以上 | 1.8.x |
|
||||
| 1.0.1 | 1.6.1.x 及以上 | 1.8.x |
|
||||
|
||||
以上所有参数均可在调用java.sql.DriverManager类创建连接时指定,示例如下:
|
||||
## TDengine DataType 和 Java DataType
|
||||
|
||||
TDengine 目前支持时间戳、数字、字符、布尔类型,与 Java 对应类型转换如下:
|
||||
|
||||
| TDengine DataType | Java DataType |
|
||||
| --- | --- |
|
||||
| TIMESTAMP | java.sql.Timestamp |
|
||||
| INT | java.lang.Integer |
|
||||
| BIGINT | java.lang.Long |
|
||||
| FLOAT | java.lang.Float |
|
||||
| DOUBLE | java.lang.Double |
|
||||
| SMALLINT, TINYINT |java.lang.Short |
|
||||
| BOOL | java.lang.Boolean |
|
||||
| BINARY, NCHAR | java.lang.String |
|
||||
|
||||
## 如何获取 TAOS-JDBCDriver
|
||||
|
||||
### maven 仓库
|
||||
|
||||
目前 taos-jdbcdriver 已经发布到 [Sonatype Repository][1] 仓库,且各大仓库都已同步。
|
||||
* [sonatype][8]
|
||||
* [mvnrepository][9]
|
||||
* [maven.aliyun][10]
|
||||
|
||||
maven 项目中使用如下 pom.xml 配置即可:
|
||||
|
||||
```xml
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.taosdata.jdbc</groupId>
|
||||
<artifactId>taos-jdbcdriver</artifactId>
|
||||
<version>2.0.0</version>
|
||||
<type>jar</type>
|
||||
<scope>system</scope>
|
||||
<systemPath>{localdir}/connector/taos-jdbcdriver-2.0.0-dist.jar</systemPath>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
```
|
||||
|
||||
### 源码编译打包
|
||||
|
||||
下载 [TDengine][3] 源码之后,进入 taos-jdbcdriver 源码目录 `src/connector/jdbc` 执行 `mvn clean package` 即可生成相应 jar 包。
|
||||
|
||||
|
||||
## 使用说明
|
||||
|
||||
### 获取连接
|
||||
|
||||
如下所示配置即可获取 TDengine Connection:
|
||||
```java
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.util.Properties;
|
||||
import com.taosdata.jdbc.TSDBDriver;
|
||||
Class.forName("com.taosdata.jdbc.TSDBDriver");
|
||||
String jdbcUrl = "jdbc:TAOS://127.0.0.1:6030/log?user=root&password=taosdata";
|
||||
Connection conn = DriverManager.getConnection(jdbcUrl);
|
||||
```
|
||||
> 端口 6030 为默认连接端口,JDBC URL 中的 log 为系统本身的监控数据库。
|
||||
|
||||
TDengine 的 JDBC URL 规范格式为:
|
||||
`jdbc:TSDB://{host_ip}:{port}/[database_name]?[user={user}|&password={password}|&charset={charset}|&cfgdir={config_dir}|&locale={locale}|&timezone={timezone}]`
|
||||
|
||||
其中,`{}` 中的内容必须,`[]` 中为可选。配置参数说明如下:
|
||||
|
||||
* user:登录 TDengine 用户名,默认值 root。
|
||||
* password:用户登录密码,默认值 taosdata。
|
||||
* charset:客户端使用的字符集,默认值为系统字符集。
|
||||
* cfgdir:客户端配置文件目录路径,Linux OS 上默认值 /etc/taos ,Windows OS 上默认值 C:/TDengine/cfg。
|
||||
* locale:客户端语言环境,默认值系统当前 locale。
|
||||
* timezone:客户端使用的时区,默认值为系统当前时区。
|
||||
|
||||
以上参数可以在 3 处配置,`优先级由高到低`分别如下:
|
||||
1. JDBC URL 参数
|
||||
如上所述,可以在 JDBC URL 的参数中指定。
|
||||
2. java.sql.DriverManager.getConnection(String jdbcUrl, Properties connProps)
|
||||
```java
|
||||
public Connection getConn() throws Exception{
|
||||
Class.forName("com.taosdata.jdbc.TSDBDriver");
|
||||
String jdbcUrl = "jdbc:TAOS://127.0.0.1:0/db?user=root&password=taosdata";
|
||||
Class.forName("com.taosdata.jdbc.TSDBDriver");
|
||||
String jdbcUrl = "jdbc:TAOS://127.0.0.1:0/log?user=root&password=taosdata";
|
||||
Properties connProps = new Properties();
|
||||
connProps.setProperty(TSDBDriver.PROPERTY_KEY_USER, "root");
|
||||
connProps.setProperty(TSDBDriver.PROPERTY_KEY_PASSWORD, "taosdata");
|
||||
connProps.setProperty(TSDBDriver.PROPERTY_KEY_CONFIG_DIR, "/etc/taos");
|
||||
connProps.setProperty(TSDBDriver.PROPERTY_KEY_CHARSET, "UTF-8");
|
||||
connProps.setProperty(TSDBDriver.PROPERTY_KEY_LOCALE, "en_US.UTF-8");
|
||||
connProps.setProperty(TSDBDriver.PROPERTY_KEY_TIMEZONE, "UTC-8");
|
||||
connProps.setProperty(TSDBDriver.PROPERTY_KEY_TIME_ZONE, "UTC-8");
|
||||
Connection conn = DriverManager.getConnection(jdbcUrl, connProps);
|
||||
return conn;
|
||||
}
|
||||
```
|
||||
|
||||
这些配置参数中除了cfgdir外,均可在客户端配置文件taos.cfg中进行配置。调用java.sql.DriverManager时声明的配置参数优先级最高,JDBC URL的优先级次之,配置文件的优先级最低。例如charset同时在配置文件taos.cfg中配置,也在JDBC URL中配置,则使用JDBC URL中的配置值。
|
||||
3. 客户端配置文件 taos.cfg
|
||||
|
||||
此外,尽管TDengine的JDBC驱动实现尽可能的与关系型数据库驱动保持一致,但时序空间数据库与关系对象型数据库服务的对象和技术特征的差异导致TDengine的Java API并不能与标准完全相同。对于有大量关系型数据库开发经验而初次接触TDengine的开发者来说,有以下一些值的注意的地方:
|
||||
linux 系统默认配置文件为 /var/lib/taos/taos.cfg,windows 系统默认配置文件路径为 C:\TDengine\cfg\taos.cfg。
|
||||
```properties
|
||||
# client default username
|
||||
# defaultUser root
|
||||
|
||||
* TDengine不提供针对单条数据记录的删除和修改的操作,驱动中也没有支持相关方法
|
||||
* 目前TDengine不支持表间的join或union操作,因此也缺乏对该部分API的支持
|
||||
* TDengine支持批量写入,但是支持停留在SQL语句级别,而不是API级别,也就是说用户需要通过写特殊的SQL语句来实现批量
|
||||
* 目前TDengine不支持嵌套查询(nested query),对每个Connection的实例,至多只能有一个打开的ResultSet实例;如果在ResultSet还没关闭的情况下执行了新的查询,TSDBJDBCDriver则会自动关闭上一个ResultSet
|
||||
# client default password
|
||||
# defaultPass taosdata
|
||||
|
||||
对于TDengine操作的报错信息,用户可使用JDBCDriver包里提供的枚举类TSDBError.java来获取error message和error code的列表。对于更多的具体操作的相关代码,请参考TDengine提供的使用示范项目`JDBCDemo`。
|
||||
# default system charset
|
||||
# charset UTF-8
|
||||
|
||||
# system locale
|
||||
# locale en_US.UTF-8
|
||||
```
|
||||
> 更多详细配置请参考[客户端配置][13]
|
||||
|
||||
### 创建数据库和表
|
||||
|
||||
```java
|
||||
Statement stmt = conn.createStatement();
|
||||
|
||||
// create database
|
||||
stmt.executeUpdate("create database if not exists db");
|
||||
|
||||
// use database
|
||||
stmt.executeUpdate("use db");
|
||||
|
||||
// create table
|
||||
stmt.executeUpdate("create table if not exists tb (ts timestamp, temperature int, humidity float)");
|
||||
```
|
||||
> 注意:如果不使用 `use db` 指定数据库,则后续对表的操作都需要增加数据库名称作为前缀,如 db.tb。
|
||||
|
||||
### 插入数据
|
||||
|
||||
```java
|
||||
// insert data
|
||||
int affectedRows = stmt.executeUpdate("insert into tb values(now, 23, 10.3) (now + 1s, 20, 9.3)");
|
||||
|
||||
System.out.println("insert " + affectedRows + " rows.");
|
||||
```
|
||||
> now 为系统内部函数,默认为服务器当前时间。
|
||||
> `now + 1s` 代表服务器当前时间往后加 1 秒,数字后面代表时间单位:a(毫秒), s(秒), m(分), h(小时), d(天),w(周), n(月), y(年)。
|
||||
|
||||
### 查询数据
|
||||
|
||||
```java
|
||||
// query data
|
||||
ResultSet resultSet = stmt.executeQuery("select * from tb");
|
||||
|
||||
Timestamp ts = null;
|
||||
int temperature = 0;
|
||||
float humidity = 0;
|
||||
while(resultSet.next()){
|
||||
|
||||
ts = resultSet.getTimestamp(1);
|
||||
temperature = resultSet.getInt(2);
|
||||
humidity = resultSet.getFloat("humidity");
|
||||
|
||||
System.out.printf("%s, %d, %s\n", ts, temperature, humidity);
|
||||
}
|
||||
```
|
||||
> 查询和操作关系型数据库一致,使用下标获取返回字段内容时从 1 开始,建议使用字段名称获取。
|
||||
|
||||
|
||||
### 关闭资源
|
||||
|
||||
```java
|
||||
resultSet.close();
|
||||
stmt.close();
|
||||
conn.close();
|
||||
```
|
||||
> `注意务必要将 connection 进行关闭`,否则会出现连接泄露。
|
||||
## 与连接池使用
|
||||
|
||||
**HikariCP**
|
||||
|
||||
* 引入相应 HikariCP maven 依赖:
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>com.zaxxer</groupId>
|
||||
<artifactId>HikariCP</artifactId>
|
||||
<version>3.4.1</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
* 使用示例如下:
|
||||
```java
|
||||
public static void main(String[] args) throws SQLException {
|
||||
HikariConfig config = new HikariConfig();
|
||||
config.setJdbcUrl("jdbc:TAOS://127.0.0.1:6030/log");
|
||||
config.setUsername("root");
|
||||
config.setPassword("taosdata");
|
||||
|
||||
config.setMinimumIdle(3); //minimum number of idle connection
|
||||
config.setMaximumPoolSize(10); //maximum number of connection in the pool
|
||||
config.setConnectionTimeout(10000); //maximum wait milliseconds for get connection from pool
|
||||
config.setIdleTimeout(60000); // max idle time for recycle idle connection
|
||||
config.setConnectionTestQuery("describe log.dn"); //validation query
|
||||
config.setValidationTimeout(3000); //validation query timeout
|
||||
|
||||
HikariDataSource ds = new HikariDataSource(config); //create datasource
|
||||
|
||||
Connection connection = ds.getConnection(); // get connection
|
||||
Statement statement = connection.createStatement(); // get statement
|
||||
|
||||
//query or insert
|
||||
// ...
|
||||
|
||||
connection.close(); // put back to conneciton pool
|
||||
}
|
||||
```
|
||||
> 通过 HikariDataSource.getConnection() 获取连接后,使用完成后需要调用 close() 方法,实际上它并不会关闭连接,只是放回连接池中。
|
||||
> 更多 HikariCP 使用问题请查看[官方说明][5]
|
||||
|
||||
**Druid**
|
||||
|
||||
* 引入相应 Druid maven 依赖:
|
||||
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid</artifactId>
|
||||
<version>1.1.20</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
* 使用示例如下:
|
||||
```java
|
||||
public static void main(String[] args) throws Exception {
|
||||
Properties properties = new Properties();
|
||||
properties.put("driverClassName","com.taosdata.jdbc.TSDBDriver");
|
||||
properties.put("url","jdbc:TAOS://127.0.0.1:6030/log");
|
||||
properties.put("username","root");
|
||||
properties.put("password","taosdata");
|
||||
|
||||
properties.put("maxActive","10"); //maximum number of connection in the pool
|
||||
properties.put("initialSize","3");//initial number of connection
|
||||
properties.put("maxWait","10000");//maximum wait milliseconds for get connection from pool
|
||||
properties.put("minIdle","3");//minimum number of connection in the pool
|
||||
|
||||
properties.put("timeBetweenEvictionRunsMillis","3000");// the interval milliseconds to test connection
|
||||
|
||||
properties.put("minEvictableIdleTimeMillis","60000");//the minimum milliseconds to keep idle
|
||||
properties.put("maxEvictableIdleTimeMillis","90000");//the maximum milliseconds to keep idle
|
||||
|
||||
properties.put("validationQuery","describe log.dn"); //validation query
|
||||
properties.put("testWhileIdle","true"); // test connection while idle
|
||||
properties.put("testOnBorrow","false"); // don't need while testWhileIdle is true
|
||||
properties.put("testOnReturn","false"); // don't need while testWhileIdle is true
|
||||
|
||||
//create druid datasource
|
||||
DataSource ds = DruidDataSourceFactory.createDataSource(properties);
|
||||
Connection connection = ds.getConnection(); // get connection
|
||||
Statement statement = connection.createStatement(); // get statement
|
||||
|
||||
//query or insert
|
||||
// ...
|
||||
|
||||
connection.close(); // put back to conneciton pool
|
||||
}
|
||||
```
|
||||
> 更多 druid 使用问题请查看[官方说明][6]
|
||||
|
||||
**注意事项**
|
||||
* TDengine `v1.6.4.1` 版本开始提供了一个专门用于心跳检测的函数 `select server_status()`,所以在使用连接池时推荐使用 `select server_status()` 进行 Validation Query。
|
||||
|
||||
如下所示,`select server_status()` 执行成功会返回 `1`。
|
||||
```shell
|
||||
taos> select server_status();
|
||||
server_status()|
|
||||
================
|
||||
1 |
|
||||
Query OK, 1 row(s) in set (0.000141s)
|
||||
```
|
||||
|
||||
## 与框架使用
|
||||
|
||||
* Spring JdbcTemplate 中使用 taos-jdbcdriver,可参考 [SpringJdbcTemplate][11]
|
||||
* Springboot + Mybatis 中使用,可参考 [springbootdemo][12]
|
||||
|
||||
## 常见问题
|
||||
|
||||
* java.lang.UnsatisfiedLinkError: no taos in java.library.path
|
||||
|
||||
**原因**:程序没有找到依赖的本地函数库 taos。
|
||||
|
||||
**解决方法**:windows 下可以将 C:\TDengine\driver\taos.dll 拷贝到 C:\Windows\System32\ 目录下,linux 下将建立如下软链 ` ln -s /usr/local/taos/driver/libtaos.so.x.x.x.x /usr/lib/libtaos.so` 即可。
|
||||
|
||||
* java.lang.UnsatisfiedLinkError: taos.dll Can't load AMD 64 bit on a IA 32-bit platform
|
||||
|
||||
**原因**:目前 TDengine 只支持 64 位 JDK。
|
||||
|
||||
**解决方法**:重新安装 64 位 JDK。
|
||||
|
||||
* 其它问题请参考 [Issues][7]
|
||||
|
||||
## Python Connector
|
||||
|
||||
|
@ -492,9 +752,9 @@ http://<ip>:<PORT>/rest/sql
|
|||
参数说明:
|
||||
|
||||
- IP: 集群中的任一台主机
|
||||
- PORT: 配置文件中httpPort配置项,缺省为6020
|
||||
- PORT: 配置文件中httpPort配置项,缺省为6041
|
||||
|
||||
例如:http://192.168.0.1:6020/rest/sql 是指向IP地址为192.168.0.1的URL.
|
||||
例如:http://192.168.0.1:6041/rest/sql 是指向IP地址为192.168.0.1的URL.
|
||||
|
||||
HTTP请求的Header里需带有身份认证信息,TDengine支持Basic认证与自定义认证两种机制,后续版本将提供标准安全的数字签名机制来做身份验证。
|
||||
|
||||
|
@ -554,7 +814,7 @@ curl -u username:password -d '<SQL>' <ip>:<PORT>/rest/sql
|
|||
HTTP请求中需要带有授权码`<TOKEN>`,用于身份识别。授权码通常由管理员提供,可简单的通过发送`HTTP GET`请求来获取授权码,操作如下:
|
||||
|
||||
```
|
||||
curl http://<ip>:6020/rest/login/<username>/<password>
|
||||
curl http://<ip>:6041/rest/login/<username>/<password>
|
||||
```
|
||||
|
||||
其中,`ip`是TDengine数据库的IP地址,`username`为数据库用户名,`password`为数据库密码,返回值为`JSON`格式,各字段含义如下:
|
||||
|
@ -568,7 +828,7 @@ curl http://<ip>:6020/rest/login/<username>/<password>
|
|||
获取授权码示例:
|
||||
|
||||
```
|
||||
curl http://192.168.0.1:6020/rest/login/root/taosdata
|
||||
curl http://192.168.0.1:6041/rest/login/root/taosdata
|
||||
```
|
||||
|
||||
返回值:
|
||||
|
@ -586,7 +846,7 @@ curl http://192.168.0.1:6020/rest/login/root/taosdata
|
|||
- 在demo库里查询表d1001的所有记录:
|
||||
|
||||
```
|
||||
curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d 'select * from demo.d1001' 192.168.0.1:6020/rest/sql`
|
||||
curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d 'select * from demo.d1001' 192.168.0.1:6041/rest/sql
|
||||
```
|
||||
返回值:
|
||||
|
||||
|
@ -605,7 +865,7 @@ curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d 'select * from demo.d1001
|
|||
- 创建库demo:
|
||||
|
||||
```
|
||||
curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d 'create database demo' 192.168.0.1:6020/rest/sql`
|
||||
curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d 'create database demo' 192.168.0.1:6041/rest/sql
|
||||
```
|
||||
|
||||
返回值:
|
||||
|
@ -625,7 +885,7 @@ curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d 'create database demo' 19
|
|||
HTTP请求URL采用`sqlt`时,返回结果集的时间戳将采用Unix时间戳格式表示,例如
|
||||
|
||||
```
|
||||
curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d 'select * from demo.d1001' 192.168.0.1:6020/rest/sqlt
|
||||
curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d 'select * from demo.d1001' 192.168.0.1:6041/rest/sqlt
|
||||
```
|
||||
|
||||
返回值:
|
||||
|
@ -646,7 +906,7 @@ curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d 'select * from demo.d1001
|
|||
|
||||
HTTP请求URL采用`sqlutc`时,返回结果集的时间戳将采用UTC时间字符串表示,例如
|
||||
```
|
||||
curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d 'select * from demo.t1' 192.168.0.1:6020/rest/sqlutc
|
||||
curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d 'select * from demo.t1' 192.168.0.1:6041/rest/sqlutc
|
||||
```
|
||||
|
||||
返回值:
|
||||
|
@ -667,7 +927,7 @@ HTTP请求URL采用`sqlutc`时,返回结果集的时间戳将采用UTC时间
|
|||
|
||||
下面仅列出一些与RESTFul接口有关的配置参数,其他系统参数请看配置文件里的说明。注意:配置修改后,需要重启taosd服务才能生效
|
||||
|
||||
- httpPort: 对外提供RESTFul服务的端口号,默认绑定到6020
|
||||
- httpPort: 对外提供RESTFul服务的端口号,默认绑定到6041
|
||||
- httpMaxThreads: 启动的线程数量,默认为2
|
||||
- restfulRowLimit: 返回结果集(JSON格式)的最大条数,默认值为10240
|
||||
- httpEnableCompress: 是否支持压缩,默认不支持,目前TDengine仅支持gzip压缩格式
|
||||
|
|
|
@ -88,18 +88,20 @@ remote_write:
|
|||
|
||||
### 查询prometheus写入数据
|
||||
prometheus产生的数据格式如下:
|
||||
```
|
||||
Timestamp: 1576466279341,
|
||||
Value: 37.000000,
|
||||
apiserver_request_latencies_bucket {
|
||||
component="apiserver",
|
||||
instance="192.168.99.116:8443",
|
||||
job="kubernetes-apiservers",
|
||||
le="125000",
|
||||
resource="persistentvolumes", s
|
||||
cope="cluster",
|
||||
verb="LIST",
|
||||
version=“v1"
|
||||
```json
|
||||
{
|
||||
Timestamp: 1576466279341,
|
||||
Value: 37.000000,
|
||||
apiserver_request_latencies_bucket {
|
||||
component="apiserver",
|
||||
instance="192.168.99.116:8443",
|
||||
job="kubernetes-apiservers",
|
||||
le="125000",
|
||||
resource="persistentvolumes", s
|
||||
cope="cluster",
|
||||
verb="LIST",
|
||||
version=“v1"
|
||||
}
|
||||
}
|
||||
```
|
||||
其中,apiserver_request_latencies_bucket为prometheus采集的时序数据的名称,后面{}中的为该时序数据的标签。blm_prometheus会以时序数据的名称在TDengine中自动创建一个超级表,并将{}中的标签转换成TDengine的tag值,Timestamp作为时间戳,value作为该时序数据的值。因此在TDengine的客户端中,可以通过以下指令查到这个数据是否成功写入。
|
||||
|
@ -183,7 +185,7 @@ url = "http://10.1.2.3:8089/telegraf"
|
|||
|
||||
### 查询telegraf写入数据
|
||||
telegraf产生的数据格式如下:
|
||||
```
|
||||
```json
|
||||
{
|
||||
"fields": {
|
||||
"usage_guest": 0,
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<div class="gf-form-group">
|
||||
<div class="gf-form max-width-30">
|
||||
<span class="gf-form-label width-7">Host</span>
|
||||
<input type="text" class="gf-form-input" ng-model='ctrl.current.url' placeholder="http://localhost:6020" bs-typeahead="{{['http://localhost:6020']}}" required></input>
|
||||
<input type="text" class="gf-form-input" ng-model='ctrl.current.url' placeholder="http://localhost:6041" bs-typeahead="{{['http://localhost:6041']}}" required></input>
|
||||
</div>
|
||||
|
||||
<div class="gf-form-inline">
|
||||
|
|
|
@ -13,13 +13,13 @@ docker network create --ip-range 172.15.1.255/24 --subnet 172.15.1.1/16 minidevo
|
|||
docker run -d --net minidevops --ip 172.15.1.11 -v $LP/grafana:/var/lib/grafana/plugins -p 3000:3000 grafana/grafana
|
||||
#docker run -d --net minidevops --ip 172.15.1.11 -v /Users/tom/Documents/minidevops/grafana:/var/lib/grafana/plugins -p 3000:3000 grafana/grafana
|
||||
|
||||
TDENGINE=`docker run -d --net minidevops --ip 172.15.1.6 -p 6030:6030 -p 6020:6020 -p 6031:6031 -p 6032:6032 -p 6033:6033 -p 6034:6034 -p 6035:6035 -p 6036:6036 -p 6037:6037 -p 6038:6038 -p 6039:6039 tdengine/tdengine:1.6.4.5`
|
||||
TDENGINE=`docker run -d --net minidevops --ip 172.15.1.6 -p 6030:6030 -p 6020:6020 -p 6031:6031 -p 6032:6032 -p 6033:6033 -p 6034:6034 -p 6035:6035 -p 6036:6036 -p 6037:6037 -p 6038:6038 -p 6039:6039 -p 6040:6040 -p 6041:6041 -h '172.15.1.6' tdengine/tdengine:2.0.0.0`
|
||||
docker cp /etc/localtime $TDENGINE:/etc/localtime
|
||||
|
||||
BLMPROMETHEUS=`docker run -d --net minidevops --ip 172.15.1.7 -p 10203:10203 tdengine/blm_prometheus 172.15.1.6`
|
||||
BLMPROMETHEUS=`docker run -d --net minidevops --ip 172.15.1.7 -v $(pwd)/taos:/etc/taos -p 10203:10203 tdengine/blm_prometheus:2.0.0.0 -tdengine-name 172.15.1.6 -tdengine-api-port 6041`
|
||||
|
||||
|
||||
BLMPTELEGRAF=`docker run -d --net minidevops --ip 172.15.1.8 -p 10202:10202 tdengine/blm_telegraf 172.15.1.6`
|
||||
BLMPTELEGRAF=`docker run -d --net minidevops --ip 172.15.1.8 -p 10202:10202 tdengine/blm_telegraf:2.0.0.0 -host 172.15.1.6`
|
||||
|
||||
docker run -d --net minidevops --ip 172.15.1.9 -v $LP/prometheus:/etc/prometheus -p 9090:9090 prom/prometheus
|
||||
#docker run -d --net minidevops --ip 172.15.1.9 -v /Users/tom/Documents/minidevops/prometheus:/etc/prometheus -p 9090:9090 prom/prometheus
|
||||
|
@ -29,7 +29,7 @@ docker run -d --net minidevops --ip 172.15.1.10 -v $LP/telegraf:/etc/telegraf -p
|
|||
|
||||
|
||||
sleep 10
|
||||
curl -X POST http://localhost:3000/api/datasources --header "Content-Type:application/json" -u admin:admin -d '{"Name": "TDengine","Type": "tdengine","TypeLogoUrl": "public/plugins/tdengine/img/taosdata_logo.png","Access": "proxy","Url": "http://172.15.1.6:6020","BasicAuth": false,"isDefault": true,"jsonData": {},"readOnly": false}'
|
||||
curl -X POST http://localhost:3000/api/datasources --header "Content-Type:application/json" -u admin:admin -d '{"Name": "TDengine","Type": "tdengine","TypeLogoUrl": "public/plugins/tdengine/img/taosdata_logo.png","Access": "proxy","Url": "http://172.15.1.6:6041","BasicAuth": false,"isDefault": true,"jsonData": {},"readOnly": false}'
|
||||
|
||||
curl -X POST http://localhost:3000/api/dashboards/db --header "Content-Type:application/json" -u admin:admin -d '{"dashboard":{"annotations":{"list":[{"builtIn":1,"datasource":"-- Grafana --","enable":true,"hide":true,"iconColor":"rgba(0, 211, 255, 1)","name":"Annotations & Alerts","type":"dashboard"}]},"editable":true,"gnetId":null,"graphTooltip":0,"id":1,"links":[],"panels":[{"datasource":null,"gridPos":{"h":8,"w":6,"x":0,"y":0},"id":6,"options":{"fieldOptions":{"calcs":["mean"],"defaults":{"color":{"mode":"thresholds"},"links":[{"title":"","url":""}],"mappings":[],"max":100,"min":0,"thresholds":{"mode":"absolute","steps":[{"color":"green","value":null},{"color":"red","value":80}]},"unit":"percent"},"overrides":[],"values":false},"orientation":"auto","showThresholdLabels":false,"showThresholdMarkers":true},"pluginVersion":"6.6.0","targets":[{"refId":"A","sql":"select last_row(value) from telegraf.mem where field=\"used_percent\""}],"timeFrom":null,"timeShift":null,"title":"Memory used percent","type":"gauge"},{"aliasColors":{},"bars":false,"dashLength":10,"dashes":false,"datasource":null,"fill":1,"fillGradient":0,"gridPos":{"h":8,"w":12,"x":6,"y":0},"hiddenSeries":false,"id":8,"legend":{"avg":false,"current":false,"max":false,"min":false,"show":true,"total":false,"values":false},"lines":true,"linewidth":1,"nullPointMode":"null","options":{"dataLinks":[]},"percentage":false,"pointradius":2,"points":false,"renderer":"flot","seriesOverrides":[],"spaceLength":10,"stack":false,"steppedLine":false,"targets":[{"alias":"MEMUSED-PERCENT","refId":"A","sql":"select avg(value) from telegraf.mem where field=\"used_percent\" interval(1m)"}],"thresholds":[],"timeFrom":null,"timeRegions":[],"timeShift":null,"title":"MEM","tooltip":{"shared":true,"sort":0,"value_type":"individual"},"type":"graph","xaxis":{"buckets":null,"mode":"time","name":null,"show":true,"values":[]},"yaxes":[{"format":"short","label":null,"logBase":1,"max":null,"min":null,"show":true},{"format":"short","label":null,"logBase":1,"max":null,"min":null,"show":true}],"yaxis":{"align":false,"alignLevel":null}},{"datasource":null,"gridPos":{"h":3,"w":18,"x":0,"y":8},"id":10,"options":{"displayMode":"lcd","fieldOptions":{"calcs":["mean"],"defaults":{"mappings":[],"thresholds":{"mode":"absolute","steps":[{"color":"green","value":null}]},"unit":"percent"},"overrides":[],"values":false},"orientation":"auto","showUnfilled":true},"pluginVersion":"6.6.0","targets":[{"alias":"CPU-SYS","refId":"A","sql":"select last_row(value) from telegraf.cpu where field=\"usage_system\""},{"alias":"CPU-IDLE","refId":"B","sql":"select last_row(value) from telegraf.cpu where field=\"usage_idle\""},{"alias":"CPU-USER","refId":"C","sql":"select last_row(value) from telegraf.cpu where field=\"usage_user\""}],"timeFrom":null,"timeShift":null,"title":"CPU-USED","type":"bargauge"},{"aliasColors":{},"bars":false,"dashLength":10,"dashes":false,"datasource":"TDengine","description":"General CPU monitor","fill":1,"fillGradient":0,"gridPos":{"h":9,"w":18,"x":0,"y":11},"hiddenSeries":false,"id":2,"legend":{"avg":false,"current":false,"max":false,"min":false,"show":true,"total":false,"values":false},"lines":true,"linewidth":1,"nullPointMode":"null","options":{"dataLinks":[]},"percentage":false,"pointradius":2,"points":false,"renderer":"flot","seriesOverrides":[],"spaceLength":10,"stack":false,"steppedLine":false,"targets":[{"alias":"CPU-USER","refId":"A","sql":"select avg(value) from telegraf.cpu where field=\"usage_user\" and cpu=\"cpu-total\" interval(1m)"},{"alias":"CPU-SYS","refId":"B","sql":"select avg(value) from telegraf.cpu where field=\"usage_system\" and cpu=\"cpu-total\" interval(1m)"},{"alias":"CPU-IDLE","refId":"C","sql":"select avg(value) from telegraf.cpu where field=\"usage_idle\" and cpu=\"cpu-total\" interval(1m)"}],"thresholds":[],"timeFrom":null,"timeRegions":[],"timeShift":null,"title":"CPU","tooltip":{"shared":true,"sort":0,"value_type":"individual"},"type":"graph","xaxis":{"buckets":null,"mode":"time","name":null,"show":true,"values":[]},"yaxes":[{"format":"short","label":null,"logBase":1,"max":null,"min":null,"show":true},{"format":"short","label":null,"logBase":1,"max":null,"min":null,"show":true}],"yaxis":{"align":false,"alignLevel":null}}],"refresh":"10s","schemaVersion":22,"style":"dark","tags":["demo"],"templating":{"list":[]},"time":{"from":"now-3h","to":"now"},"timepicker":{"refresh_intervals":["5s","10s","30s","1m","5m","15m","30m","1h","2h","1d"]},"timezone":"","title":"TDengineDashboardDemo","id":null,"uid":null,"version":0}}'
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
debugFlag 135
|
|
@ -5,14 +5,13 @@ WORKDIR /root
|
|||
COPY tdengine.tar.gz /root/
|
||||
RUN tar -zxf tdengine.tar.gz
|
||||
WORKDIR /root/TDengine-server/
|
||||
RUN sh install.sh
|
||||
RUN sh install.sh -e no
|
||||
|
||||
|
||||
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib"
|
||||
ENV LANG=en_US.UTF-8
|
||||
ENV LANGUAGE=en_US:en
|
||||
ENV LC_ALL=en_US.UTF-8
|
||||
EXPOSE 6020 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042
|
||||
EXPOSE 6043 6044 6045 6046 6047 6048 6049 6050
|
||||
EXPOSE 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041
|
||||
CMD ["taosd"]
|
||||
VOLUME [ "/var/lib/taos", "/var/log/taos","/etc/taos/" ]
|
||||
|
|
|
@ -2,5 +2,5 @@
|
|||
set -x
|
||||
$1
|
||||
docker build --rm -f "Dockerfile" -t tdengine/tdengine:$1 "."
|
||||
docker login -u tdengine -p ******** #replace the docker registry username and password
|
||||
docker push tdengine/tdengine:$1
|
||||
docker login -u tdengine -p $2 #replace the docker registry username and password
|
||||
docker push tdengine/tdengine:$1
|
||||
|
|
|
@ -2379,10 +2379,11 @@ static void bottom_func_second_merge(SQLFunctionCtx *pCtx) {
|
|||
|
||||
// the intermediate result is binary, we only use the output data type
|
||||
for (int32_t i = 0; i < pInput->num; ++i) {
|
||||
do_bottom_function_add(pOutput, pCtx->param[0].i64Key, &pInput->res[i]->v.i64Key, pInput->res[i]->timestamp,
|
||||
pCtx->outputType, &pCtx->tagInfo, pInput->res[i]->pTags, pCtx->currentStage);
|
||||
int16_t type = (pCtx->outputType == TSDB_DATA_TYPE_FLOAT) ? TSDB_DATA_TYPE_DOUBLE : pCtx->outputType;
|
||||
do_bottom_function_add(pOutput, pCtx->param[0].i64Key, &pInput->res[i]->v.i64Key, pInput->res[i]->timestamp, type,
|
||||
&pCtx->tagInfo, pInput->res[i]->pTags, pCtx->currentStage);
|
||||
}
|
||||
|
||||
|
||||
SET_VAL(pCtx, pInput->num, pOutput->num);
|
||||
|
||||
if (pOutput->num > 0) {
|
||||
|
|
|
@ -220,15 +220,16 @@ static void tscProcessStreamRetrieveResult(void *param, TAOS_RES *res, int numOf
|
|||
STableMetaInfo *pTableMetaInfo = tscGetTableMetaInfoFromCmd(&pSql->cmd, 0, 0);
|
||||
|
||||
if (numOfRows > 0) { // when reaching here the first execution of stream computing is successful.
|
||||
pStream->numOfRes += numOfRows;
|
||||
for(int32_t i = 0; i < numOfRows; ++i) {
|
||||
TAOS_ROW row = taos_fetch_row(res);
|
||||
tscDebug("%p stream:%p fetch result", pSql, pStream);
|
||||
tscStreamFillTimeGap(pStream, *(TSKEY*)row[0]);
|
||||
pStream->stime = *(TSKEY *)row[0];
|
||||
|
||||
// user callback function
|
||||
(*pStream->fp)(pStream->param, res, row);
|
||||
if (row != NULL) {
|
||||
tscDebug("%p stream:%p fetch result", pSql, pStream);
|
||||
tscStreamFillTimeGap(pStream, *(TSKEY*)row[0]);
|
||||
pStream->stime = *(TSKEY *)row[0];
|
||||
// user callback function
|
||||
(*pStream->fp)(pStream->param, res, row);
|
||||
pStream->numOfRes++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!pStream->isProject) {
|
||||
|
|
|
@ -203,6 +203,7 @@ static void tscProcessSubscriptionTimer(void *handle, void *tmrId) {
|
|||
|
||||
static SArray* getTableList( SSqlObj* pSql ) {
|
||||
const char* p = strstr( pSql->sqlstr, " from " );
|
||||
assert(p != NULL); // we are sure this is a 'select' statement
|
||||
char* sql = alloca(strlen(p) + 32);
|
||||
sprintf(sql, "select tbid(tbname)%s", p);
|
||||
|
||||
|
|
|
@ -126,7 +126,7 @@ int32_t tsMnodeEqualVnodeNum = 4;
|
|||
// restful
|
||||
int32_t tsEnableHttpModule = 1;
|
||||
int32_t tsRestRowLimit = 10240;
|
||||
uint16_t tsHttpPort = 6020; // only tcp, range tcp[6020]
|
||||
uint16_t tsHttpPort = 6041; // only tcp, range tcp[6041]
|
||||
int32_t tsHttpCacheSessions = 1000;
|
||||
int32_t tsHttpSessionExpire = 36000;
|
||||
int32_t tsHttpMaxThreads = 2;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<div class="gf-form-group">
|
||||
<div class="gf-form max-width-30">
|
||||
<span class="gf-form-label width-7">Host</span>
|
||||
<input type="text" class="gf-form-input" ng-model='ctrl.current.url' placeholder="http://localhost:6020" bs-typeahead="{{['http://localhost:6020']}}" required></input>
|
||||
<input type="text" class="gf-form-input" ng-model='ctrl.current.url' placeholder="http://localhost:6041" bs-typeahead="{{['http://localhost:6041']}}" required></input>
|
||||
</div>
|
||||
|
||||
<div class="gf-form-inline">
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<div class="gf-form-group">
|
||||
<div class="gf-form max-width-30">
|
||||
<span class="gf-form-label width-7">Host</span>
|
||||
<input type="text" class="gf-form-input" ng-model='ctrl.current.url' placeholder="http://localhost:6020" bs-typeahead="{{['http://localhost:6020']}}" required></input>
|
||||
<input type="text" class="gf-form-input" ng-model='ctrl.current.url' placeholder="http://localhost:6041" bs-typeahead="{{['http://localhost:6041']}}" required></input>
|
||||
</div>
|
||||
|
||||
<div class="gf-form-inline">
|
||||
|
|
|
@ -33,7 +33,7 @@ static pthread_t tsTelemetryThread;
|
|||
|
||||
#define TELEMETRY_SERVER "telemetry.taosdata.com"
|
||||
#define TELEMETRY_PORT 80
|
||||
#define REPORT_INTERVAL 86400
|
||||
#define REPORT_INTERVAL 86400
|
||||
|
||||
static void beginObject(SBufferWriter* bw) {
|
||||
tbufWriteChar(bw, '{');
|
||||
|
@ -220,28 +220,34 @@ static void sendTelemetryReport() {
|
|||
taosWriteSocket(fd, tbufGetData(&bw, false), contLen);
|
||||
tbufCloseWriter(&bw);
|
||||
|
||||
taosReadSocket(fd, buf, 10); // read something to avoid nginx error 499
|
||||
// read something to avoid nginx error 499
|
||||
if (taosReadSocket(fd, buf, 10) < 0) {
|
||||
dTrace("failed to receive response, reason:%s", strerror(errno));
|
||||
}
|
||||
taosCloseSocket(fd);
|
||||
}
|
||||
|
||||
static void* telemetryThread(void* param) {
|
||||
int timeToWait = 0;
|
||||
struct timespec end = {0};
|
||||
clock_gettime(CLOCK_REALTIME, &end);
|
||||
end.tv_sec += 300; // wait 5 minutes to send first report
|
||||
|
||||
while (1) {
|
||||
if (timeToWait <= 0) {
|
||||
if (sdbIsMaster()) {
|
||||
sendTelemetryReport();
|
||||
while (1) {
|
||||
if (sem_timedwait(&tsExitSem, &end) == 0) {
|
||||
return NULL;
|
||||
}
|
||||
struct timespec now = {0};
|
||||
clock_gettime(CLOCK_REALTIME, &now);
|
||||
if (now.tv_sec > end.tv_sec || (now.tv_sec == end.tv_sec && now.tv_nsec >= end.tv_nsec)) {
|
||||
break;
|
||||
}
|
||||
timeToWait = REPORT_INTERVAL;
|
||||
}
|
||||
|
||||
int startAt = taosGetTimestampSec();
|
||||
struct timespec timeout = {.tv_sec = 0, .tv_nsec = 0};
|
||||
clock_gettime(CLOCK_REALTIME, &timeout);
|
||||
timeout.tv_sec += timeToWait;
|
||||
if (sem_timedwait(&tsExitSem, &timeout) == 0) {
|
||||
break;
|
||||
if (sdbIsMaster()) {
|
||||
sendTelemetryReport();
|
||||
}
|
||||
timeToWait -= (taosGetTimestampSec() - startAt);
|
||||
end.tv_sec += REPORT_INTERVAL;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <iconv.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "os.h"
|
||||
#include "taos.h"
|
||||
#include "taosdef.h"
|
||||
#include "taosmsg.h"
|
||||
|
@ -191,7 +192,7 @@ struct arguments {
|
|||
char *user;
|
||||
char *password;
|
||||
uint16_t port;
|
||||
char cversion[TSDB_FILENAME_LEN+1];
|
||||
char cversion[12];
|
||||
uint16_t mysqlFlag;
|
||||
// output file
|
||||
char outpath[TSDB_FILENAME_LEN+1];
|
||||
|
@ -248,7 +249,7 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) {
|
|||
fprintf(stderr, "Invalid client vesion %s\n", arg);
|
||||
return -1;
|
||||
}
|
||||
strcpy(arguments->cversion, full_path.we_wordv[0]);
|
||||
tstrncpy(arguments->cversion, full_path.we_wordv[0], 11);
|
||||
wordfree(&full_path);
|
||||
break;
|
||||
// output file path
|
||||
|
@ -257,7 +258,7 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) {
|
|||
fprintf(stderr, "Invalid path %s\n", arg);
|
||||
return -1;
|
||||
}
|
||||
strcpy(arguments->outpath, full_path.we_wordv[0]);
|
||||
tstrncpy(arguments->outpath, full_path.we_wordv[0], TSDB_FILENAME_LEN);
|
||||
wordfree(&full_path);
|
||||
break;
|
||||
case 'i':
|
||||
|
@ -266,7 +267,7 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) {
|
|||
fprintf(stderr, "Invalid path %s\n", arg);
|
||||
return -1;
|
||||
}
|
||||
strcpy(arguments->inpath, full_path.we_wordv[0]);
|
||||
tstrncpy(arguments->inpath, full_path.we_wordv[0], TSDB_FILENAME_LEN);
|
||||
wordfree(&full_path);
|
||||
break;
|
||||
case 'c':
|
||||
|
@ -274,7 +275,7 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) {
|
|||
fprintf(stderr, "Invalid path %s\n", arg);
|
||||
return -1;
|
||||
}
|
||||
strcpy(configDir, full_path.we_wordv[0]);
|
||||
tstrncpy(configDir, full_path.we_wordv[0], TSDB_FILENAME_LEN);
|
||||
wordfree(&full_path);
|
||||
break;
|
||||
case 'e':
|
||||
|
@ -430,7 +431,7 @@ int main(int argc, char *argv[]) {
|
|||
printf("==============================\n");
|
||||
|
||||
if (tsArguments.cversion[0] != 0){
|
||||
strcpy(version, tsArguments.cversion);
|
||||
tstrncpy(version, tsArguments.cversion, 11);
|
||||
}
|
||||
|
||||
if (taosCheckParam(&tsArguments) < 0) {
|
||||
|
@ -513,7 +514,7 @@ int taosGetTableRecordInfo(char *table, STableRecordInfo *pTableRecordInfo, TAOS
|
|||
while ((row = taos_fetch_row(result)) != NULL) {
|
||||
isSet = true;
|
||||
pTableRecordInfo->isMetric = true;
|
||||
strcpy(pTableRecordInfo->tableRecord.metric, table);
|
||||
tstrncpy(pTableRecordInfo->tableRecord.metric, table, TSDB_TABLE_NAME_LEN);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -541,9 +542,9 @@ int32_t taosSaveAllNormalTableToTempFile(TAOS *taosCon, char*meter, char* metric
|
|||
}
|
||||
}
|
||||
|
||||
memset(tableRecord.name, 0, sizeof(STableRecord));
|
||||
strcpy(tableRecord.name, meter);
|
||||
strcpy(tableRecord.metric, metric);
|
||||
memset(&tableRecord, 0, sizeof(STableRecord));
|
||||
tstrncpy(tableRecord.name, meter, TSDB_TABLE_NAME_LEN);
|
||||
tstrncpy(tableRecord.metric, metric, TSDB_TABLE_NAME_LEN);
|
||||
|
||||
taosTWrite(*fd, &tableRecord, sizeof(STableRecord));
|
||||
return 0;
|
||||
|
@ -587,7 +588,7 @@ int32_t taosSaveTableOfMetricToTempFile(TAOS *taosCon, char* metric, struct argu
|
|||
taos_free_result(result);
|
||||
for (int32_t loopCnt = 0; loopCnt < numOfThread; loopCnt++) {
|
||||
sprintf(tmpFileName, ".tables.tmp.%d", loopCnt);
|
||||
remove(tmpFileName);
|
||||
(void)remove(tmpFileName);
|
||||
}
|
||||
free(tmpCommand);
|
||||
return -1;
|
||||
|
@ -596,9 +597,9 @@ int32_t taosSaveTableOfMetricToTempFile(TAOS *taosCon, char* metric, struct argu
|
|||
numOfThread++;
|
||||
}
|
||||
|
||||
memset(tableRecord.name, 0, sizeof(STableRecord));
|
||||
strncpy(tableRecord.name, (char *)row[0], fields[0].bytes);
|
||||
strcpy(tableRecord.metric, metric);
|
||||
memset(&tableRecord, 0, sizeof(STableRecord));
|
||||
tstrncpy(tableRecord.name, (char *)row[0], fields[0].bytes);
|
||||
tstrncpy(tableRecord.metric, metric, TSDB_TABLE_NAME_LEN);
|
||||
|
||||
taosTWrite(fd, &tableRecord, sizeof(STableRecord));
|
||||
|
||||
|
@ -606,12 +607,16 @@ int32_t taosSaveTableOfMetricToTempFile(TAOS *taosCon, char* metric, struct argu
|
|||
|
||||
if (numOfTable >= arguments->table_batch) {
|
||||
numOfTable = 0;
|
||||
taosClose(fd);
|
||||
close(fd);
|
||||
fd = -1;
|
||||
}
|
||||
}
|
||||
taosClose(fd);
|
||||
fd = -1;
|
||||
|
||||
if (fd >= 0) {
|
||||
close(fd);
|
||||
fd = -1;
|
||||
}
|
||||
|
||||
taos_free_result(result);
|
||||
|
||||
*totalNumOfThread = numOfThread;
|
||||
|
@ -846,13 +851,14 @@ int taosGetTableDes(char *table, STableDef *tableDes, TAOS* taosCon, bool isSupe
|
|||
if (code != 0) {
|
||||
fprintf(stderr, "failed to run command %s\n", tempCommand);
|
||||
free(tempCommand);
|
||||
free(tbuf);
|
||||
taos_free_result(tmpResult);
|
||||
return -1;
|
||||
}
|
||||
|
||||
TAOS_FIELD *fields = taos_fetch_fields(tmpResult);
|
||||
|
||||
strcpy(tableDes->name, table);
|
||||
tstrncpy(tableDes->name, table, TSDB_COL_NAME_LEN);
|
||||
|
||||
while ((row = taos_fetch_row(tmpResult)) != NULL) {
|
||||
strncpy(tableDes->cols[count].field, (char *)row[TSDB_DESCRIBE_METRIC_FIELD_INDEX],
|
||||
|
@ -871,6 +877,7 @@ int taosGetTableDes(char *table, STableDef *tableDes, TAOS* taosCon, bool isSupe
|
|||
|
||||
if (isSuperTable) {
|
||||
free(tempCommand);
|
||||
free(tbuf);
|
||||
return count;
|
||||
}
|
||||
|
||||
|
@ -886,6 +893,7 @@ int taosGetTableDes(char *table, STableDef *tableDes, TAOS* taosCon, bool isSupe
|
|||
if (code != 0) {
|
||||
fprintf(stderr, "failed to run command %s\n", tempCommand);
|
||||
free(tempCommand);
|
||||
free(tbuf);
|
||||
taos_free_result(tmpResult);
|
||||
return -1;
|
||||
}
|
||||
|
@ -896,6 +904,7 @@ int taosGetTableDes(char *table, STableDef *tableDes, TAOS* taosCon, bool isSupe
|
|||
if (NULL == row) {
|
||||
fprintf(stderr, " fetch failed to run command %s\n", tempCommand);
|
||||
free(tempCommand);
|
||||
free(tbuf);
|
||||
taos_free_result(tmpResult);
|
||||
return -1;
|
||||
}
|
||||
|
@ -956,6 +965,7 @@ int taosGetTableDes(char *table, STableDef *tableDes, TAOS* taosCon, bool isSupe
|
|||
}
|
||||
|
||||
free(tempCommand);
|
||||
free(tbuf);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
@ -1056,6 +1066,7 @@ void* taosDumpOutWorkThreadFp(void *arg)
|
|||
fp = fopen(tmpFileName, "w");
|
||||
if (fp == NULL) {
|
||||
fprintf(stderr, "failed to open file %s\n", tmpFileName);
|
||||
close(fd);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1067,16 +1078,20 @@ void* taosDumpOutWorkThreadFp(void *arg)
|
|||
if (code != 0) {
|
||||
fprintf(stderr, "invalid database %s\n", pThread->dbName);
|
||||
taos_free_result(tmpResult);
|
||||
fclose(fp);
|
||||
close(fd);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
fprintf(fp, "USE %s\n\n", pThread->dbName);
|
||||
while (read(fd, &tableRecord, sizeof(STableRecord)) > 0) {
|
||||
while (1) {
|
||||
ssize_t readLen = read(fd, &tableRecord, sizeof(STableRecord));
|
||||
if (readLen <= 0) break;
|
||||
taosDumpTable(tableRecord.name, tableRecord.metric, &tsArguments, fp, pThread->taosCon);
|
||||
}
|
||||
|
||||
taos_free_result(tmpResult);
|
||||
taosClose(fd);
|
||||
close(fd);
|
||||
fclose(fp);
|
||||
|
||||
return NULL;
|
||||
|
@ -1090,7 +1105,7 @@ static void taosStartDumpOutWorkThreads(struct arguments* args, int32_t numOfTh
|
|||
SThreadParaObj *pThread = threadObj + t;
|
||||
pThread->threadIndex = t;
|
||||
pThread->totalThreads = numOfThread;
|
||||
strcpy(pThread->dbName, dbName);
|
||||
tstrncpy(pThread->dbName, dbName, TSDB_TABLE_NAME_LEN);
|
||||
pThread->taosCon = taos_connect(args->host, args->user, args->password, NULL, args->port);
|
||||
|
||||
if (pThread->taosCon == NULL) {
|
||||
|
@ -1189,7 +1204,7 @@ int32_t taosDumpCreateSuperTableClause(TAOS* taosCon, char* dbName, FILE *fp)
|
|||
fprintf(stderr, "failed to open temp file: %s\n", tmpFileName);
|
||||
taos_free_result(tmpResult);
|
||||
free(tmpCommand);
|
||||
remove(".stables.tmp");
|
||||
(void)remove(".stables.tmp");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
|
@ -1200,14 +1215,17 @@ int32_t taosDumpCreateSuperTableClause(TAOS* taosCon, char* dbName, FILE *fp)
|
|||
}
|
||||
|
||||
taos_free_result(tmpResult);
|
||||
lseek(fd, 0, SEEK_SET);
|
||||
(void)lseek(fd, 0, SEEK_SET);
|
||||
|
||||
while (read(fd, &tableRecord, sizeof(STableRecord)) > 0) {
|
||||
while (1) {
|
||||
ssize_t readLen = read(fd, &tableRecord, sizeof(STableRecord));
|
||||
if (readLen <= 0) break;
|
||||
|
||||
(void)taosDumpStable(tableRecord.name, fp, taosCon);
|
||||
}
|
||||
|
||||
taosClose(fd);
|
||||
remove(".stables.tmp");
|
||||
close(fd);
|
||||
(void)remove(".stables.tmp");
|
||||
|
||||
free(tmpCommand);
|
||||
return 0;
|
||||
|
@ -1269,7 +1287,7 @@ int taosDumpDb(SDbInfo *dbInfo, struct arguments *arguments, FILE *fp, TAOS *tao
|
|||
taos_free_result(tmpResult);
|
||||
for (int32_t loopCnt = 0; loopCnt < numOfThread; loopCnt++) {
|
||||
sprintf(tmpFileName, ".tables.tmp.%d", loopCnt);
|
||||
remove(tmpFileName);
|
||||
(void)remove(tmpFileName);
|
||||
}
|
||||
free(tmpCommand);
|
||||
return -1;
|
||||
|
@ -1279,8 +1297,8 @@ int taosDumpDb(SDbInfo *dbInfo, struct arguments *arguments, FILE *fp, TAOS *tao
|
|||
}
|
||||
|
||||
memset(&tableRecord, 0, sizeof(STableRecord));
|
||||
strncpy(tableRecord.name, (char *)row[TSDB_SHOW_TABLES_NAME_INDEX], fields[TSDB_SHOW_TABLES_NAME_INDEX].bytes);
|
||||
strncpy(tableRecord.metric, (char *)row[TSDB_SHOW_TABLES_METRIC_INDEX], fields[TSDB_SHOW_TABLES_METRIC_INDEX].bytes);
|
||||
tstrncpy(tableRecord.name, (char *)row[TSDB_SHOW_TABLES_NAME_INDEX], fields[TSDB_SHOW_TABLES_NAME_INDEX].bytes);
|
||||
tstrncpy(tableRecord.metric, (char *)row[TSDB_SHOW_TABLES_METRIC_INDEX], fields[TSDB_SHOW_TABLES_METRIC_INDEX].bytes);
|
||||
|
||||
taosTWrite(fd, &tableRecord, sizeof(STableRecord));
|
||||
|
||||
|
@ -1288,19 +1306,23 @@ int taosDumpDb(SDbInfo *dbInfo, struct arguments *arguments, FILE *fp, TAOS *tao
|
|||
|
||||
if (numOfTable >= arguments->table_batch) {
|
||||
numOfTable = 0;
|
||||
taosClose(fd);
|
||||
close(fd);
|
||||
fd = -1;
|
||||
}
|
||||
}
|
||||
taosClose(fd);
|
||||
fd = -1;
|
||||
|
||||
if (fd >= 0) {
|
||||
close(fd);
|
||||
fd = -1;
|
||||
}
|
||||
|
||||
taos_free_result(tmpResult);
|
||||
|
||||
// start multi threads to dumpout
|
||||
taosStartDumpOutWorkThreads(arguments, numOfThread, dbInfo->name);
|
||||
for (int loopCnt = 0; loopCnt < numOfThread; loopCnt++) {
|
||||
sprintf(tmpFileName, ".tables.tmp.%d", loopCnt);
|
||||
remove(tmpFileName);
|
||||
(void)remove(tmpFileName);
|
||||
}
|
||||
|
||||
free(tmpCommand);
|
||||
|
@ -1718,6 +1740,10 @@ int convertNCharToReadable(char *str, int size, char *buf, int bufsize) {
|
|||
while (size > 0) {
|
||||
if (*pstr == '\0') break;
|
||||
int byte_width = mbtowc(&wc, pstr, MB_CUR_MAX);
|
||||
if (byte_width < 0) {
|
||||
fprintf(stderr, "mbtowc() return fail.\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if ((int)wc < 256) {
|
||||
pbuf = stpcpy(pbuf, ascii_literal_list[(int)wc]);
|
||||
|
@ -1736,16 +1762,16 @@ int convertNCharToReadable(char *str, int size, char *buf, int bufsize) {
|
|||
void taosDumpCharset(FILE *fp) {
|
||||
char charsetline[256];
|
||||
|
||||
fseek(fp, 0, SEEK_SET);
|
||||
(void)fseek(fp, 0, SEEK_SET);
|
||||
sprintf(charsetline, "#!%s\n", tsCharset);
|
||||
fwrite(charsetline, strlen(charsetline), 1, fp);
|
||||
(void)fwrite(charsetline, strlen(charsetline), 1, fp);
|
||||
}
|
||||
|
||||
void taosLoadFileCharset(FILE *fp, char *fcharset) {
|
||||
char * line = NULL;
|
||||
size_t line_size = 0;
|
||||
|
||||
fseek(fp, 0, SEEK_SET);
|
||||
(void)fseek(fp, 0, SEEK_SET);
|
||||
ssize_t size = getline(&line, &line_size, fp);
|
||||
if (size <= 2) {
|
||||
goto _exit_no_charset;
|
||||
|
@ -1764,7 +1790,7 @@ void taosLoadFileCharset(FILE *fp, char *fcharset) {
|
|||
return;
|
||||
|
||||
_exit_no_charset:
|
||||
fseek(fp, 0, SEEK_SET);
|
||||
(void)fseek(fp, 0, SEEK_SET);
|
||||
*fcharset = '\0';
|
||||
taosTFree(line);
|
||||
return;
|
||||
|
@ -1814,7 +1840,7 @@ static void taosParseDirectory(const char *directoryName, const char *prefix, ch
|
|||
}
|
||||
|
||||
int fileNum = 0;
|
||||
while (fscanf(fp, "%s", fileArray[fileNum++])) {
|
||||
while (fscanf(fp, "%128s", fileArray[fileNum++])) {
|
||||
if (strcmp(fileArray[fileNum-1], tsDbSqlFile) == 0) {
|
||||
fileNum--;
|
||||
}
|
||||
|
@ -1825,6 +1851,7 @@ static void taosParseDirectory(const char *directoryName, const char *prefix, ch
|
|||
|
||||
if (fileNum != totalFiles) {
|
||||
fprintf(stderr, "ERROR: directory:%s changed while read\n", directoryName);
|
||||
pclose(fp);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
@ -1842,7 +1869,7 @@ static void taosCheckTablesSQLFile(const char *directoryName)
|
|||
exit(0);
|
||||
}
|
||||
|
||||
while (fscanf(fp, "%s", tsDbSqlFile)) {
|
||||
while (fscanf(fp, "%128s", tsDbSqlFile)) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1900,20 +1927,6 @@ static FILE* taosOpenDumpInFile(char *fptr) {
|
|||
|
||||
char *fname = full_path.we_wordv[0];
|
||||
|
||||
if (access(fname, F_OK) != 0) {
|
||||
fprintf(stderr, "ERROR: file %s is not exist\n", fptr);
|
||||
|
||||
wordfree(&full_path);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (access(fname, R_OK) != 0) {
|
||||
fprintf(stderr, "ERROR: file %s is not readable\n", fptr);
|
||||
|
||||
wordfree(&full_path);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
FILE *f = fopen(fname, "r");
|
||||
if (f == NULL) {
|
||||
fprintf(stderr, "ERROR: failed to open file %s\n", fname);
|
||||
|
|
|
@ -43,7 +43,7 @@ typedef struct Arguments {
|
|||
|
||||
static struct argp_option options[] = {
|
||||
{0, 'h', "host", 0, "The host to connect to TDEngine. Default is localhost.", 0},
|
||||
{0, 'p', "port", 0, "The TCP or UDP port number to use for the connection. Default is 6020.", 1},
|
||||
{0, 'p', "port", 0, "The TCP or UDP port number to use for the connection. Default is 6041.", 1},
|
||||
{0, 'm', "max port", 0, "The max TCP or UDP port number to use for the connection. Default is 6050.", 2}};
|
||||
|
||||
static error_t parse_opt(int key, char *arg, struct argp_state *state) {
|
||||
|
@ -145,7 +145,7 @@ void *checkUPort(void *sarg) {
|
|||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
SArguments arguments = {"127.0.0.1", 6020, 6050};
|
||||
SArguments arguments = {"127.0.0.1", 6041, 6050};
|
||||
|
||||
argp_parse(&argp, argc, argv, 0, 0, &arguments);
|
||||
|
||||
|
|
|
@ -44,6 +44,10 @@ extern int tsdbDebugFlag;
|
|||
#define TSDB_FILE_DELIMITER 0xF00AFA0F
|
||||
#define TSDB_FILE_INIT_MAGIC 0xFFFFFFFF
|
||||
|
||||
// NOTE: Any file format change must increase this version number by 1
|
||||
// Also, implement the convert function
|
||||
#define TSDB_FILE_VERSION ((uint32_t)0)
|
||||
|
||||
// Definitions
|
||||
// ------------------ tsdbMeta.c
|
||||
typedef struct STable {
|
||||
|
@ -443,7 +447,7 @@ void tsdbCloseFile(SFile* pFile);
|
|||
int tsdbCreateFile(SFile* pFile, STsdbRepo* pRepo, int fid, int type);
|
||||
SFileGroup* tsdbSearchFGroup(STsdbFileH* pFileH, int fid, int flags);
|
||||
void tsdbFitRetention(STsdbRepo* pRepo);
|
||||
int tsdbUpdateFileHeader(SFile* pFile, uint32_t version);
|
||||
int tsdbUpdateFileHeader(SFile* pFile);
|
||||
int tsdbEncodeSFileInfo(void** buf, const STsdbFileInfo* pInfo);
|
||||
void* tsdbDecodeSFileInfo(void* buf, STsdbFileInfo* pInfo);
|
||||
void tsdbRemoveFileGroup(STsdbRepo* pRepo, SFileGroup* pFGroup);
|
||||
|
|
|
@ -247,11 +247,14 @@ int tsdbOpenFile(SFile *pFile, int oflag) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
tsdbTrace("open file %s, fd %d", pFile->fname, pFile->fd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void tsdbCloseFile(SFile *pFile) {
|
||||
if (TSDB_IS_FILE_OPENED(pFile)) {
|
||||
tsdbTrace("close file %s, fd %d", pFile->fname, pFile->fd);
|
||||
close(pFile->fd);
|
||||
pFile->fd = -1;
|
||||
}
|
||||
|
@ -276,7 +279,7 @@ int tsdbCreateFile(SFile *pFile, STsdbRepo *pRepo, int fid, int type) {
|
|||
pFile->info.size = TSDB_FILE_HEAD_SIZE;
|
||||
pFile->info.magic = TSDB_FILE_INIT_MAGIC;
|
||||
|
||||
if (tsdbUpdateFileHeader(pFile, 0) < 0) {
|
||||
if (tsdbUpdateFileHeader(pFile) < 0) {
|
||||
tsdbCloseFile(pFile);
|
||||
return -1;
|
||||
}
|
||||
|
@ -313,11 +316,11 @@ void tsdbFitRetention(STsdbRepo *pRepo) {
|
|||
pthread_rwlock_unlock(&(pFileH->fhlock));
|
||||
}
|
||||
|
||||
int tsdbUpdateFileHeader(SFile *pFile, uint32_t version) {
|
||||
int tsdbUpdateFileHeader(SFile *pFile) {
|
||||
char buf[TSDB_FILE_HEAD_SIZE] = "\0";
|
||||
|
||||
void *pBuf = (void *)buf;
|
||||
taosEncodeFixedU32((void *)(&pBuf), version);
|
||||
taosEncodeFixedU32((void *)(&pBuf), TSDB_FILE_VERSION);
|
||||
tsdbEncodeSFileInfo((void *)(&pBuf), &(pFile->info));
|
||||
|
||||
taosCalcChecksumAppend(0, (uint8_t *)buf, TSDB_FILE_HEAD_SIZE);
|
||||
|
@ -409,6 +412,11 @@ static int tsdbInitFile(SFile *pFile, STsdbRepo *pRepo, int fid, int type) {
|
|||
pBuf = taosDecodeFixedU32(pBuf, &version);
|
||||
pBuf = tsdbDecodeSFileInfo(pBuf, &(pFile->info));
|
||||
|
||||
if (version != TSDB_FILE_VERSION) {
|
||||
tsdbError("vgId:%d file %s version %u is not the same as program version %u which may cause problem",
|
||||
REPO_ID(pRepo), pFile->fname, version, TSDB_FILE_VERSION);
|
||||
}
|
||||
|
||||
tsdbCloseFile(pFile);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -132,7 +132,7 @@ int tsdbSetAndOpenHelperFile(SRWHelper *pHelper, SFileGroup *pGroup) {
|
|||
if (tsdbOpenFile(pFile, O_WRONLY | O_CREAT) < 0) return -1;
|
||||
pFile->info.size = TSDB_FILE_HEAD_SIZE;
|
||||
pFile->info.magic = TSDB_FILE_INIT_MAGIC;
|
||||
if (tsdbUpdateFileHeader(pFile, 0) < 0) return -1;
|
||||
if (tsdbUpdateFileHeader(pFile) < 0) return -1;
|
||||
#endif
|
||||
|
||||
// Create and open .h
|
||||
|
@ -140,7 +140,7 @@ int tsdbSetAndOpenHelperFile(SRWHelper *pHelper, SFileGroup *pGroup) {
|
|||
if (tsdbOpenFile(pFile, O_WRONLY | O_CREAT) < 0) return -1;
|
||||
pFile->info.size = TSDB_FILE_HEAD_SIZE;
|
||||
pFile->info.magic = TSDB_FILE_INIT_MAGIC;
|
||||
if (tsdbUpdateFileHeader(pFile, 0) < 0) return -1;
|
||||
if (tsdbUpdateFileHeader(pFile) < 0) return -1;
|
||||
|
||||
// Create and open .l file if should
|
||||
if (tsdbShouldCreateNewLast(pHelper)) {
|
||||
|
@ -149,7 +149,7 @@ int tsdbSetAndOpenHelperFile(SRWHelper *pHelper, SFileGroup *pGroup) {
|
|||
pFile->info.size = TSDB_FILE_HEAD_SIZE;
|
||||
pFile->info.magic = TSDB_FILE_INIT_MAGIC;
|
||||
pFile->info.len = 0;
|
||||
if (tsdbUpdateFileHeader(pFile, 0) < 0) return -1;
|
||||
if (tsdbUpdateFileHeader(pFile) < 0) return -1;
|
||||
}
|
||||
} else {
|
||||
if (tsdbOpenFile(helperDataF(pHelper), O_RDONLY) < 0) return -1;
|
||||
|
@ -166,44 +166,36 @@ int tsdbCloseHelperFile(SRWHelper *pHelper, bool hasError) {
|
|||
|
||||
#ifdef TSDB_IDX
|
||||
pFile = helperIdxF(pHelper);
|
||||
if (pFile->fd > 0) {
|
||||
close(pFile->fd);
|
||||
pFile->fd = -1;
|
||||
}
|
||||
tsdbCloseFile(pFile);
|
||||
#endif
|
||||
|
||||
pFile = helperHeadF(pHelper);
|
||||
if (pFile->fd > 0) {
|
||||
close(pFile->fd);
|
||||
pFile->fd = -1;
|
||||
}
|
||||
tsdbCloseFile(pFile);
|
||||
|
||||
pFile = helperDataF(pHelper);
|
||||
if (pFile->fd > 0) {
|
||||
if (helperType(pHelper) == TSDB_WRITE_HELPER) {
|
||||
if (!hasError) {
|
||||
tsdbUpdateFileHeader(pFile, 0);
|
||||
tsdbUpdateFileHeader(pFile);
|
||||
fsync(pFile->fd);
|
||||
} else {
|
||||
// TODO: shrink back to origin
|
||||
}
|
||||
}
|
||||
close(pFile->fd);
|
||||
pFile->fd = -1;
|
||||
tsdbCloseFile(pFile);
|
||||
}
|
||||
|
||||
pFile = helperLastF(pHelper);
|
||||
if (pFile->fd > 0) {
|
||||
if (helperType(pHelper) == TSDB_WRITE_HELPER && !TSDB_NLAST_FILE_OPENED(pHelper)) {
|
||||
if (!hasError) {
|
||||
tsdbUpdateFileHeader(pFile, 0);
|
||||
tsdbUpdateFileHeader(pFile);
|
||||
fsync(pFile->fd);
|
||||
} else {
|
||||
// TODO: shrink back to origin
|
||||
}
|
||||
}
|
||||
close(pFile->fd);
|
||||
pFile->fd = -1;
|
||||
tsdbCloseFile(pFile);
|
||||
}
|
||||
|
||||
if (helperType(pHelper) == TSDB_WRITE_HELPER) {
|
||||
|
@ -211,11 +203,10 @@ int tsdbCloseHelperFile(SRWHelper *pHelper, bool hasError) {
|
|||
pFile = helperNewIdxF(pHelper);
|
||||
if (pFile->fd > 0) {
|
||||
if (!hasError) {
|
||||
tsdbUpdateFileHeader(pFile, 0);
|
||||
tsdbUpdateFileHeader(pFile);
|
||||
fsync(pFile->fd);
|
||||
}
|
||||
close(pFile->fd);
|
||||
pFile->fd = -1;
|
||||
tsdbCloseFile(pFile);
|
||||
if (hasError) (void)remove(pFile->fname);
|
||||
}
|
||||
#endif
|
||||
|
@ -223,22 +214,20 @@ int tsdbCloseHelperFile(SRWHelper *pHelper, bool hasError) {
|
|||
pFile = helperNewHeadF(pHelper);
|
||||
if (pFile->fd > 0) {
|
||||
if (!hasError) {
|
||||
tsdbUpdateFileHeader(pFile, 0);
|
||||
tsdbUpdateFileHeader(pFile);
|
||||
fsync(pFile->fd);
|
||||
}
|
||||
close(pFile->fd);
|
||||
pFile->fd = -1;
|
||||
tsdbCloseFile(pFile);
|
||||
if (hasError) (void)remove(pFile->fname);
|
||||
}
|
||||
|
||||
pFile = helperNewLastF(pHelper);
|
||||
if (pFile->fd > 0) {
|
||||
if (!hasError) {
|
||||
tsdbUpdateFileHeader(pFile, 0);
|
||||
tsdbUpdateFileHeader(pFile);
|
||||
fsync(pFile->fd);
|
||||
}
|
||||
close(pFile->fd);
|
||||
pFile->fd = -1;
|
||||
tsdbCloseFile(pFile);
|
||||
if (hasError) (void)remove(pFile->fname);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,8 @@ extern "C" {
|
|||
|
||||
#include <stdint.h>
|
||||
|
||||
#define KVSTORE_FILE_VERSION ((uint32_t)0)
|
||||
|
||||
typedef int (*iterFunc)(void *, void *cont, int contLen);
|
||||
typedef void (*afterFunc)(void *);
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ static char * tdGetKVStoreSnapshotFname(char *fdata);
|
|||
static char * tdGetKVStoreNewFname(char *fdata);
|
||||
static void tdFreeKVStore(SKVStore *pStore);
|
||||
static int tdUpdateKVStoreHeader(int fd, char *fname, SStoreInfo *pInfo);
|
||||
static int tdLoadKVStoreHeader(int fd, char *fname, SStoreInfo *pInfo);
|
||||
static int tdLoadKVStoreHeader(int fd, char *fname, SStoreInfo *pInfo, uint32_t *version);
|
||||
static int tdEncodeKVRecord(void **buf, SKVRecord *pRecord);
|
||||
static void * tdDecodeKVRecord(void *buf, SKVRecord *pRecord);
|
||||
static int tdRestoreKVStore(SKVStore *pStore);
|
||||
|
@ -91,6 +91,7 @@ int tdDestroyKVStore(char *fname) {
|
|||
|
||||
SKVStore *tdOpenKVStore(char *fname, iterFunc iFunc, afterFunc aFunc, void *appH) {
|
||||
SStoreInfo info = {0};
|
||||
uint32_t version = 0;
|
||||
|
||||
SKVStore *pStore = tdNewKVStore(fname, iFunc, aFunc, appH);
|
||||
if (pStore == NULL) return NULL;
|
||||
|
@ -111,9 +112,14 @@ SKVStore *tdOpenKVStore(char *fname, iterFunc iFunc, afterFunc aFunc, void *appH
|
|||
}
|
||||
} else {
|
||||
uDebug("file %s exists, try to recover the KV store", pStore->fsnap);
|
||||
if (tdLoadKVStoreHeader(pStore->sfd, pStore->fsnap, &info) < 0) {
|
||||
if (tdLoadKVStoreHeader(pStore->sfd, pStore->fsnap, &info, &version) < 0) {
|
||||
if (terrno != TSDB_CODE_COM_FILE_CORRUPTED) goto _err;
|
||||
} else {
|
||||
if (version != KVSTORE_FILE_VERSION) {
|
||||
uError("file %s version %u is not the same as program version %u, this may cause problem", pStore->fsnap,
|
||||
version, KVSTORE_FILE_VERSION);
|
||||
}
|
||||
|
||||
if (taosFtruncate(pStore->fd, info.size) < 0) {
|
||||
uError("failed to truncate %s to %" PRId64 " size since %s", pStore->fname, info.size, strerror(errno));
|
||||
terrno = TAOS_SYSTEM_ERROR(errno);
|
||||
|
@ -132,7 +138,11 @@ SKVStore *tdOpenKVStore(char *fname, iterFunc iFunc, afterFunc aFunc, void *appH
|
|||
(void)remove(pStore->fsnap);
|
||||
}
|
||||
|
||||
if (tdLoadKVStoreHeader(pStore->fd, pStore->fname, &info) < 0) goto _err;
|
||||
if (tdLoadKVStoreHeader(pStore->fd, pStore->fname, &info, &version) < 0) goto _err;
|
||||
if (version != KVSTORE_FILE_VERSION) {
|
||||
uError("file %s version %u is not the same as program version %u, this may cause problem", pStore->fname, version,
|
||||
KVSTORE_FILE_VERSION);
|
||||
}
|
||||
|
||||
pStore->info.size = TD_KVSTORE_HEADER_SIZE;
|
||||
pStore->info.magic = info.magic;
|
||||
|
@ -320,7 +330,7 @@ int tdKVStoreEndCommit(SKVStore *pStore) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int tdLoadKVStoreHeader(int fd, char *fname, SStoreInfo *pInfo) {
|
||||
static int tdLoadKVStoreHeader(int fd, char *fname, SStoreInfo *pInfo, uint32_t *version) {
|
||||
char buf[TD_KVSTORE_HEADER_SIZE] = "\0";
|
||||
|
||||
if (lseek(fd, 0, SEEK_SET) < 0) {
|
||||
|
@ -341,7 +351,9 @@ static int tdLoadKVStoreHeader(int fd, char *fname, SStoreInfo *pInfo) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
tdDecodeStoreInfo(buf, pInfo);
|
||||
void *pBuf = (void *)buf;
|
||||
pBuf = tdDecodeStoreInfo(pBuf, pInfo);
|
||||
pBuf = taosDecodeFixedU32(pBuf, version);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -357,6 +369,7 @@ static int tdUpdateKVStoreHeader(int fd, char *fname, SStoreInfo *pInfo) {
|
|||
|
||||
void *pBuf = buf;
|
||||
tdEncodeStoreInfo(&pBuf, pInfo);
|
||||
taosEncodeFixedU32(&pBuf, KVSTORE_FILE_VERSION);
|
||||
ASSERT(POINTER_DISTANCE(pBuf, buf) + sizeof(TSCKSUM) <= TD_KVSTORE_HEADER_SIZE);
|
||||
|
||||
taosCalcChecksumAppend(0, (uint8_t *)buf, TD_KVSTORE_HEADER_SIZE);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
char version[12] = "2.0.0.0";
|
||||
char compatible_version[12] = "2.0.0.0";
|
||||
char gitinfo[48] = "3264067e97300c84caa61ac909d548c9ca56de6b";
|
||||
char gitinfoOfInternal[48] = "da88f4a2474737d1f9c76adcf0ff7fd0975e7342";
|
||||
char buildinfo[64] = "Built by root at 2020-04-01 14:38";
|
||||
char gitinfo[48] = "8df8b7d9930342dd34ba13df160a7d538fad7bc7";
|
||||
char gitinfoOfInternal[48] = "bad4f040145fba581d1ab0c5dd718a5ede3e209f";
|
||||
char buildinfo[64] = "Built by root at 2020-08-03 17:23";
|
||||
|
||||
void libtaos_1_6_5_4_Linux_x64() {};
|
||||
void libtaos_2_0_0_0_Linux_x64() {};
|
||||
|
|
|
@ -110,6 +110,7 @@ func writeDataImp(wInfo *WriteInfo, wg *sync.WaitGroup, arguments *ProArgs) {
|
|||
Addr: arguments.host,
|
||||
Username: arguments.username,
|
||||
Password: arguments.password,
|
||||
Timeout: 300 * time.Second,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
|
@ -220,6 +221,7 @@ func readData(arguments *ProArgs) {
|
|||
Addr: arguments.host,
|
||||
Username: arguments.username,
|
||||
Password: arguments.password,
|
||||
Timeout: 300 * time.Second,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
|
|
|
@ -39,6 +39,7 @@ class TDSimClient:
|
|||
"udebugFlag": "135",
|
||||
"jnidebugFlag": "135",
|
||||
"qdebugFlag": "135",
|
||||
"telemetryReporting": "0",
|
||||
}
|
||||
def init(self, path):
|
||||
self.__init__()
|
||||
|
|
|
@ -36,6 +36,7 @@ class TDSimClient:
|
|||
"udebugFlag": "135",
|
||||
"jnidebugFlag": "135",
|
||||
"qdebugFlag": "135",
|
||||
"telemetryReporting": "0",
|
||||
}
|
||||
|
||||
def init(self, path):
|
||||
|
|
|
@ -36,6 +36,7 @@ class TDSimClient:
|
|||
"udebugFlag": "135",
|
||||
"jnidebugFlag": "135",
|
||||
"qdebugFlag": "135",
|
||||
"telemetryReporting": "0",
|
||||
}
|
||||
|
||||
def init(self, path):
|
||||
|
|
|
@ -18,8 +18,8 @@ sql create table if not exists db.win_cpu(ts timestamp,f_percent_dpc_time double
|
|||
|
||||
print =============== step2 - auto create
|
||||
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'import into db.win_cpu_windows_1_processor using db.win_cpu tags('windows','1','Processor') values(1564641722000,0.000000,95.598305,0.000000,0.000000,0.000000,0.000000);' 127.0.0.1:6020/rest/sql
|
||||
print curl 127.0.0.1:6020/rest/sql -----> $system_content
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'import into db.win_cpu_windows_1_processor using db.win_cpu tags('windows','1','Processor') values(1564641722000,0.000000,95.598305,0.000000,0.000000,0.000000,0.000000);' 127.0.0.1:6041/rest/sql
|
||||
print curl 127.0.0.1:6041/rest/sql -----> $system_content
|
||||
#if $system_content != @{"status":"succ","head":["ts","i"],"data":[["2017-12-25 21:28:41.022",1],["2017-12-25 21:28:42.022",2],["2017-12-25 21:28:43.022",3],["2017-12-25 21:28:44.022",4],["2017-12-25 21:28:45.022",5],["2017-12-25 21:28:46.022",6],["2017-12-25 21:28:47.022",7],["2017-12-25 21:28:48.022",8],["2017-12-25 21:28:49.022",9],["2017-12-25 21:28:50.022",10],["2017-12-25 21:28:51.022",11]],"rows":11}@ then
|
||||
# return -1
|
||||
#endi
|
||||
|
|
|
@ -52,50 +52,50 @@ sql insert into t3 values('2017-12-25 21:27:41', 3)
|
|||
|
||||
print =============== step2 - login
|
||||
|
||||
system_content curl 127.0.0.1:6020/grafana/
|
||||
system_content curl 127.0.0.1:6041/grafana/
|
||||
print 1-> $system_content
|
||||
if $system_content != @{"status":"error","code":5011,"desc":"no auth info input"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl 127.0.0.1:6020/grafana/xx
|
||||
system_content curl 127.0.0.1:6041/grafana/xx
|
||||
print 2-> $system_content
|
||||
if $system_content != @{"status":"error","code":5011,"desc":"no auth info input"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl 127.0.0.1:6020/grafana/login/xx/xx/
|
||||
system_content curl 127.0.0.1:6041/grafana/login/xx/xx/
|
||||
print 3-> $system_content
|
||||
if $system_content != @{"status":"error","code":849,"desc":"Invalid user"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl 127.0.0.1:6020/grafana/root/1/123/1/1/3
|
||||
system_content curl 127.0.0.1:6041/grafana/root/1/123/1/1/3
|
||||
print 4-> $system_content
|
||||
if $system_content != @{"status":"error","code":5011,"desc":"no auth info input"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'show databases' 127.0.0.1:6020/grafana/login/1/root/1/
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'show databases' 127.0.0.1:6041/grafana/login/1/root/1/
|
||||
print 5-> $system_content
|
||||
if $system_content != @{"status":"error","code":849,"desc":"Invalid user"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3d3cudGFvc2RhdGEuY29tIiwicGFzcyI6InRhb3NkYXRhIiwic3ViIjoicm9vdCJ9.xPv3b5odlR7YF8G_QWASjIRbMtA5v4ItToJ35fFgi' -d 'show databases' 127.0.0.1:6020/grafana/root/1/login
|
||||
system_content curl -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3d3cudGFvc2RhdGEuY29tIiwicGFzcyI6InRhb3NkYXRhIiwic3ViIjoicm9vdCJ9.xPv3b5odlR7YF8G_QWASjIRbMtA5v4ItToJ35fFgi' -d 'show databases' 127.0.0.1:6041/grafana/root/1/login
|
||||
print 6-> $system_content
|
||||
if $system_content != @{"status":"error","code":5010,"desc":"invalid type of Authorization"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -H 'Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3d3cudGFvc2RhdGEuY29tIiwicGFzcyI6InRhb3NkYXRhIiwic3ViIjoicm9vdCJ9.xPv3b5odlR7YF8G_QWASjIRbMtA5v4ItToJ35fFgi' -d 'show databases' 127.0.0.1:6020/grafana/root/1/login
|
||||
system_content curl -H 'Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3d3cudGFvc2RhdGEuY29tIiwicGFzcyI6InRhb3NkYXRhIiwic3ViIjoicm9vdCJ9.xPv3b5odlR7YF8G_QWASjIRbMtA5v4ItToJ35fFgi' -d 'show databases' 127.0.0.1:6041/grafana/root/1/login
|
||||
print 7-> $system_content
|
||||
if $system_content != @{"status":"error","code":5010,"desc":"invalid type of Authorization"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sleep 3000
|
||||
system_content curl 127.0.0.1:6020/grafana/login/root/taosdata
|
||||
system_content curl 127.0.0.1:6041/grafana/login/root/taosdata
|
||||
print 8-> $system_content
|
||||
if $system_content != @{"status":"succ","code":0,"desc":"/KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04"}@ then
|
||||
return -1
|
||||
|
@ -103,7 +103,7 @@ endi
|
|||
|
||||
print =============== step3 - heartbeat
|
||||
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' 127.0.0.1:6020/grafana/d1/table_gc
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' 127.0.0.1:6041/grafana/d1/table_gc
|
||||
print 9-> $system_content
|
||||
if $system_content != @{"message":"Grafana server receive a quest from you!"}@ then
|
||||
return -1
|
||||
|
@ -111,19 +111,19 @@ endi
|
|||
|
||||
print =============== step4 - search
|
||||
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' 127.0.0.1:6020/grafana/heartbeat
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' 127.0.0.1:6041/grafana/heartbeat
|
||||
print 10-> $system_content
|
||||
if $system_content != @{"message":"Grafana server receive a quest from you!"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' 127.0.0.1:6020/grafana/d1/table_invalid/search
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' 127.0.0.1:6041/grafana/d1/table_invalid/search
|
||||
print 11-> $system_content
|
||||
if $system_content != @{"message":"Grafana server receive a quest from you!"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' 127.0.0.1:6020/grafana/d1/m1/search
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' 127.0.0.1:6041/grafana/d1/m1/search
|
||||
print 12-> $system_content
|
||||
if $system_content != @{"message":"Grafana server receive a quest from you!"}@ then
|
||||
return -1
|
||||
|
@ -131,49 +131,49 @@ endi
|
|||
|
||||
print =============== step5 - query
|
||||
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"taosd","sql":"select first(v1) from d1.m1 where ts > 1514208523020 and ts < 1514208523030 interval(1m)"},{"refId":"B","alias":"system","sql":"select first(v2) from d1.m1 where ts > 1514208523020 and ts < 1514208523030 interval(1m)"}]' 127.0.0.1:6020/grafana/query
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"taosd","sql":"select first(v1) from d1.m1 where ts > 1514208523020 and ts < 1514208523030 interval(1m)"},{"refId":"B","alias":"system","sql":"select first(v2) from d1.m1 where ts > 1514208523020 and ts < 1514208523030 interval(1m)"}]' 127.0.0.1:6041/grafana/query
|
||||
print 13-> $system_content
|
||||
if $system_content != @[{"refId":"A","target":"taosd","datapoints":[[2,1514208480000]]},{"refId":"B","target":"system","datapoints":[[5.10000,1514208480000]]}]@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"","sql":"select first(v1) from d1.m1 where ts > 1514208523020 and ts < 1514208523030 interval(1m)"},{"refId":"B","alias":"","sql":"select first(v2) from d1.m1 where ts > 1514208523020 and ts < 1514208523030 interval(1m)"}]' 127.0.0.1:6020/grafana/query
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"","sql":"select first(v1) from d1.m1 where ts > 1514208523020 and ts < 1514208523030 interval(1m)"},{"refId":"B","alias":"","sql":"select first(v2) from d1.m1 where ts > 1514208523020 and ts < 1514208523030 interval(1m)"}]' 127.0.0.1:6041/grafana/query
|
||||
print 14-> $system_content
|
||||
if $system_content != @[{"refId":"A","target":"A","datapoints":[[2,1514208480000]]},{"refId":"B","target":"B","datapoints":[[5.10000,1514208480000]]}]@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"","sql":"select count(v1) from d1.m1"},{"refId":"B","alias":"","sql":"select count(v2) from d1.m1"}]' 127.0.0.1:6020/grafana/query
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"","sql":"select count(v1) from d1.m1"},{"refId":"B","alias":"","sql":"select count(v2) from d1.m1"}]' 127.0.0.1:6041/grafana/query
|
||||
print 15-> $system_content
|
||||
if $system_content != @[{"refId":"A","target":"A","datapoints":[[3,"-"]]},{"refId":"B","target":"B","datapoints":[[3,"-"]]}]@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"","sql":"select count(v1) from d1.m1"},{"refId":"B","alias":"","sql":"select count(v2) from d1.m1"}]' 127.0.0.1:6020/grafana/query
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"","sql":"select count(v1) from d1.m1"},{"refId":"B","alias":"","sql":"select count(v2) from d1.m1"}]' 127.0.0.1:6041/grafana/query
|
||||
print 15-> $system_content
|
||||
if $system_content != @[{"refId":"A","target":"A","datapoints":[[3,"-"]]},{"refId":"B","target":"B","datapoints":[[3,"-"]]}]@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"","sql":"select count(i) from d1.mt group by a"},{"refId":"B","alias":"","sql":"select sum(i) from d1.mt group by b"}]' 127.0.0.1:6020/grafana/query
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"","sql":"select count(i) from d1.mt group by a"},{"refId":"B","alias":"","sql":"select sum(i) from d1.mt group by b"}]' 127.0.0.1:6041/grafana/query
|
||||
print 16-> $system_content
|
||||
if $system_content != @[{"refId":"A","target":"{a:1,}","datapoints":[[5,"-"]]},{"refId":"A","target":"{a:2,}","datapoints":[[4,"-"]]},{"refId":"A","target":"{a:3,}","datapoints":[[3,"-"]]},{"refId":"B","target":"{b:a}","datapoints":[[5,"-"]]},{"refId":"B","target":"{b:b}","datapoints":[[8,"-"]]},{"refId":"B","target":"{b:c}","datapoints":[[9,"-"]]}]@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"count","sql":"select count(i) from d1.mt group by a"},{"refId":"B","alias":"sum-","sql":"select sum(i) from d1.mt group by b"}]' 127.0.0.1:6020/grafana/query
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"count","sql":"select count(i) from d1.mt group by a"},{"refId":"B","alias":"sum-","sql":"select sum(i) from d1.mt group by b"}]' 127.0.0.1:6041/grafana/query
|
||||
print 17-> $system_content
|
||||
if $system_content != @[{"refId":"A","target":"count{a:1,}","datapoints":[[5,"-"]]},{"refId":"A","target":"count{a:2,}","datapoints":[[4,"-"]]},{"refId":"A","target":"count{a:3,}","datapoints":[[3,"-"]]},{"refId":"B","target":"sum-{b:a}","datapoints":[[5,"-"]]},{"refId":"B","target":"sum-{b:b}","datapoints":[[8,"-"]]},{"refId":"B","target":"sum-{b:c}","datapoints":[[9,"-"]]}]@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"count","sql":"select count(i) from d1.mt interval(1m) group by a "}]' 127.0.0.1:6020/grafana/query
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"count","sql":"select count(i) from d1.mt interval(1m) group by a "}]' 127.0.0.1:6041/grafana/query
|
||||
print 18-> $system_content
|
||||
if $system_content != @[{"refId":"A","target":"count{a:1,}","datapoints":[[1,1514208300000],[1,1514208360000],[1,1514208420000],[1,1514208480000],[1,1514208540000]]},{"refId":"A","target":"count{a:2,}","datapoints":[[1,1514208300000],[1,1514208360000],[1,1514208420000],[1,1514208480000]]},{"refId":"A","target":"count{a:3,}","datapoints":[[1,1514208300000],[1,1514208360000],[1,1514208420000]]}]@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"","sql":"select sum(v2), count(v1) from d1.m1"},{"refId":"B","alias":"","sql":"select count(v2), sum(v2) from d1.m1"}]' 127.0.0.1:6020/grafana/query
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"refId":"A","alias":"","sql":"select sum(v2), count(v1) from d1.m1"},{"refId":"B","alias":"","sql":"select count(v2), sum(v2) from d1.m1"}]' 127.0.0.1:6041/grafana/query
|
||||
print 19-> $system_content
|
||||
if $system_content != @[{"refId":"A","target":"{count(v1):3}","datapoints":[[15.299999714,"-"]]},{"refId":"B","target":"{sum(v2):15.299999714}","datapoints":[[3,"-"]]}]@ then
|
||||
return -1
|
||||
|
|
|
@ -33,7 +33,7 @@ sql insert into tb2 values('2020-01-04 00:00:00.000', 22, 214, 224)
|
|||
|
||||
print =============== step1 - one query, 1 column, with timestamp
|
||||
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select ts from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select ts from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6041/grafana/query
|
||||
print step1-> $system_content
|
||||
if $system_content != @[{"refId":"A","target":"A","datapoints":[[null,1577980800000],[null,1578067200000]]}]@ then
|
||||
return -1
|
||||
|
@ -41,7 +41,7 @@ endi
|
|||
|
||||
print =============== step2 - one query, 2 column, with timestamp
|
||||
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select ts,val from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select ts,val from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6041/grafana/query
|
||||
print step2-> $system_content
|
||||
if $system_content != @[{"refId":"A","target":"A","datapoints":[[2,1577980800000],[2,1578067200000]]}]@ then
|
||||
return -1
|
||||
|
@ -49,80 +49,80 @@ endi
|
|||
|
||||
print =============== step3 - one query, 3 column, with timestamp
|
||||
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select ts,val,val1 from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select ts,val,val1 from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6041/grafana/query
|
||||
print step3.1-> $system_content
|
||||
if $system_content != @[{"refId":"A","target":"{val1:13,}","datapoints":[[2,1577980800000]]},{"refId":"A","target":"{val1:14,}","datapoints":[[2,1578067200000]]}]@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select ts,val,val1 from db.tb "} ]' 127.0.0.1:6020/grafana/query
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select ts,val,val1 from db.tb "} ]' 127.0.0.1:6041/grafana/query
|
||||
print step3.2-> $system_content
|
||||
if $system_content != @[{"refId":"A","target":"{val1:11,}","datapoints":[[1,1577808000000]]},{"refId":"A","target":"{val1:12,}","datapoints":[[1,1577894400000]]},{"refId":"A","target":"{val1:13,}","datapoints":[[2,1577980800000]]},{"refId":"A","target":"{val1:14,}","datapoints":[[2,1578067200000]]}]@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select ts,val1,val from db.tb "} ]' 127.0.0.1:6020/grafana/query
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select ts,val1,val from db.tb "} ]' 127.0.0.1:6041/grafana/query
|
||||
print step3.3-> $system_content
|
||||
if $system_content != @[{"refId":"A","target":"{val:1,}","datapoints":[[11,1577808000000],[12,1577894400000]]},{"refId":"A","target":"{val:2,}","datapoints":[[13,1577980800000],[14,1578067200000]]}]@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print =============== step4 - one query, 4 column, with timestamp
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select ts,val2,val1,val from db.tb "} ]' 127.0.0.1:6020/grafana/query
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select ts,val2,val1,val from db.tb "} ]' 127.0.0.1:6041/grafana/query
|
||||
print step4.1-> $system_content
|
||||
if $system_content != @[{"refId":"A","target":"{val1:11,, val:1,}","datapoints":[[21,1577808000000]]},{"refId":"A","target":"{val1:12,, val:1,}","datapoints":[[22,1577894400000]]},{"refId":"A","target":"{val1:13,, val:2,}","datapoints":[[23,1577980800000]]},{"refId":"A","target":"{val1:14,, val:2,}","datapoints":[[24,1578067200000]]}]@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select ts,val,val1,val2 from db.tb "} ]' 127.0.0.1:6020/grafana/query
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select ts,val,val1,val2 from db.tb "} ]' 127.0.0.1:6041/grafana/query
|
||||
print step4.2-> $system_content
|
||||
if $system_content != @[{"refId":"A","target":"{val1:11,, val2:21,}","datapoints":[[1,1577808000000]]},{"refId":"A","target":"{val1:12,, val2:22,}","datapoints":[[1,1577894400000]]},{"refId":"A","target":"{val1:13,, val2:23,}","datapoints":[[2,1577980800000]]},{"refId":"A","target":"{val1:14,, val2:24,}","datapoints":[[2,1578067200000]]}]@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print =============== step5 - one query, 1 column, no timestamp
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select val from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select val from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6041/grafana/query
|
||||
print step1-> $system_content
|
||||
if $system_content != @[{"refId":"A","target":"A","datapoints":[[2,"-"],[2,"-"]]}]@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print =============== step6 - one query, 2 column, no timestamp
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select val1,val2 from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select val1,val2 from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6041/grafana/query
|
||||
print step1-> $system_content
|
||||
if $system_content != @[{"refId":"A","target":"{val2:23,}","datapoints":[[13,"-"]]},{"refId":"A","target":"{val2:24,}","datapoints":[[14,"-"]]}]@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print =============== step7 - one query, 3 column, no timestamp
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select val1,val2,val from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select val1,val2,val from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6041/grafana/query
|
||||
print step1-> $system_content
|
||||
if $system_content != @[{"refId":"A","target":"{val2:23,, val:2,}","datapoints":[[13,"-"]]},{"refId":"A","target":"{val2:24,, val:2,}","datapoints":[[14,"-"]]}]@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select val1,val2,val from db.tb"} ]' 127.0.0.1:6020/grafana/query
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select val1,val2,val from db.tb"} ]' 127.0.0.1:6041/grafana/query
|
||||
print step1-> $system_content
|
||||
if $system_content != @[{"refId":"A","target":"{val2:21,, val:1,}","datapoints":[[11,"-"]]},{"refId":"A","target":"{val2:22,, val:1,}","datapoints":[[12,"-"]]},{"refId":"A","target":"{val2:23,, val:2,}","datapoints":[[13,"-"]]},{"refId":"A","target":"{val2:24,, val:2,}","datapoints":[[14,"-"]]}]@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print =============== step8 - one query, no return
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select val1,val2,val from db.tb where ts >= 1677980800000 "} ]' 127.0.0.1:6020/grafana/query
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select val1,val2,val from db.tb where ts >= 1677980800000 "} ]' 127.0.0.1:6041/grafana/query
|
||||
print step1-> $system_content
|
||||
if $system_content != @[]@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print =============== step9 - one query, insert sql
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"insert into db.t2 values(now, 1) "} ]' 127.0.0.1:6020/grafana/query
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"insert into db.t2 values(now, 1) "} ]' 127.0.0.1:6041/grafana/query
|
||||
print step1-> $system_content
|
||||
if $system_content != @[]@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print =============== step10 - one query, error sql
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select * from db.tt "} ]' 127.0.0.1:6020/grafana/query
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"A","alias":"","sql":"select * from db.tt "} ]' 127.0.0.1:6041/grafana/query
|
||||
print step1-> $system_content
|
||||
if $system_content != @[]@ then
|
||||
return -1
|
||||
|
@ -130,7 +130,7 @@ endi
|
|||
|
||||
print =============== step11 - two query, 1 column, with timestamp, 1 column, with timestamp
|
||||
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select ts from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"","sql":"select ts from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select ts from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"","sql":"select ts from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6041/grafana/query
|
||||
print step1-> $system_content
|
||||
if $system_content != @[{"refId":"B","target":"BB","datapoints":[[null,1577980800000],[null,1578067200000]]},{"refId":"A","target":"A","datapoints":[[null,1577980800000],[null,1578067200000]]}]@ then
|
||||
return -1
|
||||
|
@ -138,98 +138,98 @@ endi
|
|||
|
||||
print =============== step12 - two query, 1 column, with timestamp, 2 column, with timestamp
|
||||
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select ts from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"","sql":"select ts,val from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select ts from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"","sql":"select ts,val from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6041/grafana/query
|
||||
print step1-> $system_content
|
||||
if $system_content != @[{"refId":"B","target":"BB","datapoints":[[null,1577980800000],[null,1578067200000]]},{"refId":"A","target":"A","datapoints":[[2,1577980800000],[2,1578067200000]]}]@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print =============== step13 - two query, 1 column, with timestamp, 3 column, with timestamp
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select ts from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"","sql":"select ts,val,val1 from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select ts from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"","sql":"select ts,val,val1 from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6041/grafana/query
|
||||
print step1-> $system_content
|
||||
if $system_content != @[{"refId":"B","target":"BB","datapoints":[[null,1577980800000],[null,1578067200000]]},{"refId":"A","target":"{val1:13,}","datapoints":[[2,1577980800000]]},{"refId":"A","target":"{val1:14,}","datapoints":[[2,1578067200000]]}]@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print =============== step14 - two query, 2 column, with timestamp, 2 column, with timestamp
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select ts, val2 from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select ts,val from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select ts, val2 from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select ts,val from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6041/grafana/query
|
||||
print step1-> $system_content
|
||||
if $system_content != @[{"refId":"B","target":"BB","datapoints":[[223,1577980800000],[224,1578067200000]]},{"refId":"A","target":"AA","datapoints":[[2,1577980800000],[2,1578067200000]]}]@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print =============== step15 - two query, 2 column, with timestamp, 3 column, with timestamp
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select ts, val2, val1 from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select ts,val from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select ts, val2, val1 from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select ts,val from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6041/grafana/query
|
||||
print step1-> $system_content
|
||||
if $system_content != @[{"refId":"B","target":"BB{val1:213,}","datapoints":[[223,1577980800000]]},{"refId":"B","target":"BB{val1:214,}","datapoints":[[224,1578067200000]]},{"refId":"A","target":"AA","datapoints":[[2,1577980800000],[2,1578067200000]]}]@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print =============== step16 - two query, 3 column, with timestamp, 4 column, with timestamp
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select ts, val, val1, val2, val1 from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select ts,val,val1 from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select ts, val, val1, val2, val1 from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select ts,val,val1 from db.tb where ts >= 1577980800000 "} ]' 127.0.0.1:6041/grafana/query
|
||||
print step1-> $system_content
|
||||
if $system_content != @[{"refId":"B","target":"BB{val1:213,, val2:223,, val1:213,}","datapoints":[[22,1577980800000]]},{"refId":"B","target":"BB{val1:214,, val2:224,, val1:214,}","datapoints":[[22,1578067200000]]},{"refId":"A","target":"AA{val1:13,}","datapoints":[[2,1577980800000]]},{"refId":"A","target":"AA{val1:14,}","datapoints":[[2,1578067200000]]}]@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print =============== step17 - two query, 2 column, with timestamp, no return
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select ts, val from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select ts,val from db.tb where ts >= 1677980800000 "} ]' 127.0.0.1:6020/grafana/query
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select ts, val from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select ts,val from db.tb where ts >= 1677980800000 "} ]' 127.0.0.1:6041/grafana/query
|
||||
print step1-> $system_content
|
||||
if $system_content != @[{"refId":"B","target":"BB","datapoints":[[22,1577980800000],[22,1578067200000]]}]@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print =============== step18 - two query, 2 column, with timestamp, invalid sql
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select ts, val from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select ts,val from db.tb222 where ts >= 1677980800000 "} ]' 127.0.0.1:6020/grafana/query
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select ts, val from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select ts,val from db.tb222 where ts >= 1677980800000 "} ]' 127.0.0.1:6041/grafana/query
|
||||
print step1-> $system_content
|
||||
if $system_content != @[{"refId":"B","target":"BB","datapoints":[[22,1577980800000],[22,1578067200000]]}]@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print =============== step19 - two query, 2 column, with timestamp, insert sql
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select ts, val from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"insert into db.t2 values(now, 1)"} ]' 127.0.0.1:6020/grafana/query
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select ts, val from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"insert into db.t2 values(now, 1)"} ]' 127.0.0.1:6041/grafana/query
|
||||
print step1-> $system_content
|
||||
if $system_content != @[{"refId":"B","target":"BB","datapoints":[[22,1577980800000],[22,1578067200000]]}]@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print =============== step20 - two query, 1 column, no timestamp, 1 column, with timestamp
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select val from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select ts from db.tb2 where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select val from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select ts from db.tb2 where ts >= 1577980800000 "} ]' 127.0.0.1:6041/grafana/query
|
||||
print step1-> $system_content
|
||||
if $system_content != @[{"refId":"B","target":"BB","datapoints":[[22,"-"],[22,"-"]]},{"refId":"A","target":"AA","datapoints":[[null,1577980800000],[null,1578067200000]]}]@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print =============== step21 - two query, 1 column, no timestamp, 2 column, with timestamp
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select val from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select ts,val2 from db.tb2 where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select val from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select ts,val2 from db.tb2 where ts >= 1577980800000 "} ]' 127.0.0.1:6041/grafana/query
|
||||
print step1-> $system_content
|
||||
if $system_content != @[{"refId":"B","target":"BB","datapoints":[[22,"-"],[22,"-"]]},{"refId":"A","target":"AA","datapoints":[[223,1577980800000],[224,1578067200000]]}]@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print =============== step22 - two query, 1 column, no timestamp, 3 column, with timestamp
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select val from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select ts,val1, val2 from db.tb2 where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select val from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select ts,val1, val2 from db.tb2 where ts >= 1577980800000 "} ]' 127.0.0.1:6041/grafana/query
|
||||
print step1-> $system_content
|
||||
if $system_content != @[{"refId":"B","target":"BB","datapoints":[[22,"-"],[22,"-"]]},{"refId":"A","target":"AA{val2:223,}","datapoints":[[213,1577980800000]]},{"refId":"A","target":"AA{val2:224,}","datapoints":[[214,1578067200000]]}]@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print =============== step23 - two query, 2 column, no timestamp, 1 column, no timestamp
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select val1,val2 from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select val1 from db.tb2 where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select val1,val2 from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select val1 from db.tb2 where ts >= 1577980800000 "} ]' 127.0.0.1:6041/grafana/query
|
||||
print step1-> $system_content
|
||||
if $system_content != @[{"refId":"B","target":"BB{val2:223,}","datapoints":[[213,"-"]]},{"refId":"B","target":"BB{val2:224,}","datapoints":[[214,"-"]]},{"refId":"A","target":"AA","datapoints":[[213,"-"],[214,"-"]]}]@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print =============== step24 - two query, 2 column, no timestamp, 2 column, no timestamp
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select val1,val2 from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select val,val1 from db.tb2 where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select val1,val2 from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select val,val1 from db.tb2 where ts >= 1577980800000 "} ]' 127.0.0.1:6041/grafana/query
|
||||
print step1-> $system_content
|
||||
if $system_content != @[{"refId":"B","target":"BB{val2:223,}","datapoints":[[213,"-"]]},{"refId":"B","target":"BB{val2:224,}","datapoints":[[214,"-"]]},{"refId":"A","target":"AA{val1:213,}","datapoints":[[22,"-"]]},{"refId":"A","target":"AA{val1:214,}","datapoints":[[22,"-"]]}]@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print =============== step25 - two query, 2 column, no timestamp, 3 column, no timestamp
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select val1,val2 from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select val,val1,val2 from db.tb2 where ts >= 1577980800000 "} ]' 127.0.0.1:6020/grafana/query
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d '[ {"refId":"B","alias":"BB","sql":"select val1,val2 from db.tb2 where ts >= 1577980800000 "},{"refId":"A","alias":"AA","sql":"select val,val1,val2 from db.tb2 where ts >= 1577980800000 "} ]' 127.0.0.1:6041/grafana/query
|
||||
print step1-> $system_content
|
||||
if $system_content != @[{"refId":"B","target":"BB{val2:223,}","datapoints":[[213,"-"]]},{"refId":"B","target":"BB{val2:224,}","datapoints":[[214,"-"]]},{"refId":"A","target":"AA{val1:213,, val2:223,}","datapoints":[[22,"-"]]},{"refId":"A","target":"AA{val1:214,, val2:224,}","datapoints":[[22,"-"]]}]@ then
|
||||
return -1
|
||||
|
|
|
@ -34,8 +34,8 @@ sleep 4000
|
|||
|
||||
print =============== step2 - login
|
||||
|
||||
system_content curl 127.0.0.1:6020/rest/login/root/taosdata
|
||||
print curl 127.0.0.1:6020/rest/login/root/taosdata -----> $system_content
|
||||
system_content curl 127.0.0.1:6041/rest/login/root/taosdata
|
||||
print curl 127.0.0.1:6041/rest/login/root/taosdata -----> $system_content
|
||||
|
||||
if $system_content != @{"status":"succ","code":0,"desc":"/KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04"}@ then
|
||||
return -1
|
||||
|
@ -45,8 +45,8 @@ return
|
|||
|
||||
print =============== step3 - query data
|
||||
|
||||
system_content curl -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3d3cudGFvc2RhdGEuY29tIiwia2V5IjoiYkVsOExjdkxVZDdhOHFkdE5abXRPTnJ5cDIwMW1hMDQiLCJzdWIiOiJyb290In0.k7CkgmpOJImIkLqZqzASlPmkdeEw7Wfk4XUrqGZX-LQ' -d 'select * from t1' 127.0.0.1:6020/rest/sql/d1
|
||||
print curl 127.0.0.1:6020/rest/sql/d1 -----> $system_content
|
||||
system_content curl -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3d3cudGFvc2RhdGEuY29tIiwia2V5IjoiYkVsOExjdkxVZDdhOHFkdE5abXRPTnJ5cDIwMW1hMDQiLCJzdWIiOiJyb290In0.k7CkgmpOJImIkLqZqzASlPmkdeEw7Wfk4XUrqGZX-LQ' -d 'select * from t1' 127.0.0.1:6041/rest/sql/d1
|
||||
print curl 127.0.0.1:6041/rest/sql/d1 -----> $system_content
|
||||
if $system_content != @{"status":"succ","head":["ts","i","b"],"data":[["2017-12-25 21:28:54.022",14,"44\\\\\"\"44"],["2017-12-25 21:28:53.022",13,"33\\\\\"33"],["2017-12-25 21:28:52.022",12,"22\\\\11"],["2017-12-25 21:28:51.022",11,"11\\\\11"],["2017-12-25 21:28:49.022",9,"99\\99"],["2017-12-25 21:28:48.022",8,"88\"\"88"],["2017-12-25 21:28:47.022",7,"77\"7\""],["2017-12-25 21:28:46.022",6,"66'6'"],["2017-12-25 21:28:45.022",5,"55'"],["2017-12-25 21:28:44.022",4,"44\""],["2017-12-25 21:28:43.022",3,"33"],["2017-12-25 21:28:42.022",2,"22"],["2017-12-25 21:28:41.022",1,"11"]],"rows":13}@ then
|
||||
return -1
|
||||
endi
|
||||
|
|
|
@ -30,8 +30,8 @@ sql insert into table_rest values('2017-12-25 21:28:50.022', 10)
|
|||
|
||||
print =============== step2 - login
|
||||
|
||||
system_content curl 127.0.0.1:6020/rest/login/root/taosdata
|
||||
print curl 127.0.0.1:6020/rest/login/root/taosdata -----> $system_content
|
||||
system_content curl 127.0.0.1:6041/rest/login/root/taosdata
|
||||
print curl 127.0.0.1:6041/rest/login/root/taosdata -----> $system_content
|
||||
|
||||
if $system_content != {"status":"succ","code":0,"desc":"/KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04"} then
|
||||
return -1
|
||||
|
@ -39,44 +39,44 @@ endi
|
|||
|
||||
print =============== step3 - query data
|
||||
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_rest' 127.0.0.1:6020/rest/sql
|
||||
print curl 127.0.0.1:6020/rest/sql -----> $system_content
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_rest' 127.0.0.1:6041/rest/sql
|
||||
print curl 127.0.0.1:6041/rest/sql -----> $system_content
|
||||
if $system_content != @{"status":"succ","head":["ts","i"],"data":[["2017-12-25 21:28:41.022",1],["2017-12-25 21:28:42.022",2],["2017-12-25 21:28:43.022",3],["2017-12-25 21:28:44.022",4],["2017-12-25 21:28:45.022",5],["2017-12-25 21:28:46.022",6],["2017-12-25 21:28:47.022",7],["2017-12-25 21:28:48.022",8],["2017-12-25 21:28:49.022",9],["2017-12-25 21:28:50.022",10]],"rows":10}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print =============== step4 - insert data
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.table_rest values('2017-12-25 21:28:51.022', 11)" 127.0.0.1:6020/rest/sql
|
||||
print curl 127.0.0.1:6020/rest/sql -----> $system_content
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.table_rest values('2017-12-25 21:28:51.022', 11)" 127.0.0.1:6041/rest/sql
|
||||
print curl 127.0.0.1:6041/rest/sql -----> $system_content
|
||||
if $system_content != @{"status":"succ","head":["affected_rows"],"data":[[1]],"rows":1}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print =============== step5 - query data
|
||||
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_rest' 127.0.0.1:6020/rest/sql
|
||||
print curl 127.0.0.1:6020/rest/sql -----> $system_content
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_rest' 127.0.0.1:6041/rest/sql
|
||||
print curl 127.0.0.1:6041/rest/sql -----> $system_content
|
||||
if $system_content != @{"status":"succ","head":["ts","i"],"data":[["2017-12-25 21:28:41.022",1],["2017-12-25 21:28:42.022",2],["2017-12-25 21:28:43.022",3],["2017-12-25 21:28:44.022",4],["2017-12-25 21:28:45.022",5],["2017-12-25 21:28:46.022",6],["2017-12-25 21:28:47.022",7],["2017-12-25 21:28:48.022",8],["2017-12-25 21:28:49.022",9],["2017-12-25 21:28:50.022",10],["2017-12-25 21:28:51.022",11]],"rows":11}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print =============== step6 - query no db data
|
||||
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'show dnodes' 127.0.0.1:6020/rest/sql
|
||||
print curl 127.0.0.1:6020/rest/sql -----> $system_content
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'show dnodes' 127.0.0.1:6041/rest/sql
|
||||
print curl 127.0.0.1:6041/rest/sql -----> $system_content
|
||||
|
||||
print =============== step7 - change password
|
||||
sql create user u1 PASS 'abcd@1234'
|
||||
sql create user u2 PASS 'abcd_1234'
|
||||
|
||||
system_content curl 127.0.0.1:6020/rest/login/u1/abcd@1234
|
||||
print curl 127.0.0.1:6020/rest/login/u1/abcd@1234 -----> $system_content
|
||||
system_content curl 127.0.0.1:6041/rest/login/u1/abcd@1234
|
||||
print curl 127.0.0.1:6041/rest/login/u1/abcd@1234 -----> $system_content
|
||||
if $system_content != @{"status":"succ","code":0,"desc":"jIlItaLFFIPa8qdtNZmtONryp201ma04SXX8PEJowKAB/46k1gwnPNryp201ma04"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl 127.0.0.1:6020/rest/login/u2/aabcd_1234
|
||||
print curl 127.0.0.1:6020/rest/login/u2/abcd_1234 -----> $system_content
|
||||
system_content curl 127.0.0.1:6041/rest/login/u2/aabcd_1234
|
||||
print curl 127.0.0.1:6041/rest/login/u2/abcd_1234 -----> $system_content
|
||||
if $system_content != @{"status":"error","code":3,"desc":"Authentication failure"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
|
|
@ -12,57 +12,57 @@ print ============================ dnode1 start
|
|||
|
||||
print =============== step1 - login
|
||||
|
||||
system_content curl 127.0.0.1:6020/rest/
|
||||
system_content curl 127.0.0.1:6041/rest/
|
||||
print 1-> $system_content
|
||||
if $system_content != @{"status":"error","code":5011,"desc":"no auth info input"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl 127.0.0.1:6020/rest/xx
|
||||
system_content curl 127.0.0.1:6041/rest/xx
|
||||
print 2-> $system_content
|
||||
if $system_content != @{"status":"error","code":5011,"desc":"no auth info input"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl 127.0.0.1:6020/rest/login
|
||||
system_content curl 127.0.0.1:6041/rest/login
|
||||
print 3-> $system_content
|
||||
if $system_content != @{"status":"error","code":5011,"desc":"no auth info input"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
#4
|
||||
system_content curl 127.0.0.1:6020/rest/login/root
|
||||
system_content curl 127.0.0.1:6041/rest/login/root
|
||||
print 4-> $system_content
|
||||
if $system_content != @{"status":"error","code":5011,"desc":"no auth info input"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl 127.0.0.1:6020/rest/login/root/123
|
||||
system_content curl 127.0.0.1:6041/rest/login/root/123
|
||||
print 5-> $system_content
|
||||
if $system_content != @{"status":"error","code":3,"desc":"Authentication failure"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl 127.0.0.1:6020/rest/login/root/123/1/1/3
|
||||
system_content curl 127.0.0.1:6041/rest/login/root/123/1/1/3
|
||||
print 6-> $system_content
|
||||
if $system_content != @{"status":"error","code":3,"desc":"Authentication failure"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'show databases' 127.0.0.1:6020/rest/login/root/1
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'show databases' 127.0.0.1:6041/rest/login/root/1
|
||||
print 7-> $system_content
|
||||
if $system_content != @{"status":"error","code":3,"desc":"Authentication failure"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
#8
|
||||
system_content curl -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3d3cudGFvc2RhdGEuY29tIiwicGFzcyI6InRhb3NkYXRhIiwic3ViIjoicm9vdCJ9.xPv3b5odlR7YF8G_QWASjIRbMtA5v4ItToJ35fFgi' -d 'show databases' 127.0.0.1:6020/rest/login/root/1
|
||||
system_content curl -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3d3cudGFvc2RhdGEuY29tIiwicGFzcyI6InRhb3NkYXRhIiwic3ViIjoicm9vdCJ9.xPv3b5odlR7YF8G_QWASjIRbMtA5v4ItToJ35fFgi' -d 'show databases' 127.0.0.1:6041/rest/login/root/1
|
||||
print 8-> $system_content
|
||||
if $system_content != @{"status":"error","code":5010,"desc":"invalid type of Authorization"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -H 'Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3d3cudGFvc2RhdGEuY29tIiwicGFzcyI6InRhb3NkYXRhIiwic3ViIjoicm9vdCJ9.xPv3b5odlR7YF8G_QWASjIRbMtA5v4ItToJ35fFgi' -d 'show databases' 127.0.0.1:6020/rest/login/root/1
|
||||
system_content curl -H 'Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3d3cudGFvc2RhdGEuY29tIiwicGFzcyI6InRhb3NkYXRhIiwic3ViIjoicm9vdCJ9.xPv3b5odlR7YF8G_QWASjIRbMtA5v4ItToJ35fFgi' -d 'show databases' 127.0.0.1:6041/rest/login/root/1
|
||||
print 9-> $system_content
|
||||
if $system_content != @{"status":"error","code":5010,"desc":"invalid type of Authorization"}@ then
|
||||
return -1
|
||||
|
@ -70,7 +70,7 @@ endi
|
|||
|
||||
sleep 3000
|
||||
|
||||
system_content curl 127.0.0.1:6020/rest/login/root/taosdata/
|
||||
system_content curl 127.0.0.1:6041/rest/login/root/taosdata/
|
||||
print 10-> $system_content
|
||||
if $system_content != @{"status":"succ","code":0,"desc":"/KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04"}@ then
|
||||
return -1
|
||||
|
@ -79,52 +79,52 @@ endi
|
|||
print =============== step2 - no db
|
||||
|
||||
#11
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'show databases' 127.0.0.1:6020/rest/sql
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'show databases' 127.0.0.1:6041/rest/sql
|
||||
print 11-> $system_content
|
||||
if $system_content != @{"status":"succ","head":["name","created_time","ntables","vgroups","replica","quorum","days","keep1,keep2,keep(D)","cache(MB)","blocks","minrows","maxrows","wallevel","fsync","comp","precision","status"],"data":[],"rows":0}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'create database d1' 127.0.0.1:6020/rest/sql
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'create database d1' 127.0.0.1:6041/rest/sql
|
||||
print 12-> $system_content
|
||||
if $system_content != @{"status":"succ","head":["affected_rows"],"data":[[0]],"rows":0}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'create database d1' 127.0.0.1:6020/rest/sql
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'create database d1' 127.0.0.1:6041/rest/sql
|
||||
print 13-> $system_content
|
||||
if $system_content != @{"status":"error","code":897,"desc":"Database already exists"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
#14
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '' 127.0.0.1:6020/rest/sql
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '' 127.0.0.1:6041/rest/sql
|
||||
print 14-> $system_content
|
||||
if $system_content != @{"status":"error","code":5012,"desc":"no sql input"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
#system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'use d1' 127.0.0.1:6020/rest/sql
|
||||
#system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'use d1' 127.0.0.1:6041/rest/sql
|
||||
#print 15-> $system_content
|
||||
#if $system_content != @{"status":"error","code":5017,"desc":"no need to execute use db cmd"}@ then
|
||||
#if $system_content != @{"status":"succ","head":["affected_rows"],"data":[[1]],"rows":1}@ then
|
||||
# return -1
|
||||
#endi
|
||||
|
||||
#system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' use d1' 127.0.0.1:6020/rest/sql
|
||||
#system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' use d1' 127.0.0.1:6041/rest/sql
|
||||
#print 16-> $system_content
|
||||
#if $system_content != @{"status":"error","code":5017,"desc":"no need to execute use db cmd"}@ then
|
||||
# return -1
|
||||
#endi
|
||||
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' used1' 127.0.0.1:6020/rest/sql
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' used1' 127.0.0.1:6041/rest/sql
|
||||
print 17-> $system_content
|
||||
if $system_content != @{"status":"error","code":512,"desc":"invalid SQL: invalid SQL: syntax error near 'used1'"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
#18
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' show tables;' 127.0.0.1:6020/rest/sql
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' show tables;' 127.0.0.1:6041/rest/sql
|
||||
print 18-> $system_content
|
||||
if $system_content != @{"status":"error","code":896,"desc":"Database not specified or available"}@ then
|
||||
return -1
|
||||
|
@ -133,44 +133,44 @@ endi
|
|||
print =============== step3 - db
|
||||
|
||||
#19
|
||||
#system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' show tables;' 127.0.0.1:6020/rest/sql/d4
|
||||
#system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' show tables;' 127.0.0.1:6041/rest/sql/d4
|
||||
#print 19-> $system_content
|
||||
#if $system_content != @{"status":"error","code":1000,"desc":"invalid DB"}@ then
|
||||
# return -1
|
||||
#endi
|
||||
|
||||
#system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' show tables;' 127.0.0.1:6020/rest/sql/d1
|
||||
#system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' show tables;' 127.0.0.1:6041/rest/sql/d1
|
||||
#print 20-> $system_content
|
||||
#if $system_content != @{"status":"succ","head":["name","created time","columns","metric"],"data":[],"rows":0}@ then
|
||||
# return -1
|
||||
#endi
|
||||
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' select * from d1.t1;' 127.0.0.1:6020/rest/sql
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' select * from d1.t1;' 127.0.0.1:6041/rest/sql
|
||||
print 21-> $system_content
|
||||
if $system_content != @{"status":"error","code":866,"desc":"Table does not exist"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' create table d1.t1 (ts timestamp, speed int)' 127.0.0.1:6020/rest/sql
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' create table d1.t1 (ts timestamp, speed int)' 127.0.0.1:6041/rest/sql
|
||||
print 22-> $system_content
|
||||
if $system_content != @{"status":"succ","head":["affected_rows"],"data":[[0]],"rows":0}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' select * from d1.t1 ' 127.0.0.1:6020/rest/sql
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' select * from d1.t1 ' 127.0.0.1:6041/rest/sql
|
||||
print 23-> $system_content
|
||||
if $system_content != @{"status":"succ","head":["ts","speed"],"data":[],"rows":0}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
#24
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:41.022', 1)" 127.0.0.1:6020/rest/sql
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:41.022', 1)" 127.0.0.1:6041/rest/sql
|
||||
print 24-> $system_content
|
||||
if $system_content != @{"status":"succ","head":["affected_rows"],"data":[[1]],"rows":1}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' select * from d1.t1 ' 127.0.0.1:6020/rest/sql
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' select * from d1.t1 ' 127.0.0.1:6041/rest/sql
|
||||
print 25-> $system_content
|
||||
if $system_content != @{"status":"succ","head":["ts","speed"],"data":[["2017-12-25 21:28:41.022",1]],"rows":1}@ then
|
||||
return -1
|
||||
|
@ -178,53 +178,53 @@ endi
|
|||
|
||||
#26
|
||||
print 25-> no print
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:42.022', 2)" 127.0.0.1:6020/rest/sql
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:42.022', 2)" 127.0.0.1:6041/rest/sql
|
||||
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:43.022', 3)" 127.0.0.1:6020/rest/sql
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:43.022', 3)" 127.0.0.1:6041/rest/sql
|
||||
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:44.022', 4)" 127.0.0.1:6020/rest/sql
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:44.022', 4)" 127.0.0.1:6041/rest/sql
|
||||
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:45.022', 5)" 127.0.0.1:6020/rest/sql
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:45.022', 5)" 127.0.0.1:6041/rest/sql
|
||||
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:46.022', 6)" 127.0.0.1:6020/rest/sql
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:46.022', 6)" 127.0.0.1:6041/rest/sql
|
||||
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:47.022', 7)" 127.0.0.1:6020/rest/sql
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:47.022', 7)" 127.0.0.1:6041/rest/sql
|
||||
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:48.022', 8)" 127.0.0.1:6020/rest/sql
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:48.022', 8)" 127.0.0.1:6041/rest/sql
|
||||
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:49.022', 9)" 127.0.0.1:6020/rest/sql
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:49.022', 9)" 127.0.0.1:6041/rest/sql
|
||||
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:50.022', 10)" 127.0.0.1:6020/rest/sql
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:50.022', 10)" 127.0.0.1:6041/rest/sql
|
||||
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:51.022', 11)" 127.0.0.1:6020/rest/sql
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.t1 values('2017-12-25 21:28:51.022', 11)" 127.0.0.1:6041/rest/sql
|
||||
|
||||
#27
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' select * from d1.t1 ' 127.0.0.1:6020/rest/sql
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' select * from d1.t1 ' 127.0.0.1:6041/rest/sql
|
||||
print 27-> $system_content
|
||||
if $system_content != @{"status":"succ","head":["ts","speed"],"data":[["2017-12-25 21:28:41.022",1],["2017-12-25 21:28:42.022",2],["2017-12-25 21:28:43.022",3],["2017-12-25 21:28:44.022",4],["2017-12-25 21:28:45.022",5],["2017-12-25 21:28:46.022",6],["2017-12-25 21:28:47.022",7],["2017-12-25 21:28:48.022",8],["2017-12-25 21:28:49.022",9],["2017-12-25 21:28:50.022",10],["2017-12-25 21:28:51.022",11]],"rows":11}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'create database d2' 127.0.0.1:6020/rest/sql
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'create database d2' 127.0.0.1:6041/rest/sql
|
||||
print 28-> $system_content
|
||||
if $system_content != @{"status":"succ","head":["affected_rows"],"data":[[0]],"rows":0}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' create table d2.t1 (ts timestamp, speed int)' 127.0.0.1:6020/rest/sql
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' create table d2.t1 (ts timestamp, speed int)' 127.0.0.1:6041/rest/sql
|
||||
print 29-> $system_content
|
||||
if $system_content != @{"status":"succ","head":["affected_rows"],"data":[[0]],"rows":0}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
#30
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d2.t1 values('2017-12-25 21:28:41.022', 1)" 127.0.0.1:6020/rest/sql
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d2.t1 values('2017-12-25 21:28:41.022', 1)" 127.0.0.1:6041/rest/sql
|
||||
print 30-> $system_content
|
||||
if $system_content != @{"status":"succ","head":["affected_rows"],"data":[[1]],"rows":1}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' select * from d2.t1 ' 127.0.0.1:6020/rest/sql
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d ' select * from d2.t1 ' 127.0.0.1:6041/rest/sql
|
||||
print 31-> $system_content
|
||||
if $system_content != @{"status":"succ","head":["ts","speed"],"data":[["2017-12-25 21:28:41.022",1]],"rows":1}@ then
|
||||
return -1
|
||||
|
|
|
@ -28,8 +28,8 @@ sql create table d1.table_rest9 (ts timestamp, i int)
|
|||
|
||||
print =============== step2 - login
|
||||
|
||||
system_content curl 127.0.0.1:6020/rest/login/root/taosdata
|
||||
print curl 127.0.0.1:6020/rest/login/root/taosdata -----> $system_content
|
||||
system_content curl 127.0.0.1:6041/rest/login/root/taosdata
|
||||
print curl 127.0.0.1:6041/rest/login/root/taosdata -----> $system_content
|
||||
|
||||
if $system_content != {"status":"succ","code":0,"desc":"/KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04"} then
|
||||
return -1
|
||||
|
@ -37,17 +37,17 @@ endi
|
|||
|
||||
print =============== step3 - query data
|
||||
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'insert into d1.table_rest1 values('now+1s', 1) d1.table_rest2 values('now+1s', 1) d1.table_rest3 values('now+1s', 1) d1.table_rest4 values('now+1s', 1) ' 127.0.0.1:6020/rest/sql
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'insert into d1.table_rest1 values('now+1s', 1) d1.table_rest2 values('now+1s', 1) d1.table_rest3 values('now+1s', 1) d1.table_rest4 values('now+1s', 1) ' 127.0.0.1:6020/rest/sql
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'insert into d1.table_rest1 values('now+1s', 1) d1.table_rest2 values('now+1s', 1) d1.table_rest3 values('now+1s', 1) d1.table_rest4 values('now+1s', 1) ' 127.0.0.1:6020/rest/sql
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'insert into d1.table_rest1 values('now+1s', 1) d1.table_rest2 values('now+1s', 1) d1.table_rest3 values('now+1s', 1) d1.table_rest4 values('now+1s', 1) ' 127.0.0.1:6020/rest/sql
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'insert into d1.table_rest1 values('now+1s', 1) d1.table_rest2 values('now+1s', 1) d1.table_rest3 values('now+1s', 1) d1.table_rest4 values('now+1s', 1) ' 127.0.0.1:6020/rest/sql
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'insert into d1.table_rest1 values('now+1s', 1) d1.table_rest2 values('now+1s', 1) d1.table_rest3 values('now+1s', 1) d1.table_rest4 values('now+1s', 1) ' 127.0.0.1:6020/rest/sql
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'insert into d1.table_rest1 values('now+1s', 1) d1.table_rest2 values('now+1s', 1) d1.table_rest3 values('now+1s', 1) d1.table_rest4 values('now+1s', 1) ' 127.0.0.1:6020/rest/sql
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'insert into d1.table_rest1 values('now+1s', 1) d1.table_rest2 values('now+1s', 1) d1.table_rest3 values('now+1s', 1) d1.table_rest4 values('now+1s', 1) ' 127.0.0.1:6041/rest/sql
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'insert into d1.table_rest1 values('now+1s', 1) d1.table_rest2 values('now+1s', 1) d1.table_rest3 values('now+1s', 1) d1.table_rest4 values('now+1s', 1) ' 127.0.0.1:6041/rest/sql
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'insert into d1.table_rest1 values('now+1s', 1) d1.table_rest2 values('now+1s', 1) d1.table_rest3 values('now+1s', 1) d1.table_rest4 values('now+1s', 1) ' 127.0.0.1:6041/rest/sql
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'insert into d1.table_rest1 values('now+1s', 1) d1.table_rest2 values('now+1s', 1) d1.table_rest3 values('now+1s', 1) d1.table_rest4 values('now+1s', 1) ' 127.0.0.1:6041/rest/sql
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'insert into d1.table_rest1 values('now+1s', 1) d1.table_rest2 values('now+1s', 1) d1.table_rest3 values('now+1s', 1) d1.table_rest4 values('now+1s', 1) ' 127.0.0.1:6041/rest/sql
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'insert into d1.table_rest1 values('now+1s', 1) d1.table_rest2 values('now+1s', 1) d1.table_rest3 values('now+1s', 1) d1.table_rest4 values('now+1s', 1) ' 127.0.0.1:6041/rest/sql
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'insert into d1.table_rest1 values('now+1s', 1) d1.table_rest2 values('now+1s', 1) d1.table_rest3 values('now+1s', 1) d1.table_rest4 values('now+1s', 1) ' 127.0.0.1:6041/rest/sql
|
||||
|
||||
print =============== step5 - query data
|
||||
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_rest1' 127.0.0.1:6020/rest/sql
|
||||
print curl 127.0.0.1:6020/rest/sql -----> $system_content
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_rest1' 127.0.0.1:6041/rest/sql
|
||||
print curl 127.0.0.1:6041/rest/sql -----> $system_content
|
||||
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
|
@ -37,10 +37,10 @@ while $i < 2
|
|||
$i = $i + 1
|
||||
endw
|
||||
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d 'select * from db0.st0 limit 100' 127.0.0.1:6020/rest/sql
|
||||
print curl 127.0.0.1:6020/rest/sql -----> $system_content
|
||||
system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d 'select * from db0.st0 limit 100' 127.0.0.1:6041/rest/sql
|
||||
print curl 127.0.0.1:6041/rest/sql -----> $system_content
|
||||
|
||||
#system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d "select * from db0.st0 where tbname in ('tb0', 'tb1') limit 1000" 127.0.0.1:6020/rest/sql
|
||||
#print curl 127.0.0.1:6020/rest/sql -----> $system_content
|
||||
#system_content curl -H 'Authorization: Basic cm9vdDp0YW9zZGF0YQ==' -d "select * from db0.st0 where tbname in ('tb0', 'tb1') limit 1000" 127.0.0.1:6041/rest/sql
|
||||
#print curl 127.0.0.1:6041/rest/sql -----> $system_content
|
||||
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
|
@ -13,231 +13,231 @@ sql connect
|
|||
print ============================ dnode1 start
|
||||
|
||||
print =============== step1 - parse
|
||||
system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:6020/telegraf/
|
||||
system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:6041/telegraf/
|
||||
print $system_content
|
||||
|
||||
if $system_content != @{"status":"error","code":5022,"desc":"database name can not be null"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_admin' -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:6020/telegraf/
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_admin' -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:6041/telegraf/
|
||||
print $system_content
|
||||
|
||||
if $system_content != @{"status":"error","code":5022,"desc":"database name can not be null"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_admin' -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:6020/telegraf/d123456789012345678901234567890123456
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_admin' -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:6041/telegraf/d123456789012345678901234567890123456
|
||||
print $system_content
|
||||
|
||||
if $system_content != @{"status":"error","code":5023,"desc":"database name too long"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -u root:taosdata -d '[]' 127.0.0.1:6020/telegraf/db/root/taosdata1
|
||||
system_content curl -u root:taosdata -d '[]' 127.0.0.1:6041/telegraf/db/root/taosdata1
|
||||
print $system_content
|
||||
|
||||
if $system_content != @{"status":"error","code":5027,"desc":"metric name not find"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -u root:taosdata -d '{}' 127.0.0.1:6020/telegraf/db/root/taosdata1
|
||||
system_content curl -u root:taosdata -d '{}' 127.0.0.1:6041/telegraf/db/root/taosdata1
|
||||
print $system_content
|
||||
|
||||
if $system_content != @{"status":"error","code":5027,"desc":"metric name not find"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -u root:taosdata -d '[{}]' 127.0.0.1:6020/telegraf/db/root/taosdata1
|
||||
system_content curl -u root:taosdata -d '[{}]' 127.0.0.1:6041/telegraf/db/root/taosdata1
|
||||
print $system_content
|
||||
|
||||
if $system_content != @{"status":"error","code":5027,"desc":"metric name not find"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -u root:taosdata -d '{"metrics": []}' 127.0.0.1:6020/telegraf/db/root/taosdata1
|
||||
system_content curl -u root:taosdata -d '{"metrics": []}' 127.0.0.1:6041/telegraf/db/root/taosdata1
|
||||
print $system_content
|
||||
|
||||
if $system_content != @{"status":"error","code":5025,"desc":"metrics size is 0"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -u root:taosdata -d '{"metrics": [{}]}' 127.0.0.1:6020/telegraf/db/root/taosdata1
|
||||
system_content curl -u root:taosdata -d '{"metrics": [{}]}' 127.0.0.1:6041/telegraf/db/root/taosdata1
|
||||
print $system_content
|
||||
|
||||
if $system_content != @{"status":"error","code":5027,"desc":"metric name not find"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -u root:taosdata -d '{"metrics": 12}' 127.0.0.1:6020/telegraf/db/root/taosdata1
|
||||
system_content curl -u root:taosdata -d '{"metrics": 12}' 127.0.0.1:6041/telegraf/db/root/taosdata1
|
||||
print $system_content
|
||||
|
||||
if $system_content != @{"status":"error","code":5025,"desc":"metrics size is 0"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
#system_content curl -u root:taosdata -d '{"metrics": [{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}]}' 127.0.0.1:6020/telegraf/db/root/taosdata1
|
||||
#system_content curl -u root:taosdata -d '{"metrics": [{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}]}' 127.0.0.1:6041/telegraf/db/root/taosdata1
|
||||
#print $system_content
|
||||
|
||||
#if $system_content != @{"status":"error","code":5026,"desc":"metrics size can not more than 50"}@ then
|
||||
# return -1
|
||||
#endi
|
||||
|
||||
system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:6020/telegraf/db/root/taosdata1
|
||||
system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:6041/telegraf/db/root/taosdata1
|
||||
print $system_content
|
||||
|
||||
if $system_content != @{"status":"error","code":5027,"desc":"metric name not find"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":111,"tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:6020/telegraf/db/root/taosdata1
|
||||
system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":111,"tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:6041/telegraf/db/root/taosdata1
|
||||
print $system_content
|
||||
|
||||
if $system_content != @{"status":"error","code":5028,"desc":"metric name type should be string"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:6020/telegraf/db/root/taosdata1
|
||||
system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:6041/telegraf/db/root/taosdata1
|
||||
print $system_content
|
||||
|
||||
if $system_content != @{"status":"error","code":5029,"desc":"metric name length is 0"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:6020/telegraf/db/root/taosdata1
|
||||
system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234a1234567890123456789012345678901234","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:6041/telegraf/db/root/taosdata1
|
||||
print $system_content
|
||||
|
||||
if $system_content != @{"status":"error","code":5030,"desc":"metric name length too long"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"}}' 127.0.0.1:6020/telegraf/db/root/taosdata1
|
||||
system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"}}' 127.0.0.1:6041/telegraf/db/root/taosdata1
|
||||
print $system_content
|
||||
|
||||
if $system_content != @{"status":"error","code":5031,"desc":"timestamp not find"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":""}' 127.0.0.1:6020/telegraf/db/root/taosdata1
|
||||
system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":""}' 127.0.0.1:6041/telegraf/db/root/taosdata1
|
||||
print $system_content
|
||||
|
||||
if $system_content != @{"status":"error","code":5032,"desc":"timestamp type should be integer"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":-1}' 127.0.0.1:6020/telegraf/db/root/taosdata1
|
||||
system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":-1}' 127.0.0.1:6041/telegraf/db/root/taosdata1
|
||||
print $system_content
|
||||
|
||||
if $system_content != @{"status":"error","code":5033,"desc":"timestamp value smaller than 0"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","timestamp":1535784122}' 127.0.0.1:6020/telegraf/db/root/taosdata1
|
||||
system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","timestamp":1535784122}' 127.0.0.1:6041/telegraf/db/root/taosdata1
|
||||
print $system_content
|
||||
|
||||
if $system_content != @{"status":"error","code":5034,"desc":"tags not find"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{},"timestamp":1535784122}' 127.0.0.1:6020/telegraf/db/root/taosdata1
|
||||
system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{},"timestamp":1535784122}' 127.0.0.1:6041/telegraf/db/root/taosdata1
|
||||
print $system_content
|
||||
|
||||
if $system_content != @{"status":"error","code":5035,"desc":"tags size is 0"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":"","timestamp":1535784122}' 127.0.0.1:6020/telegraf/db/root/taosdata1
|
||||
system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":"","timestamp":1535784122}' 127.0.0.1:6041/telegraf/db/root/taosdata1
|
||||
print $system_content
|
||||
|
||||
if $system_content != @{"status":"error","code":5035,"desc":"tags size is 0"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
#system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor","host":"windows","instance":"1","objectname":"Processor","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:6020/telegraf/db/root/taosdata
|
||||
#system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor","host":"windows","instance":"1","objectname":"Processor","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:6041/telegraf/db/root/taosdata
|
||||
#print $system_content
|
||||
|
||||
#if $system_content != @{"status":"error","code":5036,"desc":"tags size too long"}@ then
|
||||
# return -1
|
||||
#endi
|
||||
|
||||
system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{},"timestamp":1535784122}' 127.0.0.1:6020/telegraf/db/root/taosdata1
|
||||
system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{},"timestamp":1535784122}' 127.0.0.1:6041/telegraf/db/root/taosdata1
|
||||
print $system_content
|
||||
|
||||
if $system_content != @{"status":"error","code":5035,"desc":"tags size is 0"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"":"windows"},"timestamp":1535784122}' 127.0.0.1:6020/telegraf/db/root/taosdata1
|
||||
system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"":"windows"},"timestamp":1535784122}' 127.0.0.1:6041/telegraf/db/root/taosdata1
|
||||
print $system_content
|
||||
|
||||
if $system_content != @{"status":"error","code":5038,"desc":"tag name is null"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
#system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host111111111111222222222222222222222":""},"timestamp":1535784122}' 127.0.0.1:6020/telegraf/db/root/taosdata1
|
||||
#system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host111111111111222222222222222222222":""},"timestamp":1535784122}' 127.0.0.1:6041/telegraf/db/root/taosdata1
|
||||
#print $system_content
|
||||
|
||||
#if $system_content != @{"status":"error","code":5039,"desc":"tag name length too long"}@ then
|
||||
# return -1
|
||||
#endi
|
||||
|
||||
system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":true},"timestamp":1535784122}' 127.0.0.1:6020/telegraf/db/root/taosdata1
|
||||
system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":true},"timestamp":1535784122}' 127.0.0.1:6041/telegraf/db/root/taosdata1
|
||||
print $system_content
|
||||
|
||||
if $system_content != @{"status":"error","code":5040,"desc":"tag value type should be number or string"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":""},"timestamp":1535784122}' 127.0.0.1:6020/telegraf/db/root/taosdata1
|
||||
system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":""},"timestamp":1535784122}' 127.0.0.1:6041/telegraf/db/root/taosdata1
|
||||
print $system_content
|
||||
|
||||
if $system_content != @{"status":"error","code":5041,"desc":"tag value is null"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"5022":"111"},"timestamp":1535784122}' 127.0.0.1:6020/telegraf/db/root/taosdata1
|
||||
system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"5022":"111"},"timestamp":1535784122}' 127.0.0.1:6041/telegraf/db/root/taosdata1
|
||||
print $system_content
|
||||
|
||||
if $system_content != @{"status":"error","code":5042,"desc":"table is null"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"host111111111111222222222222222222222host111111111111222222222222222222222host111111111111222222222222222222222host111111111111222222222222222222222host111111111111222222222222222222222host111111111111222222222222222222222host111111111111222222222222222222222host111111111111222222222222222222222"},"timestamp":1535784122}' 127.0.0.1:6020/telegraf/db/root/taosdata1
|
||||
system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"host111111111111222222222222222222222host111111111111222222222222222222222host111111111111222222222222222222222host111111111111222222222222222222222host111111111111222222222222222222222host111111111111222222222222222222222host111111111111222222222222222222222host111111111111222222222222222222222"},"timestamp":1535784122}' 127.0.0.1:6041/telegraf/db/root/taosdata1
|
||||
print $system_content
|
||||
|
||||
if $system_content != @{"status":"error","code":5043,"desc":"table name length too long"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -u root:taosdata -d '{"fields":{},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:6020/telegraf/db/root/taosdata1
|
||||
system_content curl -u root:taosdata -d '{"fields":{},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:6041/telegraf/db/root/taosdata1
|
||||
print $system_content
|
||||
|
||||
if $system_content != @{"status":"error","code":5045,"desc":"fields size is 0"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -u root:taosdata -d '{"fields":{"":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:6020/telegraf/db/root/taosdata1
|
||||
system_content curl -u root:taosdata -d '{"fields":{"":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:6041/telegraf/db/root/taosdata1
|
||||
print $system_content
|
||||
|
||||
if $system_content != @{"status":"error","code":5048,"desc":"field name is null"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":"","Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:6020/telegraf/db/root/taosdata1
|
||||
system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":"","Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:6041/telegraf/db/root/taosdata1
|
||||
print $system_content
|
||||
|
||||
if $system_content != @{"status":"error","code":5051,"desc":"field value is null"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":true,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:6020/telegraf/db/root/taosdata1
|
||||
system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":true,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1535784122}' 127.0.0.1:6041/telegraf/db/root/taosdata1
|
||||
print $system_content
|
||||
|
||||
if $system_content != @{"status":"error","code":5050,"desc":"field value type should be number or string"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1564641722000}' 127.0.0.1:6020/telegraf/db
|
||||
system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1564641722000}' 127.0.0.1:6041/telegraf/db
|
||||
|
||||
print $system_content
|
||||
|
||||
|
@ -248,7 +248,7 @@ endi
|
|||
sleep 3000
|
||||
|
||||
print =============== step2 - insert single data
|
||||
system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1564641722000}' 127.0.0.1:6020/telegraf/db/
|
||||
system_content curl -u root:taosdata -d '{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"windows","instance":"1","objectname":"Processor"},"timestamp":1564641722000}' 127.0.0.1:6041/telegraf/db/
|
||||
|
||||
print $system_content
|
||||
|
||||
|
@ -256,7 +256,7 @@ print $system_content
|
|||
# return -1
|
||||
#endi
|
||||
|
||||
system_content curl -u root:taosdata -d 'select * from db.win_cpu_windows_1_Processor' 127.0.0.1:6020/rest/sql/
|
||||
system_content curl -u root:taosdata -d 'select * from db.win_cpu_windows_1_Processor' 127.0.0.1:6041/rest/sql/
|
||||
|
||||
print $system_content
|
||||
|
||||
|
@ -265,7 +265,7 @@ print $system_content
|
|||
#endi
|
||||
|
||||
print =============== step3 - multi-query data
|
||||
system_content curl -u root:taosdata -d '{"metrics": [{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"window1","instance":"1","objectname":"Processor"},"timestamp":1564641723000},{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"window2","instance":"1","objectname":"Processor"},"timestamp":1564641723000}]}' 127.0.0.1:6020/telegraf/db/
|
||||
system_content curl -u root:taosdata -d '{"metrics": [{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"window1","instance":"1","objectname":"Processor"},"timestamp":1564641723000},{"fields":{"Percent_DPC_Time":0,"Percent_Idle_Time":95.59830474853516,"Percent_Interrupt_Time":0,"Percent_Privileged_Time":0,"Percent_Processor_Time":0,"Percent_User_Time":0},"name":"win_cpu","tags":{"host":"window2","instance":"1","objectname":"Processor"},"timestamp":1564641723000}]}' 127.0.0.1:6041/telegraf/db/
|
||||
|
||||
print $system_content
|
||||
|
||||
|
@ -273,7 +273,7 @@ if $system_content != @{"metrics":[{"metric":"win_cpu","stable":"win_cpu","table
|
|||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -u root:taosdata -d 'select * from db.win_cpu_window1_1_Processor' 127.0.0.1:6020/rest/sql/
|
||||
system_content curl -u root:taosdata -d 'select * from db.win_cpu_window1_1_Processor' 127.0.0.1:6041/rest/sql/
|
||||
|
||||
print $system_content
|
||||
|
||||
|
@ -281,7 +281,7 @@ print $system_content
|
|||
# return -1
|
||||
#endi
|
||||
|
||||
system_content curl -u root:taosdata -d 'select count(*) from db.win_cpu' 127.0.0.1:6020/rest/sql/
|
||||
system_content curl -u root:taosdata -d 'select count(*) from db.win_cpu' 127.0.0.1:6041/rest/sql/
|
||||
|
||||
print $system_content
|
||||
|
||||
|
|
|
@ -38,6 +38,6 @@ sql insert into t2 values(1575880055000, 2);
|
|||
|
||||
sql select st1.ts, st1.f1, st2.f2 from db.st1, db.st2 where st1.t1=st2.t2 and st1.ts=st2.ts
|
||||
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select st1.ts, st1.f1, st2.f2 from db.st1, db.st2 where st1.t1=st2.t2 and st1.ts=st2.ts' 127.0.0.1:6020/restful/sql
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select st1.ts, st1.f1, st2.f2 from db.st1, db.st2 where st1.t1=st2.t2 and st1.ts=st2.ts' 127.0.0.1:6041/restful/sql
|
||||
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||
|
|
|
@ -31,63 +31,63 @@ sql insert into table_admin values('2017-12-25 21:28:50.022', 10)
|
|||
|
||||
print =============== step1 - login
|
||||
|
||||
system_content curl 127.0.0.1:6020/admin/
|
||||
system_content curl 127.0.0.1:6041/admin/
|
||||
print 1-> $system_content
|
||||
if $system_content != @{"status":"error","code":5011,"desc":"no auth info input"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl 127.0.0.1:6020/admin/xx
|
||||
system_content curl 127.0.0.1:6041/admin/xx
|
||||
print 2-> $system_content
|
||||
if $system_content != @{"status":"error","code":5011,"desc":"no auth info input"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl 127.0.0.1:6020/admin/login
|
||||
system_content curl 127.0.0.1:6041/admin/login
|
||||
print 3-> $system_content
|
||||
if $system_content != @{"status":"error","code":5011,"desc":"no auth info input"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl 127.0.0.1:6020/admin/login/root
|
||||
system_content curl 127.0.0.1:6041/admin/login/root
|
||||
print 4-> $system_content
|
||||
if $system_content != @{"status":"error","code":5011,"desc":"no auth info input"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl 127.0.0.1:6020/admin/login/root/123
|
||||
system_content curl 127.0.0.1:6041/admin/login/root/123
|
||||
print 5-> $system_content
|
||||
if $system_content != @{"status":"error","code":3,"desc":"Authentication failure"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl 127.0.0.1:6020/admin/login/root/123/1/1/3
|
||||
system_content curl 127.0.0.1:6041/admin/login/root/123/1/1/3
|
||||
print 6-> $system_content
|
||||
if $system_content != @{"status":"error","code":3,"desc":"Authentication failure"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.' -d 'show databases' 127.0.0.1:6020/admin/login/root/1
|
||||
system_content curl -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.' -d 'show databases' 127.0.0.1:6041/admin/login/root/1
|
||||
print 7-> $system_content
|
||||
if $system_content != @{"status":"error","code":5010,"desc":"invalid type of Authorization"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -H 'Authorization: Taosd eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3d3cudGFvc2RhdGEuY29tIiwicGFzcyI6InRhb3NkYXRhIiwic3ViIjoicm9vdCJ9.xPv3b5odlR7YF8G_QWASjIRbMtA5v4ItToJ35fFgi' 127.0.0.1:6020/admin/login/root/1
|
||||
system_content curl -H 'Authorization: Taosd eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ3d3cudGFvc2RhdGEuY29tIiwicGFzcyI6InRhb3NkYXRhIiwic3ViIjoicm9vdCJ9.xPv3b5odlR7YF8G_QWASjIRbMtA5v4ItToJ35fFgi' 127.0.0.1:6041/admin/login/root/1
|
||||
print 8-> $system_content
|
||||
if $system_content != @{"status":"error","code":5053,"desc":"parse http auth token error"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sleep 3000
|
||||
system_content curl 127.0.0.1:6020/admin/login/root/taosdata
|
||||
system_content curl 127.0.0.1:6041/admin/login/root/taosdata
|
||||
print 9 -----> $system_content
|
||||
|
||||
if $system_content != {"status":"succ","code":0,"desc":"/KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04"} then
|
||||
return -1
|
||||
endi
|
||||
|
||||
#system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'show databases' 127.0.0.1:6020/admin/login/root/1
|
||||
#system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'show databases' 127.0.0.1:6041/admin/login/root/1
|
||||
#print 10-> $system_content
|
||||
#if $system_content != @{"status":"error","code":29,"desc":"failed to connect to server"}@ then
|
||||
# return -1
|
||||
|
@ -95,14 +95,14 @@ endi
|
|||
|
||||
print =============== step2 - logout
|
||||
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' 127.0.0.1:6020/admin/logout
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' 127.0.0.1:6041/admin/logout
|
||||
print 10 -----> $system_content
|
||||
|
||||
if $system_content != @{"status":"succ","code":0,"desc":"logout success"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl 127.0.0.1:6020/admin/logout
|
||||
system_content curl 127.0.0.1:6041/admin/logout
|
||||
print 11 -----> $system_content
|
||||
|
||||
if $system_content != @{"status":"error","code":5011,"desc":"no auth info input"}@ then
|
||||
|
@ -111,69 +111,69 @@ endi
|
|||
|
||||
print =============== step3 - info
|
||||
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' 127.0.0.1:6020/admin/info
|
||||
print curl 127.0.0.1:6020/admin/info -----> $system_content
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' 127.0.0.1:6041/admin/info
|
||||
print curl 127.0.0.1:6041/admin/info -----> $system_content
|
||||
if $system_content != {"status":"succ","data":[{"dbs":1,"tables":1,"users":3,"mnodes":1,"dnodes":1}]} then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print =============== step4 - meta
|
||||
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'show mnodes' 127.0.0.1:6020/admin/meta
|
||||
print curl 127.0.0.1:6020/admin/meta -----> $system_content
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'show mnodes' 127.0.0.1:6041/admin/meta
|
||||
print curl 127.0.0.1:6041/admin/meta -----> $system_content
|
||||
#if $system_content != @{"status":"succ","head":["column type","column name","column bytes"],"data":[["binary","IP",16],["timestamp","created time",8],["binary","status",10],["binary","role",10],["binary","public ip",16]],"rows":5}@ then
|
||||
# return -1
|
||||
#endi
|
||||
|
||||
print =============== step5 - query data
|
||||
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_admin' 127.0.0.1:6020/admin/sql
|
||||
print curl 127.0.0.1:6020/admin/all -----> $system_content
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_admin' 127.0.0.1:6041/admin/sql
|
||||
print curl 127.0.0.1:6041/admin/all -----> $system_content
|
||||
if $system_content != @{"status":"succ","head":["ts","i"],"data":[["2017-12-25 21:28:41.022",1],["2017-12-25 21:28:42.022",2],["2017-12-25 21:28:43.022",3],["2017-12-25 21:28:44.022",4],["2017-12-25 21:28:45.022",5],["2017-12-25 21:28:46.022",6],["2017-12-25 21:28:47.022",7],["2017-12-25 21:28:48.022",8],["2017-12-25 21:28:49.022",9],["2017-12-25 21:28:50.022",10]],"rows":10}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_admin' 127.0.0.1:6020/admin/sql
|
||||
print curl 127.0.0.1:6020/admin/sql -----> $system_content
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_admin' 127.0.0.1:6041/admin/sql
|
||||
print curl 127.0.0.1:6041/admin/sql -----> $system_content
|
||||
if $system_content != @{"status":"succ","head":["ts","i"],"data":[["2017-12-25 21:28:41.022",1],["2017-12-25 21:28:42.022",2],["2017-12-25 21:28:43.022",3],["2017-12-25 21:28:44.022",4],["2017-12-25 21:28:45.022",5],["2017-12-25 21:28:46.022",6],["2017-12-25 21:28:47.022",7],["2017-12-25 21:28:48.022",8],["2017-12-25 21:28:49.022",9],["2017-12-25 21:28:50.022",10]],"rows":10}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print =============== step6 - insert data
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.table_admin values('2017-12-25 21:28:51.022', 11)" 127.0.0.1:6020/admin/sql
|
||||
print curl 127.0.0.1:6020/admin/sql -----> $system_content
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d "insert into d1.table_admin values('2017-12-25 21:28:51.022', 11)" 127.0.0.1:6041/admin/sql
|
||||
print curl 127.0.0.1:6041/admin/sql -----> $system_content
|
||||
if $system_content != @{"status":"succ","head":["affect_rows"],"data":[[1]],"rows":1}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_admin' 127.0.0.1:6020/admin/all
|
||||
print curl 127.0.0.1:6020/admin/all -----> $system_content
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_admin' 127.0.0.1:6041/admin/all
|
||||
print curl 127.0.0.1:6041/admin/all -----> $system_content
|
||||
if $system_content != @{"status":"succ","head":["ts","i"],"data":[["2017-12-25 21:28:41.022",1],["2017-12-25 21:28:42.022",2],["2017-12-25 21:28:43.022",3],["2017-12-25 21:28:44.022",4],["2017-12-25 21:28:45.022",5],["2017-12-25 21:28:46.022",6],["2017-12-25 21:28:47.022",7],["2017-12-25 21:28:48.022",8],["2017-12-25 21:28:49.022",9],["2017-12-25 21:28:50.022",10],["2017-12-25 21:28:51.022",11]],"rows":11}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
#system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_admin' 127.0.0.1:6020/admin/sql
|
||||
#print curl 127.0.0.1:6020/admin/sql -----> $system_content
|
||||
#system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'select * from d1.table_admin' 127.0.0.1:6041/admin/sql
|
||||
#print curl 127.0.0.1:6041/admin/sql -----> $system_content
|
||||
#if $system_content != @{"status":"succ","head":["ts","i"],"data":[["2017-12-25 21:28:51.022",11],["2017-12-25 21:28:50.022",10],["2017-12-25 21:28:49.022",9],["2017-12-25 21:28:48.022",8],["2017-12-25 21:28:47.022",7],["2017-12-25 21:28:46.022",6],["2017-12-25 21:28:45.022",5],["2017-12-25 21:28:44.022",4],["2017-12-25 21:28:43.022",3],["2017-12-25 21:28:42.022",2]],"rows":10}@ then
|
||||
# return -1
|
||||
#endi
|
||||
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' 127.0.0.1:6020/admin/info
|
||||
print curl 127.0.0.1:6020/admin/info -----> $system_content
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' 127.0.0.1:6041/admin/info
|
||||
print curl 127.0.0.1:6041/admin/info -----> $system_content
|
||||
if $system_content != {"status":"succ","data":[{"dbs":1,"tables":1,"users":3,"mnodes":1,"dnodes":1}]} then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print =============== step7 - use dbs
|
||||
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'use d1;' 127.0.0.1:6020/admin/all
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'use d1;' 127.0.0.1:6041/admin/all
|
||||
print 23-> $system_content
|
||||
if $system_content != @{"status":"error","code":5017,"desc":"no need to execute use db cmd"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print =============== step8 - monitor dbs
|
||||
#system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'show dnodes;show mnodes;' 127.0.0.1:6020/admin/sqls
|
||||
#system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d 'show dnodes;show mnodes;' 127.0.0.1:6041/admin/sqls
|
||||
#print 24-> $system_content
|
||||
#if $system_content != @[{"status":"succ","head":["IP","created time","open vnodes","free vnodes","status","balance state"],"data":[["127.0.0.1","2018-09-04 #11:16:13.985",1,3,"ready","balanced"]],"rows":1},{"status":"succ","head":["IP","created time","status","role"],"data":[["127.0.0.1","2018-09-04 11:16:13.371","serving","master"]],"rows":1}]@ then
|
||||
# return -1
|
||||
|
|
|
@ -11,92 +11,92 @@ sql connect
|
|||
print ============================ dnode1 start
|
||||
|
||||
print =============== step1 - parse
|
||||
system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6020/opentsdb/
|
||||
system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6041/opentsdb/
|
||||
print $system_content
|
||||
if $system_content != @{"status":"error","code":5057,"desc":"database name can not be null"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6020/opentsdb/db123456789012345678901234567890db
|
||||
system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6041/opentsdb/db123456789012345678901234567890db
|
||||
print $system_content
|
||||
if $system_content != @{"status":"error","code":5058,"desc":"database name too long"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6020/opentsdb/
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6041/opentsdb/
|
||||
print $system_content
|
||||
if $system_content != @{"status":"error","code":5057,"desc":"database name can not be null"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6020/opentsdb/db/put2
|
||||
system_content curl -H 'Authorization: Taosd /KfeAzX/f9na8qdtNZmtONryp201ma04bEl8LcvLUd7a8qdtNZmtONryp201ma04' -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6041/opentsdb/db/put2
|
||||
print $system_content
|
||||
if $system_content != @{"status":"error","code":5009,"desc":"http url parse error"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -u root:taosdata -d '[]' 127.0.0.1:6020/opentsdb/db/put
|
||||
system_content curl -u root:taosdata -d '[]' 127.0.0.1:6041/opentsdb/db/put
|
||||
print $system_content
|
||||
if $system_content != @{"status":"error","code":5060,"desc":"metrics size is 0"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -u root:taosdata -d '[' 127.0.0.1:6020/opentsdb/db/put
|
||||
system_content curl -u root:taosdata -d '[' 127.0.0.1:6041/opentsdb/db/put
|
||||
print $system_content
|
||||
if $system_content != @{"status":"error","code":5059,"desc":"invalid opentsdb json fromat"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -u root:taosdata -d '{}' 127.0.0.1:6020/opentsdb/db/put
|
||||
system_content curl -u root:taosdata -d '{}' 127.0.0.1:6041/opentsdb/db/put
|
||||
print $system_content
|
||||
if $system_content != @{"status":"error","code":5060,"desc":"metrics size is 0"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -u root:taosdata -d '[{}]' 127.0.0.1:6020/opentsdb/db/put
|
||||
system_content curl -u root:taosdata -d '[{}]' 127.0.0.1:6041/opentsdb/db/put
|
||||
print $system_content
|
||||
|
||||
if $system_content != @{"status":"error","code":5062,"desc":"metric name not find"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -u root:taosdata -d '[{"metric": 1,"timestamp": 1346846400,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6020/opentsdb/db/put
|
||||
system_content curl -u root:taosdata -d '[{"metric": 1,"timestamp": 1346846400,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6041/opentsdb/db/put
|
||||
print $system_content
|
||||
if $system_content != @{"status":"error","code":5063,"desc":"metric name type should be string"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -u root:taosdata -d '[{"metric": "","timestamp": 1346846400,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6020/opentsdb/db/put
|
||||
system_content curl -u root:taosdata -d '[{"metric": "","timestamp": 1346846400,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6041/opentsdb/db/put
|
||||
print $system_content
|
||||
if $system_content != @{"status":"error","code":5064,"desc":"metric name length is 0"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -u root:taosdata -d '[{"metric": "ab1234567890123456789012345678ab1234567890123456789012345678","timestamp": 1346846400,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6020/opentsdb/db/put
|
||||
system_content curl -u root:taosdata -d '[{"metric": "ab1234567890123456789012345678ab1234567890123456789012345678","timestamp": 1346846400,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6041/opentsdb/db/put
|
||||
print $system_content
|
||||
if $system_content != @{"errors":[{"datapoint":{"metric":"ab1234567890123456789012345678ab1234567890123456789012345678","stable":"ab1234567890123456789012345678ab1234567890123456789012345678_d_bbb","table":"ab1234567890123456789012345678ab1234567890123456789012345678_d_bbb_lga_1_web01","timestamp":1346846400,"value":18.000000,"tags":{"dc":"lga","group1":"1","host":"web01"},"status":"error","code":1547,"desc":"Timestamp data out of range"}}],"failed":1,"success":0,"affected_rows":0}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6020/opentsdb/db/put
|
||||
system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6041/opentsdb/db/put
|
||||
print $system_content
|
||||
if $system_content != @{"status":"error","code":5066,"desc":"timestamp not find"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": "2","value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6020/opentsdb/db/put
|
||||
system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": "2","value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6041/opentsdb/db/put
|
||||
print $system_content
|
||||
if $system_content != @{"status":"error","code":5067,"desc":"timestamp type should be integer"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": -1,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6020/opentsdb/db/put
|
||||
system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": -1,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6041/opentsdb/db/put
|
||||
print $system_content
|
||||
if $system_content != @{"status":"error","code":5068,"desc":"timestamp value smaller than 0"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6020/opentsdb/db/put
|
||||
system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6041/opentsdb/db/put
|
||||
print $system_content
|
||||
if $system_content != @{"status":"error","code":5078,"desc":"value not find"}@ then
|
||||
return -1
|
||||
|
@ -104,49 +104,49 @@ endi
|
|||
|
||||
#######
|
||||
|
||||
system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18}]' 127.0.0.1:6020/opentsdb/db/put
|
||||
system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18}]' 127.0.0.1:6041/opentsdb/db/put
|
||||
print $system_content
|
||||
if $system_content != @{"status":"error","code":5069,"desc":"tags not find"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {}}]' 127.0.0.1:6020/opentsdb/db/put
|
||||
system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {}}]' 127.0.0.1:6041/opentsdb/db/put
|
||||
print $system_content
|
||||
if $system_content != @{"status":"error","code":5070,"desc":"tags size is 0"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": 0}]' 127.0.0.1:6020/opentsdb/db/put
|
||||
system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": 0}]' 127.0.0.1:6041/opentsdb/db/put
|
||||
print $system_content
|
||||
if $system_content != @{"status":"error","code":5070,"desc":"tags size is 0"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host": "web01","group1": "1","group1": "1","group1": "1","group1": "1","group1": "1","dc": "lga"}}]' 127.0.0.1:6020/opentsdb/db/put
|
||||
system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host": "web01","group1": "1","group1": "1","group1": "1","group1": "1","group1": "1","dc": "lga"}}]' 127.0.0.1:6041/opentsdb/db/put
|
||||
print $system_content
|
||||
if $system_content != @{"errors":[{"datapoint":{"metric":"sys_cpu","stable":"sys_cpu_d_bbbbbbb","table":"sys_cpu_d_bbbbbbb_lga_1_1_1_1_1_web01","timestamp":1346846400,"value":18.000000,"tags":{"dc":"lga","group1":"1","group1":"1","group1":"1","group1":"1","group1":"1","host":"web01"},"status":"error","code":866,"desc":"failed to create table"}}],"failed":1,"success":0,"affected_rows":0}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"": "web01"}}]' 127.0.0.1:6020/opentsdb/db/put
|
||||
system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"": "web01"}}]' 127.0.0.1:6041/opentsdb/db/put
|
||||
print $system_content
|
||||
if $system_content != @{"status":"error","code":5073,"desc":"tag name is null"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host01123456789001123456789001123456789001123456789001123456789001123456789": "01"}}]' 127.0.0.1:6020/opentsdb/db/put
|
||||
system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host01123456789001123456789001123456789001123456789001123456789001123456789": "01"}}]' 127.0.0.1:6041/opentsdb/db/put
|
||||
print $system_content
|
||||
if $system_content != @{"status":"error","code":5074,"desc":"tag name length too long"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host": "web011234567890011234567890011234567890011234567890011234567890011234567890011234567890011234567890"}}]' 127.0.0.1:6020/opentsdb/db/put
|
||||
system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host": "web011234567890011234567890011234567890011234567890011234567890011234567890011234567890011234567890"}}]' 127.0.0.1:6041/opentsdb/db/put
|
||||
print $system_content
|
||||
if $system_content != @{"status":"error","code":5077,"desc":"tag value can not more than 64"}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host": ""}}]' 127.0.0.1:6020/opentsdb/db/put
|
||||
system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400,"value": 18,"tags": {"host": ""}}]' 127.0.0.1:6041/opentsdb/db/put
|
||||
print $system_content
|
||||
if $system_content != @{"status":"error","code":5076,"desc":"tag value is null"}@ then
|
||||
return -1
|
||||
|
@ -155,26 +155,26 @@ endi
|
|||
sleep 3000
|
||||
|
||||
print =============== step2 - insert single data
|
||||
system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400000,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6020/opentsdb/db/put
|
||||
system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400000,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6041/opentsdb/db/put
|
||||
print $system_content
|
||||
if $system_content != @{"errors":[{"datapoint":{"metric":"sys_cpu","stable":"sys_cpu_d_bbb","table":"sys_cpu_d_bbb_lga_1_web01","timestamp":1346846400000,"value":18.000000,"tags":{"dc":"lga","group1":"1","host":"web01"},"affected_rows":1,"status":"succ"}}],"failed":0,"success":1,"affected_rows":1}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400000,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6020/opentsdb/db/put
|
||||
system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846400000,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6041/opentsdb/db/put
|
||||
print $system_content
|
||||
if $system_content != @{"errors":[{"datapoint":{"metric":"sys_cpu","stable":"sys_cpu_d_bbb","table":"sys_cpu_d_bbb_lga_1_web01","timestamp":1346846400000,"value":18.000000,"tags":{"dc":"lga","group1":"1","host":"web01"},"affected_rows":1,"status":"succ"}}],"failed":0,"success":1,"affected_rows":1}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -u root:taosdata -d 'select * from db.sys_cpu_d_bbb_lga_1_web01' 127.0.0.1:6020/rest/sql/
|
||||
system_content curl -u root:taosdata -d 'select * from db.sys_cpu_d_bbb_lga_1_web01' 127.0.0.1:6041/rest/sql/
|
||||
print $system_content
|
||||
if $system_content != @{"status":"succ","head":["ts","value"],"data":[["2012-09-05 20:00:00.000",18.000000000]],"rows":1}@ then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print =============== step3 - multi-query data
|
||||
system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846405000,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}},{"metric": "sys_cpu","timestamp": 1346846402000,"value": 18,"tags": {"host": "web02","group1": "1","dc": "lga"}}]' 127.0.0.1:6020/opentsdb/db/put
|
||||
system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846405000,"value": 18,"tags": {"host": "web01","group1": "1","dc": "lga"}},{"metric": "sys_cpu","timestamp": 1346846402000,"value": 18,"tags": {"host": "web02","group1": "1","dc": "lga"}}]' 127.0.0.1:6041/opentsdb/db/put
|
||||
|
||||
print $system_content
|
||||
|
||||
|
@ -182,7 +182,7 @@ if $system_content != @{"errors":[{"datapoint":{"metric":"sys_cpu","stable":"sys
|
|||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -u root:taosdata -d 'select * from db.sys_cpu_d_bbb_lga_1_web01' 127.0.0.1:6020/rest/sql/
|
||||
system_content curl -u root:taosdata -d 'select * from db.sys_cpu_d_bbb_lga_1_web01' 127.0.0.1:6041/rest/sql/
|
||||
|
||||
print $system_content
|
||||
|
||||
|
@ -190,7 +190,7 @@ if $system_content != @{"status":"succ","head":["ts","value"],"data":[["2012-09-
|
|||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -u root:taosdata -d 'select count(*) from db.sys_cpu_d_bbb' 127.0.0.1:6020/rest/sql/
|
||||
system_content curl -u root:taosdata -d 'select count(*) from db.sys_cpu_d_bbb' 127.0.0.1:6041/rest/sql/
|
||||
|
||||
print $system_content
|
||||
|
||||
|
@ -199,7 +199,7 @@ if $system_content != @{"status":"succ","head":["count(*)"],"data":[[3]],"rows":
|
|||
endi
|
||||
|
||||
print =============== step4 - summary-put data
|
||||
system_content curl -u root:taosdata -d '[{"metric": "sys_mem","timestamp": 1346846400000,"value": 8,"tags": {"host": "web01","group1": "1","dc": "lga"}},{"metric": "sys_mem","timestamp": 1346846405000,"value": 9,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6020/opentsdb/db/put?details=false
|
||||
system_content curl -u root:taosdata -d '[{"metric": "sys_mem","timestamp": 1346846400000,"value": 8,"tags": {"host": "web01","group1": "1","dc": "lga"}},{"metric": "sys_mem","timestamp": 1346846405000,"value": 9,"tags": {"host": "web01","group1": "1","dc": "lga"}}]' 127.0.0.1:6041/opentsdb/db/put?details=false
|
||||
|
||||
print $system_content
|
||||
|
||||
|
@ -207,7 +207,7 @@ if $system_content != @{"failed":0,"success":2}@ then
|
|||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -u root:taosdata -d 'select * from db.sys_mem_d_bbb_lga_1_web01' 127.0.0.1:6020/rest/sql/
|
||||
system_content curl -u root:taosdata -d 'select * from db.sys_mem_d_bbb_lga_1_web01' 127.0.0.1:6041/rest/sql/
|
||||
|
||||
print $system_content
|
||||
|
||||
|
@ -215,7 +215,7 @@ if $system_content != @{"status":"succ","head":["ts","value"],"data":[["2012-09-
|
|||
return -1
|
||||
endi
|
||||
|
||||
system_content curl -u root:taosdata -d 'select count(*) from db.sys_mem_d_bbb' 127.0.0.1:6020/rest/sql/
|
||||
system_content curl -u root:taosdata -d 'select count(*) from db.sys_mem_d_bbb' 127.0.0.1:6041/rest/sql/
|
||||
|
||||
print $system_content
|
||||
|
||||
|
@ -225,13 +225,13 @@ endi
|
|||
|
||||
print =============== step5 - prepare data
|
||||
|
||||
system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846402000,"value": 19,"tags": {"host": "web01","group1": "1","dc": "lga"}},{"metric": "sys_cpu","timestamp": 1346846402,"value": 19,"tags": {"host": "web02","group1": "1","dc": "lga"}}]' 127.0.0.1:6020/opentsdb/db/put
|
||||
system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846403000,"value": 20,"tags": {"host": "web01","group1": "1","dc": "lga"}},{"metric": "sys_cpu","timestamp": 1346846403,"value": 20,"tags": {"host": "web02","group1": "1","dc": "lga"}}]' 127.0.0.1:6020/opentsdb/db/put
|
||||
system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846404000,"value": 21,"tags": {"host": "web01","group1": "1","dc": "lga"}},{"metric": "sys_cpu","timestamp": 1346846404,"value": 21,"tags": {"host": "web02","group1": "1","dc": "lga"}}]' 127.0.0.1:6020/opentsdb/db/put
|
||||
system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846405000,"value": 22,"tags": {"host": "web01","group1": "1","dc": "lga"}},{"metric": "sys_cpu","timestamp": 1346846405,"value": 22,"tags": {"host": "web02","group1": "1","dc": "lga"}}]' 127.0.0.1:6020/opentsdb/db/put
|
||||
system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846406000,"value": 23,"tags": {"host": "web01","group1": "1","dc": "lga"}},{"metric": "sys_cpu","timestamp": 1346846406,"value": 23,"tags": {"host": "web02","group1": "1","dc": "lga"}}]' 127.0.0.1:6020/opentsdb/db/put
|
||||
system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846402000,"value": 19,"tags": {"host": "web01","group1": "1","dc": "lga"}},{"metric": "sys_cpu","timestamp": 1346846402,"value": 19,"tags": {"host": "web02","group1": "1","dc": "lga"}}]' 127.0.0.1:6041/opentsdb/db/put
|
||||
system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846403000,"value": 20,"tags": {"host": "web01","group1": "1","dc": "lga"}},{"metric": "sys_cpu","timestamp": 1346846403,"value": 20,"tags": {"host": "web02","group1": "1","dc": "lga"}}]' 127.0.0.1:6041/opentsdb/db/put
|
||||
system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846404000,"value": 21,"tags": {"host": "web01","group1": "1","dc": "lga"}},{"metric": "sys_cpu","timestamp": 1346846404,"value": 21,"tags": {"host": "web02","group1": "1","dc": "lga"}}]' 127.0.0.1:6041/opentsdb/db/put
|
||||
system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846405000,"value": 22,"tags": {"host": "web01","group1": "1","dc": "lga"}},{"metric": "sys_cpu","timestamp": 1346846405,"value": 22,"tags": {"host": "web02","group1": "1","dc": "lga"}}]' 127.0.0.1:6041/opentsdb/db/put
|
||||
system_content curl -u root:taosdata -d '[{"metric": "sys_cpu","timestamp": 1346846406000,"value": 23,"tags": {"host": "web01","group1": "1","dc": "lga"}},{"metric": "sys_cpu","timestamp": 1346846406,"value": 23,"tags": {"host": "web02","group1": "1","dc": "lga"}}]' 127.0.0.1:6041/opentsdb/db/put
|
||||
|
||||
system_content curl -u root:taosdata -d 'select count(*) from db.sys_cpu_d_bbb' 127.0.0.1:6020/rest/sql/
|
||||
system_content curl -u root:taosdata -d 'select count(*) from db.sys_cpu_d_bbb' 127.0.0.1:6041/rest/sql/
|
||||
print $system_content
|
||||
if $system_content != @{"status":"succ","head":["count(*)"],"data":[[7]],"rows":1}@ then
|
||||
return -1
|
||||
|
|
|
@ -590,7 +590,7 @@ int simExecuteRestFulCommand(SScript *script, char *command) {
|
|||
|
||||
bool simCreateRestFulConnect(SScript *script, char *user, char *pass) {
|
||||
char command[4096];
|
||||
sprintf(command, "curl 127.0.0.1:6020/rest/login/%s/%s", user, pass);
|
||||
sprintf(command, "curl 127.0.0.1:6041/rest/login/%s/%s", user, pass);
|
||||
|
||||
bool success = false;
|
||||
for (int attempt = 0; attempt < 10; ++attempt) {
|
||||
|
@ -815,7 +815,7 @@ bool simExecuteNativeSqlCommand(SScript *script, char *rest, bool isSlow) {
|
|||
bool simExecuteRestFulSqlCommand(SScript *script, char *rest) {
|
||||
SCmdLine *line = &script->lines[script->linePos];
|
||||
char command[4096];
|
||||
sprintf(command, "curl -H 'Authorization: Taosd %s' -d \"%s\" 127.0.0.1:6020/rest/sql", script->auth, rest);
|
||||
sprintf(command, "curl -H 'Authorization: Taosd %s' -d \"%s\" 127.0.0.1:6041/rest/sql", script->auth, rest);
|
||||
|
||||
int ret = -1;
|
||||
for (int attempt = 0; attempt < 10; ++attempt) {
|
||||
|
@ -947,7 +947,7 @@ bool simExecuteSqlErrorCmd(SScript *script, char *rest) {
|
|||
TAOS_RES* pSql = NULL;
|
||||
if (simAsyncQuery) {
|
||||
char command[4096];
|
||||
sprintf(command, "curl -H 'Authorization: Taosd %s' -d '%s' 127.0.0.1:6020/rest/sql", script->auth, rest);
|
||||
sprintf(command, "curl -H 'Authorization: Taosd %s' -d '%s' 127.0.0.1:6041/rest/sql", script->auth, rest);
|
||||
ret = simExecuteRestFulCommand(script, command);
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Reference in New Issue