Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
20343c13
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
20343c13
编写于
10月 15, 2021
作者:
S
shenglian zhou
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' into szhou/feature/affectedrows
上级
58b6ed11
4d9e67e8
变更
45
隐藏空白更改
内联
并排
Showing
45 changed file
with
866 addition
and
269 deletion
+866
-269
.drone.yml
.drone.yml
+10
-1
.gitmodules
.gitmodules
+3
-0
Jenkinsfile
Jenkinsfile
+2
-1
README.md
README.md
+9
-0
alert/release.sh
alert/release.sh
+1
-1
cmake/define.inc
cmake/define.inc
+12
-2
cmake/input.inc
cmake/input.inc
+5
-5
documentation20/cn/00.index/docs.md
documentation20/cn/00.index/docs.md
+5
-0
documentation20/cn/05.insert/docs.md
documentation20/cn/05.insert/docs.md
+67
-1
documentation20/cn/08.connector/docs.md
documentation20/cn/08.connector/docs.md
+60
-1
documentation20/cn/12.taos-sql/docs.md
documentation20/cn/12.taos-sql/docs.md
+33
-0
documentation20/cn/14.devops/01.telegraf/docs.md
documentation20/cn/14.devops/01.telegraf/docs.md
+70
-0
documentation20/cn/14.devops/02.collectd/docs.md
documentation20/cn/14.devops/02.collectd/docs.md
+77
-0
documentation20/cn/images/IT-DevOps-Solutions-Collectd-StatsD.png
...ation20/cn/images/IT-DevOps-Solutions-Collectd-StatsD.png
+0
-0
documentation20/cn/images/IT-DevOps-Solutions-Telegraf.png
documentation20/cn/images/IT-DevOps-Solutions-Telegraf.png
+0
-0
documentation20/cn/images/IT-DevOps-Solutions-collectd-dashboard.png
...on20/cn/images/IT-DevOps-Solutions-collectd-dashboard.png
+0
-0
documentation20/cn/images/IT-DevOps-Solutions-statsd-dashboard.png
...tion20/cn/images/IT-DevOps-Solutions-statsd-dashboard.png
+0
-0
documentation20/cn/images/IT-DevOps-Solutions-telegraf-dashboard.png
...on20/cn/images/IT-DevOps-Solutions-telegraf-dashboard.png
+0
-0
packaging/check_package.sh
packaging/check_package.sh
+21
-15
packaging/deb/DEBIAN/preinst
packaging/deb/DEBIAN/preinst
+6
-2
packaging/deb/DEBIAN/prerm
packaging/deb/DEBIAN/prerm
+4
-3
packaging/deb/makedeb.sh
packaging/deb/makedeb.sh
+10
-0
packaging/deb/taosd
packaging/deb/taosd
+7
-0
packaging/release.sh
packaging/release.sh
+6
-2
packaging/rpm/tdengine.spec
packaging/rpm/tdengine.spec
+12
-0
packaging/tools/install.sh
packaging/tools/install.sh
+22
-2
packaging/tools/make_install.sh
packaging/tools/make_install.sh
+57
-25
packaging/tools/makeclient.sh
packaging/tools/makeclient.sh
+1
-1
packaging/tools/makepkg.sh
packaging/tools/makepkg.sh
+15
-3
packaging/tools/makepkg_power.sh
packaging/tools/makepkg_power.sh
+1
-0
packaging/tools/makepkg_pro.sh
packaging/tools/makepkg_pro.sh
+2
-1
packaging/tools/makepkg_tq.sh
packaging/tools/makepkg_tq.sh
+1
-0
packaging/tools/post.sh
packaging/tools/post.sh
+115
-84
packaging/tools/preun.sh
packaging/tools/preun.sh
+19
-9
packaging/tools/remove.sh
packaging/tools/remove.sh
+46
-37
packaging/tools/startPre.sh
packaging/tools/startPre.sh
+2
-1
src/client/src/tscParseLineProtocol.c
src/client/src/tscParseLineProtocol.c
+14
-1
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+1
-1
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+41
-42
src/connector/grafanaplugin
src/connector/grafanaplugin
+1
-1
src/plugins/CMakeLists.txt
src/plugins/CMakeLists.txt
+55
-0
src/plugins/blm3
src/plugins/blm3
+1
-0
tests/pytest/fulltest.sh
tests/pytest/fulltest.sh
+12
-12
tests/pytest/util/dnodes.py
tests/pytest/util/dnodes.py
+25
-0
tests/script/jenkins/basic.txt
tests/script/jenkins/basic.txt
+15
-15
未找到文件。
.drone.yml
浏览文件 @
20343c13
...
...
@@ -12,6 +12,7 @@ steps:
commands
:
-
apt-get update
-
apt-get install -y cmake build-essential
-
git submodule update --init --recursive
-
mkdir debug
-
cd debug
-
cmake ..
...
...
@@ -37,6 +38,7 @@ steps:
commands
:
-
apt-get update
-
apt-get install -y cmake build-essential
-
git submodule update --init --recursive
-
mkdir debug
-
cd debug
-
cmake .. -DCPUTYPE=aarch64 > /dev/null
...
...
@@ -64,6 +66,7 @@ steps:
-
echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
-
apt-get update
-
apt-get install -y -qq cmake build-essential
-
git submodule update --init --recursive
-
mkdir debug
-
cd debug
-
cmake .. -DCPUTYPE=aarch64 > /dev/null
...
...
@@ -89,6 +92,7 @@ steps:
image
:
arm64v8/centos:7
commands
:
-
yum install -y gcc gcc-c++ make cmake git
-
git submodule update --init --recursive
-
mkdir debug
-
cd debug
-
cmake .. -DCPUTYPE=aarch64 > /dev/null
...
...
@@ -114,6 +118,7 @@ steps:
image
:
arm64v8/centos:8
commands
:
-
dnf install -y gcc gcc-c++ make cmake epel-release git libarchive
-
git submodule update --init --recursive
-
mkdir debug
-
cd debug
-
cmake .. -DCPUTYPE=aarch64 > /dev/null
...
...
@@ -140,6 +145,7 @@ steps:
commands
:
-
apt-get update
-
apt-get install -y cmake build-essential
-
git submodule update --init --recursive
-
mkdir debug
-
cd debug
-
cmake .. -DCPUTYPE=aarch32 > /dev/null
...
...
@@ -166,7 +172,7 @@ steps:
commands
:
-
apt-get update
-
apt-get install -y gcc cmake3 build-essential git binutils-2.26
-
git submodule update --init --recursive
-
mkdir debug
-
cd debug
-
cmake ..
...
...
@@ -193,6 +199,7 @@ steps:
commands
:
-
apt-get update
-
apt-get install -y gcc cmake build-essential
-
git submodule update --init --recursive
-
mkdir debug
-
cd debug
-
cmake ..
...
...
@@ -218,6 +225,7 @@ steps:
commands
:
-
apt-get update
-
apt-get install -y gcc cmake build-essential
-
git submodule update --init --recursive
-
mkdir debug
-
cd debug
-
cmake ..
...
...
@@ -242,6 +250,7 @@ steps:
image
:
ansible/centos7-ansible
commands
:
-
yum install -y gcc gcc-c++ make cmake
-
git submodule update --init --recursive
-
mkdir debug
-
cd debug
-
cmake ..
...
...
.gitmodules
浏览文件 @
20343c13
...
...
@@ -16,3 +16,6 @@
[submodule "deps/TSZ"]
path = deps/TSZ
url = https://github.com/taosdata/TSZ.git
[submodule "src/plugins/blm3"]
path = src/plugins/blm3
url = https://github.com/taosdata/blm3
Jenkinsfile
浏览文件 @
20343c13
...
...
@@ -72,6 +72,7 @@ def pre_test(){
git fetch origin +refs/pull/${CHANGE_ID}/merge
git checkout -qf FETCH_HEAD
git clean -dfx
git submodule update --init --recursive
cd ${WK}
git reset --hard HEAD~10
'''
...
...
@@ -98,7 +99,7 @@ def pre_test(){
sh
'''
cd ${WK}
git pull >/dev/null
git submodule update --init --recursive
export TZ=Asia/Harbin
date
git clean -dfx
...
...
README.md
浏览文件 @
20343c13
...
...
@@ -88,6 +88,15 @@ To install Apache Maven:
sudo
dnf
install
-y
maven
```
### Setup golang environment
TDengine includes few components developed by Go language. Please refer to golang.org official documentation for golang environment setup.
Please use version 1.14+. For the user in China, we recommend using a proxy to accelerate package downloading.
```
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct
```
## Get the source codes
First of all, you may clone the source codes from github:
...
...
alert/release.sh
浏览文件 @
20343c13
...
...
@@ -52,7 +52,7 @@ echo "cpuType=${cpuType}"
echo
"osType=
${
osType
}
"
echo
"version=
${
version
}
"
GOOS
=
${
osType
}
GOARCH
=
${
cpuType
}
go build
-ldflags
'-X main.version='
${
version
}
GOOS
=
${
osType
}
GOARCH
=
${
cpuType
}
go
mod tidy
&&
go
build
-ldflags
'-X main.version='
${
version
}
mkdir
-p
TDengine-alert/driver
...
...
cmake/define.inc
浏览文件 @
20343c13
...
...
@@ -87,7 +87,7 @@ IF (TD_ARM_64)
ADD_DEFINITIONS
(
-
DUSE_LIBICONV
)
MESSAGE
(
STATUS
"arm64 is defined"
)
SET
(
COMMON_FLAGS
"-Wall -Werror -fPIC -fsigned-char -fpack-struct=8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE"
)
INCLUDE_DIRECTORIES
(
$
{
TD_COMMUNITY_DIR
}
/
deps
/
lua
/
src
)
ENDIF
()
...
...
@@ -124,7 +124,17 @@ IF (TD_APLHINE)
MESSAGE
(
STATUS
"aplhine is defined"
)
ENDIF
()
IF
(
TD_BUILD_HTTP
)
IF
(
TD_LINUX
)
IF
(
TD_ARM_32
)
SET
(
TD_BUILD_HTTP
TRUE
)
ADD_DEFINITIONS
(
-
DHTTP_EMBEDDED
)
ELSE
()
IF
(
TD_BUILD_HTTP
)
ADD_DEFINITIONS
(
-
DHTTP_EMBEDDED
)
ENDIF
()
ENDIF
()
ELSE
()
SET
(
TD_BUILD_HTTP
TRUE
)
ADD_DEFINITIONS
(
-
DHTTP_EMBEDDED
)
ENDIF
()
...
...
cmake/input.inc
浏览文件 @
20343c13
...
...
@@ -90,10 +90,10 @@ IF (${BUILD_JDBC} MATCHES "false")
SET
(
TD_BUILD_JDBC
FALSE
)
ENDIF
()
SET
(
TD_BUILD_HTTP
TRU
E
)
SET
(
TD_BUILD_HTTP
FALS
E
)
IF
(
$
{
BUILD_HTTP
}
MATCHES
"
fals
e"
)
SET
(
TD_BUILD_HTTP
FALS
E
)
IF
(
$
{
BUILD_HTTP
}
MATCHES
"
tru
e"
)
SET
(
TD_BUILD_HTTP
TRU
E
)
ENDIF
()
SET
(
TD_MEMORY_SANITIZER
FALSE
)
...
...
@@ -108,10 +108,10 @@ IF (${VERBOSE} MATCHES "true")
ENDIF
()
IF
(
$
{
TSZ_ENABLED
}
MATCHES
"true"
)
# define add
# define add
MESSAGE
(
STATUS
"build with TSZ enabled"
)
ADD_DEFINITIONS
(
-
DTD_TSZ
)
set
(
VAR_TSZ
"TSZ"
CACHE
INTERNAL
"global variant tsz"
)
ELSE
()
set
(
VAR_TSZ
""
CACHE
INTERNAL
"global variant empty"
)
ENDIF
()
ENDIF
()
documentation20/cn/00.index/docs.md
浏览文件 @
20343c13
...
...
@@ -118,6 +118,11 @@ TDengine是一个高效的存储、查询、分析时序大数据的平台,专
*
[
数据复制
](
/architecture/replica
)
:支持实时同步、异步复制,保证系统的High Availibility
*
[
技术博客
](
https://www.taosdata.com/cn/blog/?categories=3
)
:更多的技术分析和架构设计文章
## [应用 TDengine 快速搭建 IT 运维系统](/devops)
*
[
devops
](
/devops/telegraf
)
:使用 TDengine + Telegraf + Grafana 快速搭建 IT 运维系统
*
[
devops
](
/devops/collectd
)
:使用 TDengine + collectd_statsd + Grafana 快速搭建 IT 运维系统
## 常用工具
*
[
TDengine样例导入工具
](
https://www.taosdata.com/blog/2020/01/18/1166.html
)
...
...
documentation20/cn/05.insert/docs.md
浏览文件 @
20343c13
...
...
@@ -183,7 +183,73 @@ use prometheus;
select * from apiserver_request_latencies_bucket;
```
## <a class="anchor" id="telegraf"></a>Telegraf 直接写入
## <a class="anchor" id="telegraf"></a> Telegraf 直接写入(通过 BLM v3)
TDengine 新版本(2.3.0.0+)将包含一个 BLM3 独立程序,负责接受其他多种应用的数据写入。
配置方法,假设 TDengine 使用默认用户名 root 和密码 taosdata。在 /etc/telegraf/telegraf.conf 增加如下文字:
```
[[outputs.http]]
url = "http://<TDengine server/cluster host>:6041/influxdb/v1/write?db=metrics"
method = "POST"
timeout = "5s"
username = "root"
password = "taosdata"
data_format = "influx"
influx_max_line_bytes = 250
```
然后重启 telegraf:
```
sudo systemctl start telegraf
```
即可在 TDengine 中查询 metrics 数据库中 Telegraf 写入的数据。
BLM v3 相关配置参数请参考 blm3 --help 命令输出以及相关文档。
## <a class="anchor" id="collectd"></a> collectd 直接写入(通过 BLM v3)
安装 collectd
```
apt-get install collectd
```
在 /etc/collectd/collectd.conf 文件中增加如下内容:
```
LoadPlugin network
<Plugin network>
Server "192.168.17.180" "25826"
</Plugin>
```
重启 collectd
```
sudo systemctl start collectd
```
BLM v3 相关配置参数请参考 blm3 --help 命令输出以及相关文档。
## <a class="anchor" id="statsd"></a> StatsD 直接写入(通过 BLM v3)
安装 StatsD
请参考
[
官方文档
](
https://github.com/statsd/statsd
)
。
在 config.js 文件中增加如下内容后启动 StatsD:
```
backends 部分添加 "./backends/repeater"
repeater 部分添加 { host:'<TDengine server/cluster host>', port: 8126 }
```
实例配置文件:
```
{
port: 8125
, backends: ["./backends/repeater"]
, repeater: [{ host: '127.0.0.1', port: 8126}]
}
```
BLM v3 相关配置参数请参考 blm3 --help 命令输出以及相关文档。
## <a class="anchor" id="blm2-telegraf"></a> 使用 Bailongma 2.0 接入 Telegraf 数据写入
*
注意:TDengine 新版本(2.3.0.0+)提供新版本 Bailongma ,命名为 BLM v3,提供更简便的 Telegraf 数据写入以及其他更强大的功能,Bailongma v2 即之前版本将逐步不再维护。
[
Telegraf
](
https://www.influxdata.com/time-series-platform/telegraf/
)
是一流行的IT运维数据采集开源工具,TDengine提供一个小工具
[
Bailongma
](
https://github.com/taosdata/Bailongma
)
,只需在Telegraf做简单配置,无需任何代码,就可将Telegraf采集的数据直接写入TDengine,并按规则在TDengine自动创建库和相关表项。博文
[
用Docker容器快速搭建一个Devops监控Demo
](
https://www.taosdata.com/blog/2020/02/03/1189.html
)
即是采用bailongma将Prometheus和Telegraf的数据写入TDengine中的示例,可以参考。
...
...
documentation20/cn/08.connector/docs.md
浏览文件 @
20343c13
...
...
@@ -407,9 +407,9 @@ typedef struct TAOS_MULTI_BIND {
除了使用 SQL 方式或者使用参数绑定 API 写入数据外,还可以使用 Schemaless 的方式完成写入。Schemaless 可以免于预先创建超级表/数据子表的数据结构,而是可以直接写入数据,TDengine 系统会根据写入的数据内容自动创建和维护所需要的表结构。Schemaless 的使用方式详见
[
Schemaless 写入
](
https://www.taosdata.com/cn/documentation/insert#schemaless
)
章节,这里介绍与之配套使用的 C/C++ API。
2.
2.0.0版本接口:
-
`int taos_insert_lines(TAOS* taos, char* lines[], int numLines)`
(2.2.0.0 版本新增)
以 Schemaless 格式写入多行数据。其中:
*
taos:调用 taos_connect 返回的数据库连接。
*
lines:由 char 字符串指针组成的数组,指向本次想要写入数据库的多行数据。
...
...
@@ -421,6 +421,65 @@ typedef struct TAOS_MULTI_BIND {
1.
此接口是一个同步阻塞式接口,使用时机与
`taos_query()`
一致。
2.
在调用此接口之前,必须先调用
`taos_select_db()`
来确定目前是在向哪个 DB 来写入。
2.
3.0.0版本接口:
-
`int taos_schemaless_insert(TAOS* taos, const char* lines[], int numLines, int protocol, const char* precision, int* affectedRows, char* msg, int msgBufLen)`
**参数说明**
taos: 数据库连接,通过taos_connect 函数建立的数据库连接。
lines:文本数据。满足解析格式要求的无模式文本字符串。
numLines:文本数据的行数,不能为 0 。
protocol: 行协议类型,用于标识文本数据格式。
precision:文本数据中的时间戳精度字符串。
affectedRows:插入操作完成以后,正确写入到数据库中的记录行数。
msg: 如果出现错误(函数返回值不为 0)情况下,错误提示信息。该参数是输入参数,需要用户指定消息输出缓冲区,如果不指定该缓冲区(输入为NULL),即使出现错误也不会得到错误提示信息。
msgBufLen: 缓冲区的长度,避免错误提示消息越界。
**返回值**
0:无错误发生。
非 0 值:发生了错误。此时可以通过msg获取错误信息的提示。该返回值含义可以参考taoserror.h文件中的错误码定义。
**说明**
协议类型是枚举类型,包含以下三种格式:
SML_LINE_PROTOCOL:InfluxDB行协议(Line Protocol)
SML_TELNET_PROTOCOL: OpenTSDB文本行协议
SML_JSON_PROTOCOL: OpenTSDB Json协议格式
时间戳分辨率的说明使用如下字符串:“h“ (小时)、”m“(分钟)、”s“ (秒) ”ms“(毫秒)、”u“ (微秒)、”ns”(纳秒),不区分大小写。需要注意的是,时间戳分辨率参数只在协议类型为 SML_LINE_PROTOCOL 的时候生效。对于 OpenTSDB的文本协议,时间戳的解析遵循其官方解析规则 — 按照时间戳包含的字符的数量来确认时间精度。
```
c
#include <stdlib.h>
#include <stdio.h>
#include <taos.h>
int
main
()
{
const
char
*
host
=
"127.0.0.1"
;
const
char
*
user
=
"root"
;
const
char
*
passwd
=
"taosdata"
;
// error message buffer
char
msg
[
512
]
=
{
0
};
// connect to server
TAOS
*
taos
=
taos_connect
(
host
,
user
,
passwd
,
"test"
,
0
);
// prepare the line string
char
*
lines1
[]
=
{
"stg,t1=3i64,t2=4f64,t3=
\"
t3
\"
c1=3i64,c3=L
\"
passit
\"
,c2=false,c4=4f64 1626006833639000000"
,
"stg,t1=4i64,t3=
\"
t4
\"
,t2=5f64,t4=5f64 c1=3i64,c3=L
\"
passitagin
\"
,c2=true,c4=5f64,c5=5f64 1626006833641000000"
};
// schema-less insert
int
code
=
taos_schemaless_insert
(
taos
,
lines1
,
2
,
SML_LINE_PROTOCOL
,
"ns"
,
msg
,
sizeof
(
msg
)
/
sizeof
(
msg
[
0
]));
if
(
code
!=
0
)
{
printf
(
"failed to insert schema-less data, reason: %s
\n
"
,
msg
);
}
// close the connection
taos_close
(
taos
);
return
(
code
);
}
```
**注**
:后续2.2.0.0版本也更新成2.3.0.0版本的接口。
### 连续查询接口
TDengine提供时间驱动的实时流式计算API。可以每隔一指定的时间段,对一张或多张数据库的表(数据流)进行各种实时聚合计算操作。操作简单,仅有打开、关闭流的API。具体如下:
...
...
documentation20/cn/12.taos-sql/docs.md
浏览文件 @
20343c13
...
...
@@ -1472,6 +1472,39 @@ Query OK, 1 row(s) in set (0.001238s)
Query OK, 1 row(s) in set (0.000836s)
```
-
**CEIL**
```
mysql
SELECT CEIL(field_name) FROM { tb_name | stb_name } [WHERE clause];
```
功能说明:获得指定列的向上取整数的结果。
返回结果类型:与指定列的原始数据类型一致。例如,如果指定列的原始数据类型为 Float,那么返回的数据类型也为 Float;如果指定列的原始数据类型为 Double,那么返回的数据类型也为 Double。
适用数据类型:不能应用在 timestamp、binary、nchar、bool 类型字段上;在超级表查询中使用时,不能应用在 tag 列,无论 tag 列的类型是什么类型。
嵌套子查询支持:适用于内层查询和外层查询。
说明:
支持 +、-、*、/ 运算,如 ceil(col1) + ceil(col2)。
只能与普通列,选择(Selection)、投影(Projection)函数一起使用,不能与聚合(Aggregation)函数一起使用。
该函数可以应用在普通表和超级表上。
支持版本:指定计算算法的功能从 2.2.0.x 版本开始,2.2.0.0 之前的版本不支持指定使用算法的功能。
-
**FLOOR**
```
mysql
SELECT FLOOR(field_name) FROM { tb_name | stb_name } [WHERE clause];
```
功能说明:获得指定列的向下取整数的结果。
其他使用说明参见CEIL函数描述。
-
**ROUND**
```
mysql
SELECT ROUND(field_name) FROM { tb_name | stb_name } [WHERE clause];
```
功能说明:获得指定列的四舍五入的结果。
其他使用说明参见CEIL函数描述。
-
**四则运算**
```mysql
...
...
documentation20/cn/14.devops/01.telegraf/docs.md
0 → 100644
浏览文件 @
20343c13
# 使用 TDengine + Telegraf + Grafana 快速搭建 IT 运维展示系统
## 背景介绍
TDengine是涛思数据专为物联网、车联网、工业互联网、IT运维等设计和优化的大数据平台。自从 2019年 7 月开源以来,凭借创新的数据建模设计、快捷的安装方式、易用的编程接口和强大的数据写入查询性能博得了大量时序数据开发者的青睐。
IT 运维监测数据通常都是对时间特性比较敏感的数据,例如:
-
系统资源指标:CPU、内存、IO、带宽等。
-
软件系统指标:存活状态、连接数目、请求数目、超时数目、错误数目、响应时间、服务类型及其他与业务有关的指标。
当前主流的 IT 运维系统通常包含一个数据采集模块,一个数据存储模块,和一个可视化显示模块。Telegraf 和 Grafana 分别是当前最流行的数据采集模块和可视化显示模块之一。而数据存储模块可供选择的软件比较多,其中 OpenTSDB 或 InfluxDB 比较流行。而 TDengine 作为新兴的时序大数据平台,具备极强的高性能、高可靠、易管理、易维护的优势。
本文介绍不需要写一行代码,通过简单修改几行配置文件,就可以快速搭建一个基于 TDengine + Telegraf + Grafana 的 IT 运维系统。架构如下图:
![
IT-DevOps-Solutions-Telegraf.png
](
../../images/IT-DevOps-Solutions-Telegraf.png
)
## 安装步骤
### 安装 Telegraf,Grafana 和 TDengine
安装 Telegraf、Grafana 和 TDengine 请参考相关官方文档。
### Telegraf
请参考
[
官方文档
](
https://portal.influxdata.com/downloads/
)
。
### Grafana
请参考
[
官方文档
](
https://grafana.com/grafana/download
)
。
### 安装 TDengine
从涛思数据官网
[
下载
](
http://taosdata.com/cn/all-downloads/)页面下载最新
TDengine-server 2.3.0.0 或以上版本安装。
## 数据链路设置
### 复制 TDengine 插件到 grafana 插件目录
```
1. sudo cp -r /usr/local/taos/connector/grafanaplugin /var/lib/grafana/plugins/tdengine
2. sudo chown grafana:grafana -R /var/lib/grafana/plugins/tdengine
3. echo -e "[plugins]\nallow_loading_unsigned_plugins = taosdata-tdengine-datasource\n" | sudo tee -a /etc/grafana/grafana.ini
4. sudo systemctl restart grafana-server.service
```
### 修改 /etc/telegraf/telegraf.conf
假设 TDengine 使用默认用户名 root 和密码 taosdata。增加如下文字:
```
[[outputs.http]]
url = "http://<TDengine server/cluster host>:6041/influxdb/v1/write?db=metrics"
method = "POST"
timeout = "5s"
username = "root"
password = "taosdata"
data_format = "influx"
influx_max_line_bytes = 250
```
然后重启 telegraf:
```
sudo systemctl start telegraf
```
### 导入 Dashboard
使用 Web 浏览器访问 IP:3000 登录 Grafana 界面,系统初始用户名密码为 admin/admin。
点击左侧齿轮图标并选择 Plugins,应该可以找到 TDengine data source 插件图标。
点击左侧加号图标并选择 Import,按照界面提示选择 /usr/local/taos/connector/grafanaplugin/examples/telegraf/grafana/dashboards/telegraf-dashboard-v0.1.0.json 文件。如果按照 Grafana 的机器上没有安装 TDengine,可以从 https://github.com/taosdata/grafanaplugin/blob/master/examples/telegraf/grafana/dashboards/telegraf-dashboard-v0.1.0.json 下载 dashboard JSON 文件再导入。之后可以看到如下界面的仪表盘:
![
IT-DevOps-Solutions-telegraf-dashboard.png
](
../../images/IT-DevOps-Solutions-telegraf-dashboard.png
)
## 总结
以上演示如何快速搭建一个完整的 IT 运维展示系统。得力于 TDengine 2.3.0.0 版本中新增的 schemaless 协议解析功能,以及强大的生态软件适配能力,用户可以短短数分钟就可以搭建一个高效易用的 IT 运维系统。TDengine 强大的数据写入查询性能和其他丰富功能请参考官方文档和产品落地案例。
documentation20/cn/14.devops/02.collectd/docs.md
0 → 100644
浏览文件 @
20343c13
# 使用 TDengine + collectd/StatsD + Grafana 快速搭建 IT 运维监控系统
## 背景介绍
TDengine是涛思数据专为物联网、车联网、工业互联网、IT运维等设计和优化的大数据平台。自从 2019年 7 月开源以来,凭借创新的数据建模设计、快捷的安装方式、易用的编程接口和强大的数据写入查询性能博得了大量时序数据开发者的青睐。
IT 运维监测数据通常都是对时间特性比较敏感的数据,例如:
-
系统资源指标:CPU、内存、IO、带宽等。
-
软件系统指标:存活状态、连接数目、请求数目、超时数目、错误数目、响应时间、服务类型及其他与业务有关的指标。
当前主流的 IT 运维系统通常包含一个数据采集模块,一个数据存储模块,和一个可视化显示模块。collectd / statsD 作为老牌开源数据采集工具,具有广泛的用户群。但是 collectd / StatsD 自身功能有限,往往需要配合 Telegraf、Grafana 以及时序数据库组合搭建成为完整的监控系统。而 TDengine 新版本支持多种数据协议接入,可以直接接受 collectd 和 statsD 的数据写入,并提供 Grafana dashboard 进行图形化展示。
本文介绍不需要写一行代码,通过简单修改几行配置文件,就可以快速搭建一个基于 TDengine + collectd / statsD + Grafana 的 IT 运维系统。架构如下图:
![
IT-DevOps-Solutions-Collectd-StatsD.png
](
../../images/IT-DevOps-Solutions-Collectd-StatsD.png
)
## 安装步骤
安装 collectd, StatsD, Grafana 和 TDengine 请参考相关官方文档。
### 安装 collectd
请参考
[
官方文档
](
https://collectd.org/documentation.shtml
)
。
### 安装 StatsD
请参考
[
官方文档
](
https://github.com/statsd/statsd
)
。
### 安装 Grafana
请参考
[
官方文档
](
https://grafana.com/grafana/download
)
。
### 安装 TDengine
从涛思数据官网
[
下载
](
http://taosdata.com/cn/all-downloads/)页面下载最新
TDengine-server 2.3.0.0 或以上版本安装。
## 数据链路设置
### 复制 TDengine 插件到 grafana 插件目录
```
1. sudo cp -r /usr/local/taos/connector/grafanaplugin /var/lib/grafana/plugins/tdengine
2. sudo chown grafana:grafana -R /var/lib/grafana/plugins/tdengine
3. echo -e "[plugins]\nallow_loading_unsigned_plugins = taosdata-tdengine-datasource\n" | sudo tee -a /etc/grafana/grafana.ini
4. sudo systemctl restart grafana-server.service
```
### 配置 collectd
在 /etc/collectd/collectd.conf 文件中增加如下内容后启动 collectd:
```
LoadPlugin network
<Plugin network>
Server "<TDengine server/cluster host>" "25826"
</Plugin>
sudo systemctl start collectd
```
### 配置 StatsD
在 config.js 文件中增加如下内容后启动 StatsD:
```
backends 部分添加 "./backends/repeater"
repeater 部分添加 { host:'<TDengine server/cluster host>', port: 8126 }
```
### 导入 Dashboard
使用 Web 浏览器访问 IP:3000 登录 Grafana 界面,系统初始用户名密码为 admin/admin。
点击左侧齿轮图标并选择 Plugins,应该可以找到 TDengine data source 插件图标。
#### 导入 collectd 仪表盘
点击左侧加号图标并选择 Import,按照界面提示选择 /usr/local/taos/connector/grafanaplugin/examples/collectd/grafana/dashboards/collect-metrics-with-tdengine-v0.1.0.json 文件。如果按照 Grafana 的机器上没有安装 TDengine,可以从 https://github.com/taosdata/grafanaplugin/blob/master/examples/collectd/grafana/dashboards/collect-metrics-with-tdengine-v0.1.0.json 下载 dashboard json 文件再导入。之后可以看到如下界面的仪表盘:
![
IT-DevOps-Solutions-collectd-dashboard.png
](
../../images/IT-DevOps-Solutions-collectd-dashboard.png
)
#### 导入 StatsD 仪表盘
点击左侧加号图标并选择 Import,按照界面提示选择 /usr/local/taos/connector/grafanaplugin/examples/statsd/dashboards/statsd-with-tdengine-v0.1.0.json 文件。如果安装 Grafana 的机器上没有安装 TDengine,可以从 https://github.com/taosdata/grafanaplugin/blob/master/examples/statsd/dashboards/statsd-with-tdengine-v0.1.0.json 下载 dashboard json 文件再导入。之后可以看到如下界面的仪表盘:
![
IT-DevOps-Solutions-statsd-dashboard.png
](
../../images/IT-DevOps-Solutions-statsd-dashboard.png
)
## 总结
TDengine 作为新兴的时序大数据平台,具备极强的高性能、高可靠、易管理、易维护的优势。得力于 TDengine 2.3.0.0 版本中新增的 schemaless 协议解析功能,以及强大的生态软件适配能力,用户可以短短数分钟就可以搭建一个高效易用的 IT 运维系统或者适配一个已存在的系统。
TDengine 强大的数据写入查询性能和其他丰富功能请参考官方文档和产品成功落地案例。
documentation20/cn/images/IT-DevOps-Solutions-Collectd-StatsD.png
0 → 100644
浏览文件 @
20343c13
88.9 KB
documentation20/cn/images/IT-DevOps-Solutions-Telegraf.png
0 → 100644
浏览文件 @
20343c13
64.2 KB
documentation20/cn/images/IT-DevOps-Solutions-collectd-dashboard.png
0 → 100644
浏览文件 @
20343c13
178.9 KB
documentation20/cn/images/IT-DevOps-Solutions-statsd-dashboard.png
0 → 100644
浏览文件 @
20343c13
106.1 KB
documentation20/cn/images/IT-DevOps-Solutions-telegraf-dashboard.png
0 → 100644
浏览文件 @
20343c13
135.9 KB
packaging/check_package.sh
浏览文件 @
20343c13
...
...
@@ -95,7 +95,7 @@ function check_file() {
echo
-e
"
$1
/
$2
\0
33[31mnot exists
\0
33[0m!quit"
fin_result
=
$fin_result
"
\0
33[31m
$temp_version
\0
33[0m test failed!
\n
"
echo
-e
$fin_result
exit
8
exit
8
fi
}
...
...
@@ -107,6 +107,7 @@ function get_package_name() {
echo
${
var
::-17
}
fi
}
function
check_link
()
{
#check Link whether exists or broken
if
[
-L
$1
]
;
then
...
...
@@ -114,13 +115,13 @@ function check_link() {
echo
-e
"
$1
\0
33[31Broken link
\0
33[0m"
fin_result
=
$fin_result
"
\0
33[31m
$temp_version
\0
33[0m test failed!
\n
"
echo
-e
$fin_result
exit
8
exit
8
fi
else
echo
-e
"
$1
\0
33[31mnot exists
\0
33[0m!quit"
fin_result
=
$fin_result
"
\0
33[31m
$temp_version
\0
33[0m test failed!
\n
"
echo
-e
$fin_result
exit
8
exit
8
fi
}
...
...
@@ -141,11 +142,11 @@ function check_main_path() {
function
check_bin_path
()
{
# check install bin dir and all sub dir
bin_dir
=(
"taos"
"taosd"
"taosdemo"
"taosdump"
"remove.sh"
"tarbitrator"
"set_core.sh"
)
bin_dir
=(
"taos"
"taosd"
"
blm3"
"
taosdemo"
"taosdump"
"remove.sh"
"tarbitrator"
"set_core.sh"
)
for
i
in
${
bin_dir
[@]
}
;
do
check_file
${
sbin_dir
}
$i
done
lbin_dir
=(
"taos"
"taosd"
"taosdemo"
"taosdump"
"rmtaos"
"tarbitrator"
"set_core"
)
lbin_dir
=(
"taos"
"taosd"
"
blm3"
"
taosdemo"
"taosdump"
"rmtaos"
"tarbitrator"
"set_core"
)
for
i
in
${
lbin_dir
[@]
}
;
do
check_link
${
bin_link_dir
}
/
$i
done
...
...
@@ -155,7 +156,6 @@ function check_bin_path() {
echo
-e
"Check bin path:
\0
33[32mOK
\0
33[0m!"
}
function
check_lib_path
()
{
# check all links
check_link
${
lib_link_dir
}
/libtaos.so
...
...
@@ -168,9 +168,8 @@ function check_lib_path() {
echo
-e
"Check lib path:
\0
33[32mOK
\0
33[0m!"
}
function
check_header_path
()
{
# check all header
# check all header
header_dir
=(
"taos.h"
"taoserror.h"
)
for
i
in
${
header_dir
[@]
}
;
do
check_link
${
inc_link_dir
}
/
$i
...
...
@@ -178,6 +177,12 @@ function check_header_path() {
echo
-e
"Check bin path:
\0
33[32mOK
\0
33[0m!"
}
function
check_blm3_config_dir
()
{
# check all config
check_file
${
cfg_install_dir
}
blm3.toml
check_file
${
install_main_dir
}
/cfg blm.toml.org
echo
-e
"Check conf path:
\0
33[32mOK
\0
33[0m!"
}
function
check_config_dir
()
{
# check all config
...
...
@@ -194,7 +199,7 @@ function check_log_path() {
function
check_data_path
()
{
# check data path
check_file
${
data_dir
}
check_file
${
data_dir
}
echo
-e
"Check data path:
\0
33[32mOK
\0
33[0m!"
}
...
...
@@ -204,7 +209,7 @@ function install_TDengine() {
temp_version
=
$(
get_package_name
$1
)
cd
$(
get_package_name
$1
)
echo
-e
"
\0
33[32muninstall TDengine && install TDengine...
\0
33[0m"
rmtaos
>
/dev/null 2>&1
||
echo
'taosd not installed'
&&
echo
-e
'\n\n'
|./install.sh
>
/dev/null 2>&1
rmtaos
>
/dev/null 2>&1
||
echo
'taosd not installed'
&&
echo
-e
'\n\n'
|./install.sh
>
/dev/null 2>&1
echo
-e
"
\0
33[32mTDengine has been installed!
\0
33[0m"
echo
-e
"
\0
33[32mTDengine is starting...
\0
33[0m"
kill_process taos
&&
systemctl start taosd
&&
sleep
10
...
...
@@ -216,18 +221,19 @@ function test_TDengine() {
check_lib_path
check_header_path
check_config_dir
check_blm3_config_dir
check_log_path
check_data_path
result
=
`
taos
-s
'create database test ;create table test.tt(ts timestamp ,i int);insert into test.tt values(now,11);select * from test.tt'
2>&1
||
:
`
if
[[
$result
=
~
"Unable to establish"
]]
;
then
echo
-e
"
\0
33[31mTDengine connect failed
\0
33[0m"
echo
-e
"
\0
33[31mTDengine connect failed
\0
33[0m"
fin_result
=
$fin_result
"
\0
33[31m
$temp_version
\0
33[0m test failed!
\n
"
echo
-e
$fin_result
exit
8
fi
exit
8
fi
echo
-e
"Check TDengine connect:
\0
33[32mOK
\0
33[0m!"
fin_result
=
$fin_result
"
\0
33[32m
$temp_version
\0
33[0m test OK!
\n
"
}
}
# ## ==============================Main program starts from here============================
TD_package_name
=
`
ls
${
script_dir
}
/
*
server
*
gz |awk
-F
'/'
'{print $NF}'
`
temp
=
`
pwd
`
...
...
@@ -242,4 +248,4 @@ for i in $TD_package_name;do
test_TDengine
done
echo
"============================================================"
echo
-e
$fin_result
\ No newline at end of file
echo
-e
$fin_result
packaging/deb/DEBIAN/preinst
浏览文件 @
20343c13
...
...
@@ -24,9 +24,13 @@ fi
# if taos.cfg already softlink, remove it
cfg_install_dir
=
"/etc/taos"
install_main_dir
=
"/usr/local/taos"
if
[
-f
${
cfg_install_dir
}
/taos.cfg
]
;
then
if
[
-f
"
${
install_main_dir
}
/taos.cfg"
]
;
then
${
csudo
}
rm
-f
${
install_main_dir
}
/cfg/taos.cfg
||
:
fi
if
[
-f
"
${
install_main_dir
}
/blm.toml"
]
;
then
${
csudo
}
rm
-f
${
install_main_dir
}
/cfg/blm.toml
||
:
fi
# there can not libtaos.so*, otherwise ln -s error
${
csudo
}
rm
-f
${
install_main_dir
}
/driver/libtaos
*
||
:
${
csudo
}
rm
-f
${
install_main_dir
}
/driver/libtaos
*
||
:
packaging/deb/DEBIAN/prerm
浏览文件 @
20343c13
...
...
@@ -17,7 +17,7 @@ else
bin_link_dir
=
"/usr/bin"
lib_link_dir
=
"/usr/lib"
inc_link_dir
=
"/usr/include"
data_link_dir
=
"/usr/local/taos/data"
log_link_dir
=
"/usr/local/taos/log"
cfg_link_dir
=
"/usr/local/taos/cfg"
...
...
@@ -25,15 +25,16 @@ else
# Remove all links
${
csudo
}
rm
-f
${
bin_link_dir
}
/taos
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/taosd
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/blm3
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/taosdemo
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/taosdump
||
:
${
csudo
}
rm
-f
${
cfg_link_dir
}
/
*
||
:
${
csudo
}
rm
-f
${
inc_link_dir
}
/taos.h
||
:
${
csudo
}
rm
-f
${
lib_link_dir
}
/libtaos.
*
||
:
${
csudo
}
rm
-f
${
log_link_dir
}
||
:
${
csudo
}
rm
-f
${
data_link_dir
}
||
:
pid
=
$(
ps
-ef
|
grep
"taosd"
|
grep
-v
"grep"
|
awk
'{print $2}'
)
if
[
-n
"
$pid
"
]
;
then
${
csudo
}
kill
-9
$pid
||
:
...
...
packaging/deb/makedeb.sh
浏览文件 @
20343c13
...
...
@@ -44,15 +44,25 @@ mkdir -p ${pkg_dir}${install_home_path}/init.d
mkdir
-p
${
pkg_dir
}${
install_home_path
}
/script
cp
${
compile_dir
}
/../packaging/cfg/taos.cfg
${
pkg_dir
}${
install_home_path
}
/cfg
if
[
-f
"
${
compile_dir
}
/test/cfg/blm.toml"
]
;
then
cp
${
compile_dir
}
/test/cfg/blm.toml
${
pkg_dir
}${
install_home_path
}
/cfg
fi
cp
${
compile_dir
}
/../packaging/deb/taosd
${
pkg_dir
}${
install_home_path
}
/init.d
cp
${
compile_dir
}
/../packaging/tools/post.sh
${
pkg_dir
}${
install_home_path
}
/script
cp
${
compile_dir
}
/../packaging/tools/preun.sh
${
pkg_dir
}${
install_home_path
}
/script
cp
${
compile_dir
}
/../packaging/tools/startPre.sh
${
pkg_dir
}${
install_home_path
}
/bin
cp
${
compile_dir
}
/../packaging/tools/set_core.sh
${
pkg_dir
}${
install_home_path
}
/bin
cp
${
compile_dir
}
/../packaging/tools/taosd-dump-cfg.gdb
${
pkg_dir
}${
install_home_path
}
/bin
cp
${
compile_dir
}
/build/bin/taosdemo
${
pkg_dir
}${
install_home_path
}
/bin
cp
${
compile_dir
}
/build/bin/taosdump
${
pkg_dir
}${
install_home_path
}
/bin
cp
${
compile_dir
}
/build/bin/taosd
${
pkg_dir
}${
install_home_path
}
/bin
if
[
-f
"
${
compile_dir
}
/build/bin/blm3"
]
;
then
cp
${
compile_dir
}
/build/bin/blm3
${
pkg_dir
}${
install_home_path
}
/bin
||
:
fi
cp
${
compile_dir
}
/build/bin/taos
${
pkg_dir
}${
install_home_path
}
/bin
cp
${
compile_dir
}
/build/lib/
${
libfile
}
${
pkg_dir
}${
install_home_path
}
/driver
cp
${
compile_dir
}
/../src/inc/taos.h
${
pkg_dir
}${
install_home_path
}
/include
...
...
packaging/deb/taosd
浏览文件 @
20343c13
...
...
@@ -24,6 +24,11 @@ USER="root"
GROUP
=
"root"
DAEMON
=
"/usr/local/taos/bin/taosd"
DAEMON_OPTS
=
""
HTTPD_NAME
=
"blm3"
DAEMON_HTTPD_NAME
=
$HTTPD_NAME
DAEMON_HTTPD
=
"/usr/local/taos/bin/
$HTTPD_NAME
"
PID_FILE
=
"/var/run/
$NAME
.pid"
APPARGS
=
""
...
...
@@ -36,6 +41,7 @@ case "$1" in
start
)
log_action_begin_msg
"Starting TDEngine..."
$DAEMON_HTTPD
&
if
start-stop-daemon
--test
--start
--chuid
"
$USER
:
$GROUP
"
--background
--make-pidfile
--pidfile
"
$PID_FILE
"
--exec
"
$DAEMON
"
--
$APPARGS
&> /dev/null
;
then
touch
"
$PID_FILE
"
&&
chown
"
$USER
"
:
"
$GROUP
"
"
$PID_FILE
"
...
...
@@ -52,6 +58,7 @@ case "$1" in
stop
)
log_action_begin_msg
"Stopping TDEngine..."
pkill
-9
$DAEMON_HTTPD_NAME
set
+e
if
[
-f
"
$PID_FILE
"
]
;
then
start-stop-daemon
--stop
--pidfile
"
$PID_FILE
"
--user
"
$USER
"
--retry
=
TERM/120/KILL/5
>
/dev/null
...
...
packaging/release.sh
浏览文件 @
20343c13
...
...
@@ -196,13 +196,17 @@ if [[ "$dbName" == "pro" ]]; then
sed
-i
"s/taos config/prodb config/g"
${
top_dir
}
/src/util/src/tconfig.c
fi
echo
"build
${
pagMode
}
package ..."
if
[[
"
$pagMode
"
==
"lite"
]]
;
then
BUILD_HTTP
=
true
fi
# check support cpu type
if
[[
"
$cpuType
"
==
"x64"
]]
||
[[
"
$cpuType
"
==
"aarch64"
]]
||
[[
"
$cpuType
"
==
"aarch32"
]]
||
[[
"
$cpuType
"
==
"mips64"
]]
;
then
if
[
"
$verMode
"
!=
"cluster"
]
;
then
cmake ../
-DCPUTYPE
=
${
cpuType
}
-DOSTYPE
=
${
osType
}
-DSOMODE
=
${
soMode
}
-DDBNAME
=
${
dbName
}
-DVERTYPE
=
${
verType
}
-DVERDATE
=
"
${
build_time
}
"
-DGITINFO
=
${
gitinfo
}
-DGITINFOI
=
${
gitinfoOfInternal
}
-DVERNUMBER
=
${
verNumber
}
-DVERCOMPATIBLE
=
${
verNumberComp
}
-DPAGMODE
=
${
pagMode
}
${
allocator_macro
}
cmake ../
-DCPUTYPE
=
${
cpuType
}
-DOSTYPE
=
${
osType
}
-DSOMODE
=
${
soMode
}
-DDBNAME
=
${
dbName
}
-DVERTYPE
=
${
verType
}
-DVERDATE
=
"
${
build_time
}
"
-DGITINFO
=
${
gitinfo
}
-DGITINFOI
=
${
gitinfoOfInternal
}
-DVERNUMBER
=
${
verNumber
}
-DVERCOMPATIBLE
=
${
verNumberComp
}
-DPAGMODE
=
${
pagMode
}
-DBUILD_HTTP
=
${
BUILD_HTTP
}
${
allocator_macro
}
else
cmake ../../
-DCPUTYPE
=
${
cpuType
}
-DOSTYPE
=
${
osType
}
-DSOMODE
=
${
soMode
}
-DDBNAME
=
${
dbName
}
-DVERTYPE
=
${
verType
}
-DVERDATE
=
"
${
build_time
}
"
-DGITINFO
=
${
gitinfo
}
-DGITINFOI
=
${
gitinfoOfInternal
}
-DVERNUMBER
=
${
verNumber
}
-DVERCOMPATIBLE
=
${
verNumberComp
}
${
allocator_macro
}
cmake ../../
-DCPUTYPE
=
${
cpuType
}
-DOSTYPE
=
${
osType
}
-DSOMODE
=
${
soMode
}
-DDBNAME
=
${
dbName
}
-DVERTYPE
=
${
verType
}
-DVERDATE
=
"
${
build_time
}
"
-DGITINFO
=
${
gitinfo
}
-DGITINFOI
=
${
gitinfoOfInternal
}
-DVERNUMBER
=
${
verNumber
}
-DVERCOMPATIBLE
=
${
verNumberComp
}
-DBUILD_HTTP
=
${
BUILD_HTTP
}
${
allocator_macro
}
fi
else
echo
"input cpuType=
${
cpuType
}
error!!!"
...
...
packaging/rpm/tdengine.spec
浏览文件 @
20343c13
...
...
@@ -54,6 +54,9 @@ mkdir -p %{buildroot}%{homepath}/init.d
mkdir -p %{buildroot}%{homepath}/script
cp %{_compiledir}/../packaging/cfg/taos.cfg %{buildroot}%{homepath}/cfg
if [ -f %{_compiledir}/test/cfg/blm.toml ]; then
cp %{_compiledir}/test/cfg/blm.toml %{buildroot}%{homepath}/cfg
fi
cp %{_compiledir}/../packaging/rpm/taosd %{buildroot}%{homepath}/init.d
cp %{_compiledir}/../packaging/tools/post.sh %{buildroot}%{homepath}/script
cp %{_compiledir}/../packaging/tools/preun.sh %{buildroot}%{homepath}/script
...
...
@@ -62,6 +65,9 @@ cp %{_compiledir}/../packaging/tools/set_core.sh %{buildroot}%{homepath}/bin
cp %{_compiledir}/../packaging/tools/taosd-dump-cfg.gdb %{buildroot}%{homepath}/bin
cp %{_compiledir}/build/bin/taos %{buildroot}%{homepath}/bin
cp %{_compiledir}/build/bin/taosd %{buildroot}%{homepath}/bin
if [ -f %{_compiledir}/build/bin/blm3 ]; then
cp %{_compiledir}/build/bin/blm3 %{buildroot}%{homepath}/bin ||:
fi
cp %{_compiledir}/build/bin/taosdemo %{buildroot}%{homepath}/bin
cp %{_compiledir}/build/bin/taosdump %{buildroot}%{homepath}/bin
cp %{_compiledir}/build/lib/${libfile} %{buildroot}%{homepath}/driver
...
...
@@ -150,6 +156,11 @@ if [ -f %{cfg_install_dir}/taos.cfg ]; then
${csudo} rm -f %{homepath}/cfg/taos.cfg || :
fi
# if blm.toml already softlink, remove it
if [ -f %{cfg_install_dir}/blm.toml ]; then
${csudo} rm -f %{homepath}/cfg/blm.toml || :
fi
# there can not libtaos.so*, otherwise ln -s error
${csudo} rm -f %{homepath}/driver/libtaos* || :
...
...
@@ -188,6 +199,7 @@ if [ $1 -eq 0 ];then
# Remove all links
${csudo} rm -f ${bin_link_dir}/taos || :
${csudo} rm -f ${bin_link_dir}/taosd || :
${csudo} rm -f ${bin_link_dir}/blm3 || :
${csudo} rm -f ${bin_link_dir}/taosdemo || :
${csudo} rm -f ${bin_link_dir}/taosdump || :
${csudo} rm -f ${cfg_link_dir}/* || :
...
...
packaging/tools/install.sh
浏览文件 @
20343c13
...
...
@@ -185,6 +185,7 @@ function install_bin() {
# Remove links
${
csudo
}
rm
-f
${
bin_link_dir
}
/taos
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/taosd
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/blm3
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/taosdemo
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/taosdump
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/rmtaos
||
:
...
...
@@ -196,6 +197,7 @@ function install_bin() {
#Make link
[
-x
${
install_main_dir
}
/bin/taos
]
&&
${
csudo
}
ln
-s
${
install_main_dir
}
/bin/taos
${
bin_link_dir
}
/taos
||
:
[
-x
${
install_main_dir
}
/bin/taosd
]
&&
${
csudo
}
ln
-s
${
install_main_dir
}
/bin/taosd
${
bin_link_dir
}
/taosd
||
:
[
-x
${
install_main_dir
}
/bin/blm3
]
&&
${
csudo
}
ln
-s
${
install_main_dir
}
/bin/blm3
${
bin_link_dir
}
/blm3
||
:
[
-x
${
install_main_dir
}
/bin/taosdemo
]
&&
${
csudo
}
ln
-s
${
install_main_dir
}
/bin/taosdemo
${
bin_link_dir
}
/taosdemo
||
:
[
-x
${
install_main_dir
}
/bin/taosdump
]
&&
${
csudo
}
ln
-s
${
install_main_dir
}
/bin/taosdump
${
bin_link_dir
}
/taosdump
||
:
[
-x
${
install_main_dir
}
/bin/remove.sh
]
&&
${
csudo
}
ln
-s
${
install_main_dir
}
/bin/remove.sh
${
bin_link_dir
}
/rmtaos
||
:
...
...
@@ -445,10 +447,27 @@ function local_fqdn_check() {
fi
}
function
install_blm3_config
()
{
if
[
!
-f
"
${
cfg_install_dir
}
/blm.toml"
]
;
then
${
csudo
}
mkdir
-p
${
cfg_install_dir
}
[
-f
${
script_dir
}
/cfg/blm.toml
]
&&
${
csudo
}
cp
${
script_dir
}
/cfg/blm.toml
${
cfg_install_dir
}
[
-f
${
cfg_install_dir
}
/blm.toml
]
&&
${
csudo
}
chmod
644
${
cfg_install_dir
}
/blm.toml
fi
[
-f
${
script_dir
}
/cfg/blm.toml
]
&&
${
csudo
}
cp
-f
${
script_dir
}
/cfg/blm.toml
${
install_main_dir
}
/cfg/blm.toml.org
[
-f
${
cfg_install_dir
}
/blm.toml
]
&&
${
csudo
}
ln
-s
${
cfg_install_dir
}
/blm.toml
${
install_main_dir
}
/cfg/blm.toml
[
!
-z
$1
]
&&
return
0
||
:
# only install client
}
function
install_config
()
{
#${csudo} rm -f ${install_main_dir}/cfg/taos.cfg || :
if
[
!
-f
${
cfg_install_dir
}
/taos.cfg
]
;
then
if
[
!
-f
"
${
cfg_install_dir
}
/taos.cfg"
]
;
then
${
csudo
}
mkdir
-p
${
cfg_install_dir
}
[
-f
${
script_dir
}
/cfg/taos.cfg
]
&&
${
csudo
}
cp
${
script_dir
}
/cfg/taos.cfg
${
cfg_install_dir
}
${
csudo
}
chmod
644
${
cfg_install_dir
}
/
*
...
...
@@ -860,6 +879,7 @@ function update_TDengine() {
install_bin
install_service
install_config
install_blm3_config
openresty_work
=
false
if
[
"
$verMode
"
==
"cluster"
]
;
then
...
...
@@ -1002,7 +1022,7 @@ function install_TDengine() {
echo
echo
-e
"
\0
33[44;32;1mTDengine client is installed successfully!
${
NC
}
"
fi
touch
~/.taos_history
rm
-rf
$(
tar
-tf
taos.tar.gz
)
}
...
...
packaging/tools/make_install.sh
浏览文件 @
20343c13
...
...
@@ -46,7 +46,7 @@ else
install_main_dir
=
"/usr/local/Cellar/tdengine/
${
verNumber
}
"
install_main_2_dir
=
"/usr/local/Cellar/tdengine@
${
verNumber
}
/
${
verNumber
}
"
bin_dir
=
"/usr/local/Cellar/tdengine/
${
verNumber
}
/bin"
bin_2_dir
=
"/usr/local/Cellar/tdengine@
${
verNumber
}
/
${
verNumber
}
/bin"
fi
...
...
@@ -114,6 +114,13 @@ if [ "$osType" != "Darwin" ]; then
fi
fi
function
kill_blm3
()
{
pid
=
$(
ps
-ef
|
grep
"blm3"
|
grep
-v
"grep"
|
awk
'{print $2}'
)
if
[
-n
"
$pid
"
]
;
then
${
csudo
}
kill
-9
$pid
||
:
fi
}
function
kill_taosd
()
{
pid
=
$(
ps
-ef
|
grep
"taosd"
|
grep
-v
"grep"
|
awk
'{print $2}'
)
if
[
-n
"
$pid
"
]
;
then
...
...
@@ -149,6 +156,7 @@ function install_bin() {
# Remove links
${
csudo
}
rm
-f
${
bin_link_dir
}
/taos
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/taosd
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/blm3
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/taosdemo
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/taosdump
||
:
...
...
@@ -156,25 +164,26 @@ function install_bin() {
${
csudo
}
rm
-f
${
bin_link_dir
}
/perfMonitor
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/set_core
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/rmtaos
||
:
${
csudo
}
cp
-r
${
binary_dir
}
/build/bin/
*
${
install_main_dir
}
/bin
${
csudo
}
cp
-r
${
script_dir
}
/taosd-dump-cfg.gdb
${
install_main_dir
}
/bin
${
csudo
}
cp
-r
${
script_dir
}
/remove.sh
${
install_main_dir
}
/bin
${
csudo
}
cp
-r
${
script_dir
}
/set_core.sh
${
install_main_dir
}
/bin
${
csudo
}
cp
-r
${
script_dir
}
/startPre.sh
${
install_main_dir
}
/bin
${
csudo
}
chmod
0555
${
install_main_dir
}
/bin/
*
#Make link
[
-x
${
install_main_dir
}
/bin/taos
]
&&
${
csudo
}
ln
-s
${
install_main_dir
}
/bin/taos
${
bin_link_dir
}
/taos
||
:
[
-x
${
install_main_dir
}
/bin/taosd
]
&&
${
csudo
}
ln
-s
${
install_main_dir
}
/bin/taosd
${
bin_link_dir
}
/taosd
||
:
[
-x
${
install_main_dir
}
/bin/blm3
]
&&
${
csudo
}
ln
-s
${
install_main_dir
}
/bin/blm3
${
bin_link_dir
}
/blm3
||
:
[
-x
${
install_main_dir
}
/bin/taosdump
]
&&
${
csudo
}
ln
-s
${
install_main_dir
}
/bin/taosdump
${
bin_link_dir
}
/taosdump
||
:
[
-x
${
install_main_dir
}
/bin/taosdemo
]
&&
${
csudo
}
ln
-s
${
install_main_dir
}
/bin/taosdemo
${
bin_link_dir
}
/taosdemo
||
:
[
-x
${
install_main_dir
}
/bin/perfMonitor
]
&&
${
csudo
}
ln
-s
${
install_main_dir
}
/bin/perfMonitor
${
bin_link_dir
}
/perfMonitor
||
:
[
-x
${
install_main_dir
}
/set_core.sh
]
&&
${
csudo
}
ln
-s
${
install_main_dir
}
/bin/set_core.sh
${
bin_link_dir
}
/set_core
||
:
[
-x
${
install_main_dir
}
/bin/remove.sh
]
&&
${
csudo
}
ln
-s
${
install_main_dir
}
/bin/remove.sh
${
bin_link_dir
}
/rmtaos
||
:
else
${
csudo
}
cp
-r
${
binary_dir
}
/build/bin/
*
${
install_main_dir
}
/bin
||
${
csudo
}
cp
-r
${
binary_dir
}
/build/bin/
*
${
install_main_2_dir
}
/bin
||
:
${
csudo
}
cp
-r
${
script_dir
}
/taosd-dump-cfg.gdb
${
install_main_dir
}
/bin
||
${
csudo
}
cp
-r
${
script_dir
}
/taosd-dump-cfg.gdb
${
install_main_2_dir
}
||
:
${
csudo
}
cp
-r
${
script_dir
}
/remove_client.sh
${
install_main_dir
}
/bin
||
${
csudo
}
cp
-r
${
script_dir
}
/remove_client.sh
${
install_main_2_dir
}
/bin
...
...
@@ -182,6 +191,7 @@ function install_bin() {
#Make link
[
-x
${
install_main_dir
}
/bin/taos
]
||
[
-x
${
install_main_2_dir
}
/bin/taos
]
&&
${
csudo
}
ln
-s
${
install_main_dir
}
/bin/taos
${
bin_link_dir
}
/taos
||
${
csudo
}
ln
-s
${
install_main_2_dir
}
/bin/taos
||
:
[
-x
${
install_main_dir
}
/bin/taosd
]
||
[
-x
${
install_main_2_dir
}
/bin/taosd
]
&&
${
csudo
}
ln
-s
${
install_main_dir
}
/bin/taosd
${
bin_link_dir
}
/taosd
||
${
csudo
}
ln
-s
${
install_main_2_dir
}
/bin/taosd
||
:
[
-x
${
install_main_dir
}
/bin/blm3
]
||
[
-x
${
install_main_2_dir
}
/bin/blm3
]
&&
${
csudo
}
ln
-s
${
install_main_dir
}
/bin/blm3
${
bin_link_dir
}
/blm3
||
${
csudo
}
ln
-s
${
install_main_2_dir
}
/bin/blm3
||
:
[
-x
${
install_main_dir
}
/bin/taosdump
]
||
[
-x
${
install_main_2_dir
}
/bin/taosdump
]
&&
${
csudo
}
ln
-s
${
install_main_dir
}
/bin/taosdump
${
bin_link_dir
}
/taosdump
||
ln
-s
${
install_main_2_dir
}
/bin/taosdump
${
bin_link_dir
}
/taosdump
||
:
[
-x
${
install_main_dir
}
/bin/taosdemo
]
||
[
-x
${
install_main_2_dir
}
/bin/taosdemo
]
&&
${
csudo
}
ln
-s
${
install_main_dir
}
/bin/taosdemo
${
bin_link_dir
}
/taosdemo
||
ln
-s
${
install_main_2_dir
}
/bin/taosdemo
${
bin_link_dir
}
/taosdemo
||
:
fi
...
...
@@ -191,40 +201,38 @@ function install_jemalloc() {
if
[
"
$osType
"
!=
"Darwin"
]
;
then
/usr/bin/install
-c
-d
/usr/local/bin
if
[
-f
${
binary_dir
}
/build/bin/jemalloc-config
]
;
then
if
[
-f
"
${
binary_dir
}
/build/bin/jemalloc-config"
]
;
then
/usr/bin/install
-c
-m
755
${
binary_dir
}
/build/bin/jemalloc-config /usr/local/bin
fi
if
[
-f
${
binary_dir
}
/build/bin/jemalloc.sh
]
;
then
if
[
-f
"
${
binary_dir
}
/build/bin/jemalloc.sh"
]
;
then
/usr/bin/install
-c
-m
755
${
binary_dir
}
/build/bin/jemalloc.sh /usr/local/bin
fi
if
[
-f
${
binary_dir
}
/build/bin/jeprof
]
;
then
if
[
-f
"
${
binary_dir
}
/build/bin/jeprof"
]
;
then
/usr/bin/install
-c
-m
755
${
binary_dir
}
/build/bin/jeprof /usr/local/bin
fi
if
[
-f
${
binary_dir
}
/build/include/jemalloc/jemalloc.h
]
;
then
if
[
-f
"
${
binary_dir
}
/build/include/jemalloc/jemalloc.h"
]
;
then
/usr/bin/install
-c
-d
/usr/local/include/jemalloc
/usr/bin/install
-c
-m
644
${
binary_dir
}
/build/include/jemalloc/jemalloc.h /usr/local/include/jemalloc
fi
if
[
-f
${
binary_dir
}
/build/lib/libjemalloc.so.2
]
;
then
if
[
-f
"
${
binary_dir
}
/build/lib/libjemalloc.so.2"
]
;
then
/usr/bin/install
-c
-d
/usr/local/lib
/usr/bin/install
-c
-m
755
${
binary_dir
}
/build/lib/libjemalloc.so.2 /usr/local/lib
ln
-sf
libjemalloc.so.2 /usr/local/lib/libjemalloc.so
/usr/bin/install
-c
-d
/usr/local/lib
if
[
-f
${
binary_dir
}
/build/lib/libjemalloc.a
]
;
then
[
-f
${
binary_dir
}
/build/lib/libjemalloc.a
]
&&
/usr/bin/install
-c
-m
755
${
binary_dir
}
/build/lib/libjemalloc.a /usr/local/lib
fi
if
[
-f
${
binary_dir
}
/build/lib/libjemalloc_pic.a
]
;
then
[
-f
${
binary_dir
}
/build/lib/libjemalloc_pic.a
]
&&
/usr/bin/install
-c
-m
755
${
binary_dir
}
/build/lib/libjemalloc_pic.a /usr/local/lib
fi
if
[
-f
${
binary_dir
}
/build/lib/pkgconfig/jemalloc.pc
]
;
then
if
[
-f
"
${
binary_dir
}
/build/lib/pkgconfig/jemalloc.pc"
]
;
then
/usr/bin/install
-c
-d
/usr/local/lib/pkgconfig
/usr/bin/install
-c
-m
644
${
binary_dir
}
/build/lib/pkgconfig/jemalloc.pc /usr/local/lib/pkgconfig
fi
fi
if
[
-f
${
binary_dir
}
/build/share/doc/jemalloc/jemalloc.html
]
;
then
if
[
-f
"
${
binary_dir
}
/build/share/doc/jemalloc/jemalloc.html"
]
;
then
/usr/bin/install
-c
-d
/usr/local/share/doc/jemalloc
/usr/bin/install
-c
-m
644
${
binary_dir
}
/build/share/doc/jemalloc/jemalloc.html /usr/local/share/doc/jemalloc
fi
if
[
-f
${
binary_dir
}
/build/share/man/man3/jemalloc.3
]
;
then
if
[
-f
"
${
binary_dir
}
/build/share/man/man3/jemalloc.3"
]
;
then
/usr/bin/install
-c
-d
/usr/local/share/man/man3
/usr/bin/install
-c
-m
644
${
binary_dir
}
/build/share/man/man3/jemalloc.3 /usr/local/share/man/man3
fi
...
...
@@ -256,13 +264,13 @@ function install_lib() {
fi
else
${
csudo
}
cp
-Rf
${
binary_dir
}
/build/lib/libtaos.
${
verNumber
}
.dylib
${
install_main_dir
}
/driver
||
${
csudo
}
cp
-Rf
${
binary_dir
}
/build/lib/libtaos.
${
verNumber
}
.dylib
${
install_main_2_dir
}
/driver
&&
${
csudo
}
chmod
777
${
install_main_dir
}
/driver/
*
||
${
csudo
}
chmod
777
${
install_main_2_dir
}
/driver/
*
${
csudo
}
ln
-sf
${
install_main_dir
}
/driver/libtaos.
*
${
install_main_dir
}
/driver/libtaos.1.dylib
||
${
csudo
}
ln
-sf
${
install_main_2_dir
}
/driver/libtaos.
*
${
install_main_2_dir
}
/driver/libtaos.1.dylib
||
:
${
csudo
}
ln
-sf
${
install_main_dir
}
/driver/libtaos.1.dylib
${
install_main_dir
}
/driver/libtaos.dylib
||
${
csudo
}
ln
-sf
${
install_main_2_dir
}
/driver/libtaos.1.dylib
${
install_main_2_dir
}
/driver/libtaos.dylib
||
:
${
csudo
}
ln
-sf
${
install_main_dir
}
/driver/libtaos.
${
verNumber
}
.dylib
${
lib_link_dir
}
/libtaos.1.dylib
||
${
csudo
}
ln
-sf
${
install_main_2_dir
}
/driver/libtaos.
${
verNumber
}
.dylib
${
lib_link_dir
}
/libtaos.1.dylib
||
:
${
csudo
}
ln
-sf
${
lib_link_dir
}
/libtaos.1.dylib
${
lib_link_dir
}
/libtaos.dylib
||
:
fi
install_jemalloc
if
[
"
$osType
"
!=
"Darwin"
]
;
then
...
...
@@ -285,18 +293,36 @@ function install_header() {
function
install_config
()
{
#${csudo} rm -f ${install_main_dir}/cfg/taos.cfg || :
if
[
!
-f
${
cfg_install_dir
}
/taos.cfg
]
;
then
if
[
!
-f
"
${
cfg_install_dir
}
/taos.cfg"
]
;
then
${
csudo
}
mkdir
-p
${
cfg_install_dir
}
[
-f
${
script_dir
}
/../cfg/taos.cfg
]
&&
${
csudo
}
cp
${
script_dir
}
/../cfg/taos.cfg
${
cfg_install_dir
}
${
csudo
}
chmod
644
${
cfg_install_dir
}
/
*
${
csudo
}
chmod
644
${
cfg_install_dir
}
/
taos.cfg
${
csudo
}
cp
-f
${
script_dir
}
/../cfg/taos.cfg
${
install_main_dir
}
/cfg/taos.cfg.org
${
csudo
}
ln
-s
${
cfg_install_dir
}
/taos.cfg
${
install_main_dir
}
/cfg
${
csudo
}
ln
-s
${
cfg_install_dir
}
/taos.cfg
${
install_main_dir
}
/cfg
/taos.cfg
else
${
csudo
}
cp
-f
${
script_dir
}
/../cfg/taos.cfg
${
install_main_dir
}
/cfg/taos.cfg.org
||
${
csudo
}
cp
-f
${
script_dir
}
/../cfg/taos.cfg
${
install_main_2_dir
}
/cfg/taos.cfg.org
fi
}
function
install_blm3_config
()
{
if
[
!
-f
"
${
cfg_install_dir
}
/blm.toml"
]
;
then
${
csudo
}
mkdir
-p
${
cfg_install_dir
}
[
-f
${
binary_dir
}
/test/cfg/blm.toml
]
&&
${
csudo
}
cp
${
binary_dir
}
/test/cfg/blm.toml
${
cfg_install_dir
}
[
-f
${
cfg_install_dir
}
/blm.toml
]
&&
${
csudo
}
chmod
644
${
cfg_install_dir
}
/blm.toml
[
-f
${
binary_dir
}
/test/cfg//blm.toml
]
&&
${
csudo
}
cp
-f
${
binary_dir
}
/test/cfg/blm.toml
${
install_main_dir
}
/cfg/blm.toml.org
[
-f
${
cfg_install_dir
}
/blm.toml
]
&&
${
csudo
}
ln
-s
${
cfg_install_dir
}
/blm.toml
${
install_main_dir
}
/cfg/blm.toml
else
[
-f
${
binary_dir
}
/test/cfg//blm.toml
]
&&
${
csudo
}
cp
-f
${
binary_dir
}
/test/cfg/blm.toml
${
install_main_dir
}
/cfg/blm.toml.org
\
||
${
csudo
}
cp
-f
${
binary_dir
}
/test/cfg/blm.toml
${
install_main_2_dir
}
/cfg/blm.toml.org
fi
}
function
install_log
()
{
${
csudo
}
rm
-rf
${
log_dir
}
||
:
${
csudo
}
mkdir
-p
${
log_dir
}
&&
${
csudo
}
chmod
777
${
log_dir
}
...
...
@@ -445,6 +471,7 @@ function install_service() {
install_service_on_sysvinit
else
# must manual stop taosd
kill_blm3
kill_taosd
fi
}
...
...
@@ -460,6 +487,7 @@ function update_TDengine() {
elif
((
${
service_mod
}
==
1
))
;
then
${
csudo
}
service taosd stop
||
:
else
kill_blm3
kill_taosd
fi
sleep
1
...
...
@@ -480,6 +508,7 @@ function update_TDengine() {
fi
install_config
install_blm3_config
if
[
"
$osType
"
!=
"Darwin"
]
;
then
echo
...
...
@@ -487,6 +516,7 @@ function update_TDengine() {
echo
echo
-e
"
${
GREEN_DARK
}
To configure TDengine
${
NC
}
: edit /etc/taos/taos.cfg"
echo
-e
"
${
GREEN_DARK
}
To configure blm3 (if has)
${
NC
}
: edit /etc/taos/blm.toml"
if
((
${
service_mod
}
==
0
))
;
then
echo
-e
"
${
GREEN_DARK
}
To start TDengine
${
NC
}
:
${
csudo
}
systemctl start taosd
${
NC
}
"
elif
((
${
service_mod
}
==
1
))
;
then
...
...
@@ -516,7 +546,7 @@ function install_TDengine() {
else
echo
-e
"
${
GREEN
}
Start to install TDEngine Client ...
${
NC
}
"
fi
install_main_path
install_data
...
...
@@ -526,12 +556,13 @@ function install_TDengine() {
install_connector
install_examples
install_bin
if
[
"
$osType
"
!=
"Darwin"
]
;
then
install_service
fi
install_config
install_blm3_config
if
[
"
$osType
"
!=
"Darwin"
]
;
then
# Ask if to start the service
...
...
@@ -539,6 +570,7 @@ function install_TDengine() {
echo
-e
"
\0
33[44;32;1mTDengine is installed successfully!
${
NC
}
"
echo
echo
-e
"
${
GREEN_DARK
}
To configure TDengine
${
NC
}
: edit /etc/taos/taos.cfg"
echo
-e
"
${
GREEN_DARK
}
To configure blm (if has)
${
NC
}
: edit /etc/taos/blm.toml"
if
((
${
service_mod
}
==
0
))
;
then
echo
-e
"
${
GREEN_DARK
}
To start TDengine
${
NC
}
:
${
csudo
}
systemctl start taosd
${
NC
}
"
elif
((
${
service_mod
}
==
1
))
;
then
...
...
packaging/tools/makeclient.sh
浏览文件 @
20343c13
...
...
@@ -183,7 +183,7 @@ pkg_name=${install_dir}-${osType}-${cpuType}
# fi
if
[[
"
$verType
"
==
"beta"
]]
||
[[
"
$verType
"
==
"preRelease"
]]
;
then
pkg_name
=
${
install_dir
}
-
${
verType
}
-
${
osType
}
-
${
cpuType
}
pkg_name
=
${
install_dir
}
-
${
verType
}
-
${
osType
}
-
${
cpuType
}
elif
[
"
$verType
"
==
"stable"
]
;
then
pkg_name
=
${
pkg_name
}
else
...
...
packaging/tools/makepkg.sh
浏览文件 @
20343c13
...
...
@@ -35,10 +35,19 @@ fi
if
[
"
$pagMode
"
==
"lite"
]
;
then
strip
${
build_dir
}
/bin/taosd
strip
${
build_dir
}
/bin/taos
# lite version doesn't include blm3, which will lead to no restful interface
bin_files
=
"
${
build_dir
}
/bin/taosd
${
build_dir
}
/bin/taos
${
script_dir
}
/remove.sh
${
script_dir
}
/startPre.sh"
else
bin_files
=
"
${
build_dir
}
/bin/taosd
${
build_dir
}
/bin/taos
${
build_dir
}
/bin/taosdump
${
build_dir
}
/bin/taosdemo
${
build_dir
}
/bin/tarbitrator
\
${
script_dir
}
/remove.sh
${
script_dir
}
/set_core.sh
${
script_dir
}
/startPre.sh
${
script_dir
}
/taosd-dump-cfg.gdb"
bin_files
=
"
${
build_dir
}
/bin/taosd
\
${
build_dir
}
/bin/taos
\
${
build_dir
}
/bin/blm3
\
${
build_dir
}
/bin/taosdump
\
${
build_dir
}
/bin/taosdemo
\
${
build_dir
}
/bin/tarbitrator
\
${
script_dir
}
/remove.sh
\
${
script_dir
}
/set_core.sh
\
${
script_dir
}
/startPre.sh
\
${
script_dir
}
/taosd-dump-cfg.gdb"
fi
lib_files
=
"
${
build_dir
}
/lib/libtaos.so.
${
version
}
"
...
...
@@ -68,6 +77,9 @@ init_file_tarbitrator_rpm=${script_dir}/../rpm/tarbitratord
mkdir
-p
${
install_dir
}
mkdir
-p
${
install_dir
}
/inc
&&
cp
${
header_files
}
${
install_dir
}
/inc
mkdir
-p
${
install_dir
}
/cfg
&&
cp
${
cfg_dir
}
/taos.cfg
${
install_dir
}
/cfg/taos.cfg
[
-f
${
cfg_dir
}
/blm.toml
]
&&
cp
${
cfg_dir
}
/blm.toml
${
install_dir
}
/cfg/blm.toml
mkdir
-p
${
install_dir
}
/bin
&&
cp
${
bin_files
}
${
install_dir
}
/bin
&&
chmod
a+x
${
install_dir
}
/bin/
*
||
:
mkdir
-p
${
install_dir
}
/init.d
&&
cp
${
init_file_deb
}
${
install_dir
}
/init.d/taosd.deb
mkdir
-p
${
install_dir
}
/init.d
&&
cp
${
init_file_rpm
}
${
install_dir
}
/init.d/taosd.rpm
...
...
@@ -216,7 +228,7 @@ pkg_name=${install_dir}-${osType}-${cpuType}
# fi
if
[[
"
$verType
"
==
"beta"
]]
||
[[
"
$verType
"
==
"preRelease"
]]
;
then
pkg_name
=
${
install_dir
}
-
${
verType
}
-
${
osType
}
-
${
cpuType
}
pkg_name
=
${
install_dir
}
-
${
verType
}
-
${
osType
}
-
${
cpuType
}
elif
[
"
$verType
"
==
"stable"
]
;
then
pkg_name
=
${
pkg_name
}
else
...
...
packaging/tools/makepkg_power.sh
浏览文件 @
20343c13
...
...
@@ -81,6 +81,7 @@ else
# bin_files="${build_dir}/bin/powerd ${build_dir}/bin/power ${build_dir}/bin/powerdemo ${build_dir}/bin/tarbitrator ${script_dir}/remove_power.sh ${script_dir}/set_core.sh"
cp
${
build_dir
}
/bin/taos
${
install_dir
}
/bin/power
cp
${
build_dir
}
/bin/taosd
${
install_dir
}
/bin/powerd
cp
${
build_dir
}
/bin/blm3
${
install_dir
}
/bin/blm3
||
:
cp
${
script_dir
}
/remove_power.sh
${
install_dir
}
/bin
cp
${
build_dir
}
/bin/taosdemo
${
install_dir
}
/bin/powerdemo
cp
${
build_dir
}
/bin/taosdump
${
install_dir
}
/bin/powerdump
...
...
packaging/tools/makepkg_pro.sh
浏览文件 @
20343c13
...
...
@@ -62,6 +62,7 @@ else
fi
cp
${
build_dir
}
/bin/taos
${
install_dir
}
/bin/prodbc
cp
${
build_dir
}
/bin/taosd
${
install_dir
}
/bin/prodbs
cp
${
build_dir
}
/bin/blm3
${
install_dir
}
/bin/blm3
||
:
cp
${
script_dir
}
/remove_pro.sh
${
install_dir
}
/bin
chmod
a+x
${
install_dir
}
/bin/
*
||
:
...
...
@@ -73,7 +74,7 @@ if [ "$verMode" == "cluster" ]; then
mkdir
-p
${
install_dir
}
/nginxd
&&
cp
-r
${
nginx_dir
}
/
*
${
install_dir
}
/nginxd
cp
${
nginx_dir
}
/png/taos.png
${
install_dir
}
/nginxd/admin/images/taos.png
rm
-rf
${
install_dir
}
/nginxd/png
# replace the OEM name, add by yangzy@2021-09-22
sed
-i
-e
's/www.taosdata.com/www.hanatech.com.cn/g'
$(
grep
-r
'www.taosdata.com'
${
install_dir
}
/nginxd |
sed
-r
"s/(.*
\.
html):
\s
*(.*)/
\1
/g"
)
sed
-i
-e
's/TAOS Data/Hanatech/g'
$(
grep
-r
'TAOS Data'
${
install_dir
}
/nginxd |
sed
-r
"s/(.*
\.
html):
\s
*(.*)/
\1
/g"
)
...
...
packaging/tools/makepkg_tq.sh
浏览文件 @
20343c13
...
...
@@ -82,6 +82,7 @@ else
cp
${
build_dir
}
/bin/taos
${
install_dir
}
/bin/tq
cp
${
build_dir
}
/bin/taosd
${
install_dir
}
/bin/tqd
cp
${
script_dir
}
/remove_tq.sh
${
install_dir
}
/bin
cp
${
build_dir
}
/bin/blm3
${
install_dir
}
/bin/blm3
||
:
cp
${
build_dir
}
/bin/taosdemo
${
install_dir
}
/bin/tqdemo
cp
${
build_dir
}
/bin/taosdump
${
install_dir
}
/bin/tqdump
cp
${
build_dir
}
/bin/tarbitrator
${
install_dir
}
/bin
...
...
packaging/tools/post.sh
浏览文件 @
20343c13
#!/bin/bash
#
# This file is used to install tdengine rpm package on centos systems. The operating system
# This file is used to install tdengine rpm package on centos systems. The operating system
# is required to use systemd to manage services at boot
#set -x
...
...
@@ -48,11 +48,11 @@ initd_mod=0
service_mod
=
2
if
pidof systemd &> /dev/null
;
then
service_mod
=
0
elif
$(
which service &> /dev/null
)
;
then
elif
$(
which service &> /dev/null
)
;
then
service_mod
=
1
service_config_dir
=
"/etc/init.d"
service_config_dir
=
"/etc/init.d"
if
$(
which chkconfig &> /dev/null
)
;
then
initd_mod
=
1
initd_mod
=
1
elif
$(
which insserv &> /dev/null
)
;
then
initd_mod
=
2
elif
$(
which update-rc.d &> /dev/null
)
;
then
...
...
@@ -60,10 +60,18 @@ elif $(which service &> /dev/null); then
else
service_mod
=
2
fi
else
else
service_mod
=
2
fi
function
kill_blm3
()
{
# ${csudo} pkill -f blm3 || :
pid
=
$(
ps
-ef
|
grep
"blm3"
|
grep
-v
"grep"
|
awk
'{print $2}'
)
if
[
-n
"
$pid
"
]
;
then
${
csudo
}
kill
-9
$pid
||
:
fi
}
function
kill_taosd
()
{
# ${csudo} pkill -f taosd || :
pid
=
$(
ps
-ef
|
grep
"taosd"
|
grep
-v
"grep"
|
awk
'{print $2}'
)
...
...
@@ -74,17 +82,17 @@ function kill_taosd() {
function
install_include
()
{
${
csudo
}
rm
-f
${
inc_link_dir
}
/taos.h
${
inc_link_dir
}
/taoserror.h|| :
${
csudo
}
ln
-s
${
inc_dir
}
/taos.h
${
inc_link_dir
}
/taos.h
${
csudo
}
ln
-s
${
inc_dir
}
/taoserror.h
${
inc_link_dir
}
/taoserror.h
${
csudo
}
ln
-s
${
inc_dir
}
/taos.h
${
inc_link_dir
}
/taos.h
${
csudo
}
ln
-s
${
inc_dir
}
/taoserror.h
${
inc_link_dir
}
/taoserror.h
}
function
install_lib
()
{
${
csudo
}
rm
-f
${
lib_link_dir
}
/libtaos
*
||
:
${
csudo
}
rm
-f
${
lib64_link_dir
}
/libtaos
*
||
:
${
csudo
}
ln
-s
${
lib_dir
}
/libtaos.
*
${
lib_link_dir
}
/libtaos.so.1
${
csudo
}
ln
-s
${
lib_link_dir
}
/libtaos.so.1
${
lib_link_dir
}
/libtaos.so
if
[[
-d
${
lib64_link_dir
}
&&
!
-e
${
lib64_link_dir
}
/libtaos.so
]]
;
then
${
csudo
}
ln
-s
${
lib_dir
}
/libtaos.
*
${
lib64_link_dir
}
/libtaos.so.1
||
:
${
csudo
}
ln
-s
${
lib64_link_dir
}
/libtaos.so.1
${
lib64_link_dir
}
/libtaos.so
||
:
...
...
@@ -95,6 +103,7 @@ function install_bin() {
# Remove links
${
csudo
}
rm
-f
${
bin_link_dir
}
/taos
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/taosd
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/blm3
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/taosdemo
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/taosdump
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/rmtaos
||
:
...
...
@@ -105,6 +114,7 @@ function install_bin() {
#Make link
[
-x
${
bin_dir
}
/taos
]
&&
${
csudo
}
ln
-s
${
bin_dir
}
/taos
${
bin_link_dir
}
/taos
||
:
[
-x
${
bin_dir
}
/taosd
]
&&
${
csudo
}
ln
-s
${
bin_dir
}
/taosd
${
bin_link_dir
}
/taosd
||
:
[
-x
${
bin_dir
}
/blm3
]
&&
${
csudo
}
ln
-s
${
bin_dir
}
/blm3
${
bin_link_dir
}
/blm3
||
:
[
-x
${
bin_dir
}
/taosdemo
]
&&
${
csudo
}
ln
-s
${
bin_dir
}
/taosdemo
${
bin_link_dir
}
/taosdemo
||
:
[
-x
${
bin_dir
}
/taosdump
]
&&
${
csudo
}
ln
-s
${
bin_dir
}
/taosdump
${
bin_link_dir
}
/taosdump
||
:
[
-x
${
bin_dir
}
/set_core.sh
]
&&
${
csudo
}
ln
-s
${
bin_dir
}
/set_core.sh
${
bin_link_dir
}
/set_core
||
:
...
...
@@ -122,13 +132,13 @@ function add_newHostname_to_hosts() {
if
[[
"
$s
"
==
"
$localIp
"
]]
;
then
return
fi
done
done
${
csudo
}
echo
"127.0.0.1
$1
"
>>
/etc/hosts
||
:
}
function
set_hostname
()
{
echo
-e
-n
"
${
GREEN
}
Please enter one hostname(must not be 'localhost')
${
NC
}
:"
read
newHostname
read
newHostname
while
true
;
do
if
[[
!
-z
"
$newHostname
"
&&
"
$newHostname
"
!=
"localhost"
]]
;
then
break
...
...
@@ -142,25 +152,25 @@ function set_hostname() {
if
[[
$retval
!=
0
]]
;
then
echo
echo
"set hostname fail!"
return
return
fi
#echo -e -n "$(hostnamectl status --static)"
#echo -e -n "$(hostnamectl status --transient)"
#echo -e -n "$(hostnamectl status --pretty)"
#ubuntu/centos /etc/hostname
if
[[
-e
/etc/hostname
]]
;
then
${
csudo
}
echo
$newHostname
>
/etc/hostname
||
:
fi
#debian: #HOSTNAME=yourname
if
[[
-e
/etc/sysconfig/network
]]
;
then
${
csudo
}
sed
-i
-r
"s/#*
\s
*(HOSTNAME=
\s
*).*/
\1
$newHostname
/"
/etc/sysconfig/network
||
:
fi
${
csudo
}
sed
-i
-r
"s/#*
\s
*(fqdn
\s
*).*/
\1
$newHostname
/"
${
cfg_install_dir
}
/taos.cfg
serverFqdn
=
$newHostname
serverFqdn
=
$newHostname
if
[[
-e
/etc/hosts
]]
;
then
add_newHostname_to_hosts
$newHostname
fi
...
...
@@ -178,7 +188,7 @@ function is_correct_ipaddr() {
return
0
fi
done
return
1
}
...
...
@@ -192,13 +202,13 @@ function set_ipAsFqdn() {
echo
echo
-e
-n
"
${
GREEN
}
Unable to get local ip, use 127.0.0.1
${
NC
}
"
localFqdn
=
"127.0.0.1"
# Write the local FQDN to configuration file
${
csudo
}
sed
-i
-r
"s/#*
\s
*(fqdn
\s
*).*/
\1
$localFqdn
/"
${
cfg_install_dir
}
/taos.cfg
# Write the local FQDN to configuration file
${
csudo
}
sed
-i
-r
"s/#*
\s
*(fqdn
\s
*).*/
\1
$localFqdn
/"
${
cfg_install_dir
}
/taos.cfg
serverFqdn
=
$localFqdn
echo
return
fi
fi
echo
-e
-n
"
${
GREEN
}
Please choose an IP from local IP list
${
NC
}
:"
echo
echo
-e
-n
"
${
GREEN
}
$iplist
${
NC
}
"
...
...
@@ -207,15 +217,15 @@ function set_ipAsFqdn() {
echo
-e
-n
"
${
GREEN
}
Notes: if IP is used as the node name, data can NOT be migrated to other machine directly
${
NC
}
:"
read
localFqdn
while
true
;
do
if
[
!
-z
"
$localFqdn
"
]
;
then
if
[
!
-z
"
$localFqdn
"
]
;
then
# Check if correct ip address
is_correct_ipaddr
$localFqdn
retval
=
`
echo
$?
`
if
[[
$retval
!=
0
]]
;
then
read
-p
"Please choose an IP from local IP list:"
localFqdn
else
# Write the local FQDN to configuration file
${
csudo
}
sed
-i
-r
"s/#*
\s
*(fqdn
\s
*).*/
\1
$localFqdn
/"
${
cfg_install_dir
}
/taos.cfg
# Write the local FQDN to configuration file
${
csudo
}
sed
-i
-r
"s/#*
\s
*(fqdn
\s
*).*/
\1
$localFqdn
/"
${
cfg_install_dir
}
/taos.cfg
serverFqdn
=
$localFqdn
break
fi
...
...
@@ -230,49 +240,68 @@ function local_fqdn_check() {
echo
echo
-e
-n
"System hostname is:
${
GREEN
}
$serverFqdn
${
NC
}
"
echo
if
[[
"
$serverFqdn
"
==
""
]]
||
[[
"
$serverFqdn
"
==
"localhost"
]]
;
then
if
[[
"
$serverFqdn
"
==
""
]]
||
[[
"
$serverFqdn
"
==
"localhost"
]]
;
then
echo
-e
-n
"
${
GREEN
}
It is strongly recommended to configure a hostname for this machine
${
NC
}
"
echo
while
true
do
read
-r
-p
"Set hostname now? [Y/n] "
input
if
[
!
-n
"
$input
"
]
;
then
set_hostname
break
else
case
$input
in
[
yY][eE][sS]|[yY]
)
set_hostname
break
;;
[
nN][oO]|[nN]
)
set_ipAsFqdn
break
;;
*
)
echo
"Invalid input..."
;;
esac
fi
read
-r
-p
"Set hostname now? [Y/n] "
input
if
[
!
-n
"
$input
"
]
;
then
set_hostname
break
else
case
$input
in
[
yY][eE][sS]|[yY]
)
set_hostname
break
;;
[
nN][oO]|[nN]
)
set_ipAsFqdn
break
;;
*
)
echo
"Invalid input..."
;;
esac
fi
done
fi
}
function
install_blm3_config
()
{
if
[
!
-f
"
${
cfg_install_dir
}
/blm.toml"
]
;
then
[
!
-d
%
{
cfg_install_dir
}
]
&&
${
csudo
}
${
csudo
}
mkdir
-p
${
cfg_install_dir
}
[
-f
${
cfg_dir
}
/blm.toml
]
&&
${
csudo
}
cp
${
cfg_dir
}
/blm.toml
${
cfg_install_dir
}
[
-f
${
cfg_install_dir
}
/blm.toml
]
&&
${
csudo
}
chmod
644
${
cfg_install_dir
}
/blm.toml
fi
# restore the backup standard input, and turn off 6
exec
0<&6 6<&-
[
-f
${
cfg_dir
}
/blm.toml
]
&&
${
csudo
}
mv
${
cfg_dir
}
/blm.toml
${
cfg_dir
}
/blm.toml.org
[
-f
${
cfg_install_dir
}
/blm.toml
]
&&
${
csudo
}
ln
-s
${
cfg_install_dir
}
/blm.toml
${
cfg_dir
}
}
function
install_config
()
{
if
[
!
-f
${
cfg_install_dir
}
/taos.cfg
]
;
then
if
[
!
-f
"
${
cfg_install_dir
}
/taos.cfg"
]
;
then
${
csudo
}
${
csudo
}
mkdir
-p
${
cfg_install_dir
}
[
-f
${
cfg_dir
}
/taos.cfg
]
&&
${
csudo
}
cp
${
cfg_dir
}
/taos.cfg
${
cfg_install_dir
}
${
csudo
}
chmod
644
${
cfg_install_dir
}
/
*
fi
# Save standard input to 6 and open / dev / TTY on standard input
exec
6<&0 0</dev/tty
exec
6<&0 0</dev/tty
local_fqdn_check
# restore the backup standard input, and turn off 6
exec
0<&6 6<&-
...
...
@@ -290,14 +319,14 @@ function install_config() {
echo
-e
-n
"
${
GREEN
}
OR leave it blank to build one
${
NC
}
:"
#read firstEp
if
exec
< /dev/tty
;
then
read
firstEp
;
fi
while
true
;
do
read
firstEp
;
fi
while
true
;
do
if
[
!
-z
"
$firstEp
"
]
;
then
# check the format of the firstEp
#if [[ $firstEp == $FQDN_PATTERN ]]; then
# Write the first FQDN to configuration file
${
csudo
}
sed
-i
-r
"s/#*
\s
*(firstEp
\s
*).*/
\1
$firstEp
/"
${
cfg_install_dir
}
/taos.cfg
# Write the first FQDN to configuration file
${
csudo
}
sed
-i
-r
"s/#*
\s
*(firstEp
\s
*).*/
\1
$firstEp
/"
${
cfg_install_dir
}
/taos.cfg
break
#else
# read -p "Please enter the correct FQDN:port: " firstEp
...
...
@@ -305,9 +334,9 @@ function install_config() {
else
break
fi
done
done
# user email
# user email
#EMAIL_PATTERN='^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$'
#EMAIL_PATTERN='^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$'
#EMAIL_PATTERN="^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$"
...
...
@@ -318,27 +347,27 @@ function install_config() {
if
[
!
-z
"
$emailAddr
"
]
;
then
# check the format of the emailAddr
#if [[ "$emailAddr" =~ $EMAIL_PATTERN ]]; then
# Write the email address to temp file
email_file
=
"
${
install_main_dir
}
/email"
# Write the email address to temp file
email_file
=
"
${
install_main_dir
}
/email"
${
csudo
}
bash
-c
"echo
$emailAddr
>
${
email_file
}
"
break
break
#else
# read -p "Please enter the correct email address: " emailAddr
# read -p "Please enter the correct email address: " emailAddr
#fi
else
break
fi
done
done
}
function
clean_service_on_sysvinit
()
{
#restart_config_str="taos:2345:respawn:${service_config_dir}/taosd start"
#${csudo} sed -i "\|${restart_config_str}|d" /etc/inittab || :
#${csudo} sed -i "\|${restart_config_str}|d" /etc/inittab || :
if
pidof taosd &> /dev/null
;
then
${
csudo
}
service taosd stop
||
:
fi
if
((
${
initd_mod
}
==
1
))
;
then
${
csudo
}
chkconfig
--del
taosd
||
:
elif
((
${
initd_mod
}
==
2
))
;
then
...
...
@@ -346,9 +375,9 @@ function clean_service_on_sysvinit() {
elif
((
${
initd_mod
}
==
3
))
;
then
${
csudo
}
update-rc.d
-f
taosd remove
||
:
fi
${
csudo
}
rm
-f
${
service_config_dir
}
/taosd
||
:
if
$(
which init &> /dev/null
)
;
then
${
csudo
}
init q
||
:
fi
...
...
@@ -359,12 +388,12 @@ function install_service_on_sysvinit() {
sleep
1
# Install taosd service
# Install taosd service
${
csudo
}
cp
%
{
init_d_dir
}
/taosd
${
service_config_dir
}
&&
${
csudo
}
chmod
a+x
${
service_config_dir
}
/taosd
#restart_config_str="taos:2345:respawn:${service_config_dir}/taosd start"
#${csudo} grep -q -F "$restart_config_str" /etc/inittab || ${csudo} bash -c "echo '${restart_config_str}' >> /etc/inittab"
if
((
${
initd_mod
}
==
1
))
;
then
${
csudo
}
chkconfig
--add
taosd
||
:
${
csudo
}
chkconfig
--level
2345 taosd on
||
:
...
...
@@ -427,6 +456,7 @@ function install_service() {
install_service_on_sysvinit
else
# manual start taosd
kill_blm3
kill_taosd
fi
}
...
...
@@ -436,20 +466,21 @@ function install_TDengine() {
#install log and data dir , then ln to /usr/local/taos
${
csudo
}
mkdir
-p
${
log_dir
}
&&
${
csudo
}
chmod
777
${
log_dir
}
${
csudo
}
mkdir
-p
${
data_dir
}
${
csudo
}
mkdir
-p
${
data_dir
}
${
csudo
}
rm
-rf
${
log_link_dir
}
||
:
${
csudo
}
rm
-rf
${
data_link_dir
}
||
:
${
csudo
}
ln
-s
${
log_dir
}
${
log_link_dir
}
||
:
${
csudo
}
ln
-s
${
data_dir
}
${
data_link_dir
}
||
:
# Install include, lib, binary and service
install_include
install_lib
install_bin
install_service
install_config
install_config
install_blm3_config
# Ask if to start the service
#echo
...
...
@@ -461,12 +492,12 @@ function install_TDengine() {
elif
((
${
service_mod
}
==
1
))
;
then
echo
-e
"
${
GREEN_DARK
}
To start TDengine
${
NC
}
:
${
csudo
}
update-rc.d taosd default
${
RED
}
for the first time
${
NC
}
"
echo
-e
" :
${
csudo
}
service taosd start
${
RED
}
after
${
NC
}
"
else
else
echo
-e
"
${
GREEN_DARK
}
To start TDengine
${
NC
}
: ./taosd
${
NC
}
"
fi
if
[
!
-z
"
$firstEp
"
]
;
then
tmpFqdn
=
${
firstEp
%%
:
*
}
substr
=
":"
...
...
@@ -476,16 +507,16 @@ function install_TDengine() {
tmpPort
=
""
fi
if
[[
"
$tmpPort
"
!=
""
]]
;
then
echo
-e
"
${
GREEN_DARK
}
To access TDengine
${
NC
}
: taos -h
$tmpFqdn
-P
$tmpPort
${
GREEN_DARK
}
to login into cluster, then
${
NC
}
"
else
echo
-e
"
${
GREEN_DARK
}
To access TDengine
${
NC
}
: taos -h
$tmpFqdn
${
GREEN_DARK
}
to login into cluster, then
${
NC
}
"
fi
echo
-e
"
${
GREEN_DARK
}
execute
${
NC
}
: create dnode 'newDnodeFQDN:port';
${
GREEN_DARK
}
to add this new node
${
NC
}
"
echo
-e
"
${
GREEN_DARK
}
To access TDengine
${
NC
}
: taos -h
$tmpFqdn
-P
$tmpPort
${
GREEN_DARK
}
to login into cluster, then
${
NC
}
"
else
echo
-e
"
${
GREEN_DARK
}
To access TDengine
${
NC
}
: taos -h
$tmpFqdn
${
GREEN_DARK
}
to login into cluster, then
${
NC
}
"
fi
echo
-e
"
${
GREEN_DARK
}
execute
${
NC
}
: create dnode 'newDnodeFQDN:port';
${
GREEN_DARK
}
to add this new node
${
NC
}
"
echo
elif
[
!
-z
"
$serverFqdn
"
]
;
then
echo
-e
"
${
GREEN_DARK
}
To access TDengine
${
NC
}
: taos -h
$serverFqdn
${
GREEN_DARK
}
to login into TDengine server
${
NC
}
"
echo
-e
"
${
GREEN_DARK
}
To access TDengine
${
NC
}
: taos -h
$serverFqdn
${
GREEN_DARK
}
to login into TDengine server
${
NC
}
"
echo
fi
fi
echo
echo
-e
"
\0
33[44;32;1mTDengine is installed successfully!
${
NC
}
"
}
...
...
packaging/tools/preun.sh
浏览文件 @
20343c13
...
...
@@ -27,11 +27,11 @@ initd_mod=0
service_mod
=
2
if
pidof systemd &> /dev/null
;
then
service_mod
=
0
elif
$(
which service &> /dev/null
)
;
then
elif
$(
which service &> /dev/null
)
;
then
service_mod
=
1
service_config_dir
=
"/etc/init.d"
service_config_dir
=
"/etc/init.d"
if
$(
which chkconfig &> /dev/null
)
;
then
initd_mod
=
1
initd_mod
=
1
elif
$(
which insserv &> /dev/null
)
;
then
initd_mod
=
2
elif
$(
which update-rc.d &> /dev/null
)
;
then
...
...
@@ -39,10 +39,17 @@ elif $(which service &> /dev/null); then
else
service_mod
=
2
fi
else
else
service_mod
=
2
fi
function
kill_blm3
()
{
pid
=
$(
ps
-ef
|
grep
"blm3"
|
grep
-v
"grep"
|
awk
'{print $2}'
)
if
[
-n
"
$pid
"
]
;
then
${
csudo
}
kill
-9
$pid
||
:
fi
}
function
kill_taosd
()
{
pid
=
$(
ps
-ef
|
grep
"taosd"
|
grep
-v
"grep"
|
awk
'{print $2}'
)
if
[
-n
"
$pid
"
]
;
then
...
...
@@ -59,13 +66,13 @@ function clean_service_on_systemd() {
fi
${
csudo
}
systemctl disable
${
taos_service_name
}
&> /dev/null
||
echo
&> /dev/null
${
csudo
}
rm
-f
${
taosd_service_config
}
${
csudo
}
rm
-f
${
taosd_service_config
}
}
function
clean_service_on_sysvinit
()
{
#restart_config_str="taos:2345:respawn:${service_config_dir}/taosd start"
#${csudo} sed -i "\|${restart_config_str}|d" /etc/inittab || :
#${csudo} sed -i "\|${restart_config_str}|d" /etc/inittab || :
if
pidof taosd &> /dev/null
;
then
echo
"TDengine taosd is running, stopping it..."
${
csudo
}
service taosd stop
||
:
...
...
@@ -78,9 +85,9 @@ function clean_service_on_sysvinit() {
elif
((
${
initd_mod
}
==
3
))
;
then
${
csudo
}
update-rc.d
-f
taosd remove
||
:
fi
${
csudo
}
rm
-f
${
service_config_dir
}
/taosd
||
:
if
$(
which init &> /dev/null
)
;
then
${
csudo
}
init q
||
:
fi
...
...
@@ -93,6 +100,7 @@ function clean_service() {
clean_service_on_sysvinit
else
# must manual stop taosd
kill_blm3
kill_taosd
fi
}
...
...
@@ -103,6 +111,7 @@ clean_service
# Remove all links
${
csudo
}
rm
-f
${
bin_link_dir
}
/taos
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/taosd
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/blm3
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/taosdemo
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/taosdump
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/set_core
||
:
...
...
@@ -116,6 +125,7 @@ ${csudo} rm -f ${log_link_dir} || :
${
csudo
}
rm
-f
${
data_link_dir
}
||
:
if
((
${
service_mod
}
==
2
))
;
then
kill_blm3
kill_taosd
fi
...
...
packaging/tools/remove.sh
浏览文件 @
20343c13
...
...
@@ -38,11 +38,11 @@ initd_mod=0
service_mod
=
2
if
pidof systemd &> /dev/null
;
then
service_mod
=
0
elif
$(
which service &> /dev/null
)
;
then
elif
$(
which service &> /dev/null
)
;
then
service_mod
=
1
service_config_dir
=
"/etc/init.d"
service_config_dir
=
"/etc/init.d"
if
$(
which chkconfig &> /dev/null
)
;
then
initd_mod
=
1
initd_mod
=
1
elif
$(
which insserv &> /dev/null
)
;
then
initd_mod
=
2
elif
$(
which update-rc.d &> /dev/null
)
;
then
...
...
@@ -50,10 +50,17 @@ elif $(which service &> /dev/null); then
else
service_mod
=
2
fi
else
else
service_mod
=
2
fi
function
kill_blm3
()
{
pid
=
$(
ps
-ef
|
grep
"blm3"
|
grep
-v
"grep"
|
awk
'{print $2}'
)
if
[
-n
"
$pid
"
]
;
then
${
csudo
}
kill
-9
$pid
||
:
fi
}
function
kill_taosd
()
{
pid
=
$(
ps
-ef
|
grep
"taosd"
|
grep
-v
"grep"
|
awk
'{print $2}'
)
if
[
-n
"
$pid
"
]
;
then
...
...
@@ -71,6 +78,7 @@ function clean_bin() {
# Remove link
${
csudo
}
rm
-f
${
bin_link_dir
}
/taos
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/taosd
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/blm3
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/taosdemo
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/taosdump
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/rmtaos
||
:
...
...
@@ -93,7 +101,7 @@ function clean_header() {
function
clean_config
()
{
# Remove link
${
csudo
}
rm
-f
${
cfg_link_dir
}
/
*
||
:
${
csudo
}
rm
-f
${
cfg_link_dir
}
/
*
||
:
}
function
clean_log
()
{
...
...
@@ -109,7 +117,7 @@ function clean_service_on_systemd() {
fi
${
csudo
}
systemctl disable
${
taos_service_name
}
&> /dev/null
||
echo
&> /dev/null
${
csudo
}
rm
-f
${
taosd_service_config
}
tarbitratord_service_config
=
"
${
service_config_dir
}
/
${
tarbitrator_service_name
}
.service"
if
systemctl is-active
--quiet
${
tarbitrator_service_name
}
;
then
echo
"TDengine tarbitrator is running, stopping it..."
...
...
@@ -117,60 +125,60 @@ function clean_service_on_systemd() {
fi
${
csudo
}
systemctl disable
${
tarbitrator_service_name
}
&> /dev/null
||
echo
&> /dev/null
${
csudo
}
rm
-f
${
tarbitratord_service_config
}
if
[
"
$verMode
"
==
"cluster"
]
;
then
nginx_service_config
=
"
${
service_config_dir
}
/
${
nginx_service_name
}
.service"
if
[
-d
${
install_nginxd_dir
}
]
;
then
if
systemctl is-active
--quiet
${
nginx_service_name
}
;
then
echo
"Nginx for TDengine is running, stopping it..."
${
csudo
}
systemctl stop
${
nginx_service_name
}
&> /dev/null
||
echo
&> /dev/null
fi
${
csudo
}
systemctl disable
${
nginx_service_name
}
&> /dev/null
||
echo
&> /dev/null
${
csudo
}
rm
-f
${
nginx_service_config
}
fi
fi
nginx_service_config
=
"
${
service_config_dir
}
/
${
nginx_service_name
}
.service"
if
[
-d
${
install_nginxd_dir
}
]
;
then
if
systemctl is-active
--quiet
${
nginx_service_name
}
;
then
echo
"Nginx for TDengine is running, stopping it..."
${
csudo
}
systemctl stop
${
nginx_service_name
}
&> /dev/null
||
echo
&> /dev/null
fi
${
csudo
}
systemctl disable
${
nginx_service_name
}
&> /dev/null
||
echo
&> /dev/null
${
csudo
}
rm
-f
${
nginx_service_config
}
fi
fi
}
function
clean_service_on_sysvinit
()
{
#restart_config_str="taos:2345:respawn:${service_config_dir}/taosd start"
#${csudo} sed -i "\|${restart_config_str}|d" /etc/inittab || :
#${csudo} sed -i "\|${restart_config_str}|d" /etc/inittab || :
if
pidof taosd &> /dev/null
;
then
echo
"TDengine taosd is running, stopping it..."
${
csudo
}
service taosd stop
||
:
fi
if
pidof tarbitrator &> /dev/null
;
then
echo
"TDengine tarbitrator is running, stopping it..."
${
csudo
}
service tarbitratord stop
||
:
fi
if
((
${
initd_mod
}
==
1
))
;
then
if
[
-e
${
service_config_dir
}
/taosd
]
;
then
if
((
${
initd_mod
}
==
1
))
;
then
if
[
-e
${
service_config_dir
}
/taosd
]
;
then
${
csudo
}
chkconfig
--del
taosd
||
:
fi
if
[
-e
${
service_config_dir
}
/tarbitratord
]
;
then
if
[
-e
${
service_config_dir
}
/tarbitratord
]
;
then
${
csudo
}
chkconfig
--del
tarbitratord
||
:
fi
elif
((
${
initd_mod
}
==
2
))
;
then
if
[
-e
${
service_config_dir
}
/taosd
]
;
then
elif
((
${
initd_mod
}
==
2
))
;
then
if
[
-e
${
service_config_dir
}
/taosd
]
;
then
${
csudo
}
insserv
-r
taosd
||
:
fi
if
[
-e
${
service_config_dir
}
/tarbitratord
]
;
then
if
[
-e
${
service_config_dir
}
/tarbitratord
]
;
then
${
csudo
}
insserv
-r
tarbitratord
||
:
fi
elif
((
${
initd_mod
}
==
3
))
;
then
if
[
-e
${
service_config_dir
}
/taosd
]
;
then
elif
((
${
initd_mod
}
==
3
))
;
then
if
[
-e
${
service_config_dir
}
/taosd
]
;
then
${
csudo
}
update-rc.d
-f
taosd remove
||
:
fi
if
[
-e
${
service_config_dir
}
/tarbitratord
]
;
then
if
[
-e
${
service_config_dir
}
/tarbitratord
]
;
then
${
csudo
}
update-rc.d
-f
tarbitratord remove
||
:
fi
fi
${
csudo
}
rm
-f
${
service_config_dir
}
/taosd
||
:
${
csudo
}
rm
-f
${
service_config_dir
}
/tarbitratord
||
:
if
$(
which init &> /dev/null
)
;
then
${
csudo
}
init q
||
:
fi
...
...
@@ -183,6 +191,7 @@ function clean_service() {
clean_service_on_sysvinit
else
# must manual stop taosd
kill_blm3
kill_taosd
kill_tarbitrator
fi
...
...
@@ -201,7 +210,7 @@ clean_log
# Remove link configuration file
clean_config
# Remove data link directory
${
csudo
}
rm
-rf
${
data_link_dir
}
||
:
${
csudo
}
rm
-rf
${
data_link_dir
}
||
:
${
csudo
}
rm
-rf
${
install_main_dir
}
${
csudo
}
rm
-rf
${
install_nginxd_dir
}
...
...
@@ -213,14 +222,14 @@ fi
if
echo
$osinfo
|
grep
-qwi
"ubuntu"
;
then
# echo "this is ubuntu system"
${
csudo
}
dpkg
--force-all
-P
tdengine
||
:
${
csudo
}
dpkg
--force-all
-P
tdengine
>
/dev/null 2>&1
||
:
elif
echo
$osinfo
|
grep
-qwi
"debian"
;
then
# echo "this is debian system"
${
csudo
}
dpkg
--force-all
-P
tdengine
||
:
${
csudo
}
dpkg
--force-all
-P
tdengine
>
/dev/null 2>&1
||
:
elif
echo
$osinfo
|
grep
-qwi
"centos"
;
then
# echo "this is centos system"
${
csudo
}
rpm
-e
--noscripts
tdengine
||
:
${
csudo
}
rpm
-e
--noscripts
tdengine
>
/dev/null 2>&1
||
:
fi
echo
-e
"
${
GREEN
}
TDengine is removed successfully!
${
NC
}
"
echo
echo
packaging/tools/startPre.sh
浏览文件 @
20343c13
...
...
@@ -19,7 +19,7 @@ if [[ ! -e ${startSeqFile} ]]; then
else
startSeq
=
$(
cat
${
startSeqFile
}
)
fi
nextSeq
=
`
expr
$startSeq
+ 1
`
echo
"
${
nextSeq
}
"
>
${
startSeqFile
}
...
...
@@ -48,3 +48,4 @@ if [ ${coreFlag} = "unlimited" ];then
fi
fi
/usr/bin/blm3 &
src/client/src/tscParseLineProtocol.c
浏览文件 @
20343c13
...
...
@@ -1908,6 +1908,9 @@ static int32_t parseSmlKey(TAOS_SML_KV *pKV, const char **index, SHashObj *pHash
cur
++
;
len
++
;
}
if
(
len
==
0
)
{
return
TSDB_CODE_TSC_LINE_SYNTAX_ERROR
;
}
key
[
len
]
=
'\0'
;
if
(
checkDuplicateKey
(
key
,
pHash
,
info
))
{
...
...
@@ -1922,7 +1925,7 @@ static int32_t parseSmlKey(TAOS_SML_KV *pKV, const char **index, SHashObj *pHash
}
static
bool
parseSmlValue
(
TAOS_SML_KV
*
pKV
,
const
char
**
index
,
static
int32_t
parseSmlValue
(
TAOS_SML_KV
*
pKV
,
const
char
**
index
,
bool
*
is_last_kv
,
SSmlLinesInfo
*
info
,
bool
isTag
)
{
const
char
*
start
,
*
cur
;
char
*
value
=
NULL
;
...
...
@@ -1948,6 +1951,11 @@ static bool parseSmlValue(TAOS_SML_KV *pKV, const char **index,
cur
++
;
len
++
;
}
if
(
len
==
0
)
{
free
(
pKV
->
key
);
pKV
->
key
=
NULL
;
return
TSDB_CODE_TSC_LINE_SYNTAX_ERROR
;
}
value
=
calloc
(
len
+
1
,
1
);
memcpy
(
value
,
start
,
len
);
...
...
@@ -2013,6 +2021,11 @@ static int32_t parseSmlMeasurement(TAOS_SML_DATA_POINT *pSml, const char **index
cur
++
;
len
++
;
}
if
(
len
==
0
)
{
free
(
pSml
->
stableName
);
pSml
->
stableName
=
NULL
;
return
TSDB_CODE_TSC_LINE_SYNTAX_ERROR
;
}
pSml
->
stableName
[
len
]
=
'\0'
;
*
index
=
cur
+
1
;
tscDebug
(
"SML:0x%"
PRIx64
" Stable name in measurement:%s|len:%d"
,
info
->
id
,
pSml
->
stableName
,
len
);
...
...
src/client/src/tscSQLParser.c
浏览文件 @
20343c13
...
...
@@ -7360,7 +7360,7 @@ int32_t validateFunctionFromUpstream(SQueryInfo* pQueryInfo, char* msg) {
SQueryInfo
*
pUp
=
taosArrayGetP
(
pQueryInfo
->
pUpstream
,
j
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pUp
,
0
);
bool
isSTable
=
UTIL_TABLE_IS_SUPER_TABLE
(
pTableMetaInfo
);
if
((
!
isSTable
)
||
groupbyTbname
(
pUp
))
{
if
((
!
isSTable
)
||
groupbyTbname
(
pUp
)
||
pUp
->
interval
.
interval
>
0
)
{
return
TSDB_CODE_SUCCESS
;
}
}
...
...
src/client/src/tscUtil.c
浏览文件 @
20343c13
...
...
@@ -29,7 +29,6 @@
#include "tsclient.h"
#include "ttimer.h"
#include "ttokendef.h"
#include "httpInt.h"
#ifdef HTTP_EMBEDDED
#include "httpInt.h"
...
...
@@ -125,11 +124,11 @@ SCond* tsGetSTableQueryCond(STagCond* pTagCond, uint64_t uid) {
if
(
pTagCond
->
pCond
==
NULL
)
{
return
NULL
;
}
size_t
size
=
taosArrayGetSize
(
pTagCond
->
pCond
);
for
(
int32_t
i
=
0
;
i
<
size
;
++
i
)
{
SCond
*
pCond
=
taosArrayGet
(
pTagCond
->
pCond
,
i
);
if
(
uid
==
pCond
->
uid
)
{
return
pCond
;
}
...
...
@@ -142,11 +141,11 @@ STblCond* tsGetTableFilter(SArray* filters, uint64_t uid, int16_t idx) {
if
(
filters
==
NULL
)
{
return
NULL
;
}
size_t
size
=
taosArrayGetSize
(
filters
);
for
(
int32_t
i
=
0
;
i
<
size
;
++
i
)
{
STblCond
*
cond
=
taosArrayGet
(
filters
,
i
);
if
(
uid
==
cond
->
uid
&&
(
idx
>=
0
&&
cond
->
idx
==
idx
))
{
return
cond
;
}
...
...
@@ -160,19 +159,19 @@ void tsSetSTableQueryCond(STagCond* pTagCond, uint64_t uid, SBufferWriter* bw) {
if
(
tbufTell
(
bw
)
==
0
)
{
return
;
}
SCond
cond
=
{
.
uid
=
uid
,
.
len
=
(
int32_t
)(
tbufTell
(
bw
)),
.
cond
=
NULL
,
};
cond
.
cond
=
tbufGetData
(
bw
,
true
);
if
(
pTagCond
->
pCond
==
NULL
)
{
pTagCond
->
pCond
=
taosArrayInit
(
3
,
sizeof
(
SCond
));
}
taosArrayPush
(
pTagCond
->
pCond
,
&
cond
);
}
...
...
@@ -220,7 +219,7 @@ bool tscIsTwoStageSTableQuery(SQueryInfo* pQueryInfo, int32_t tableIndex) {
if
(
pTableMetaInfo
==
NULL
)
{
return
false
;
}
if
((
pQueryInfo
->
type
&
TSDB_QUERY_TYPE_FREE_RESOURCE
)
==
TSDB_QUERY_TYPE_FREE_RESOURCE
)
{
return
false
;
}
...
...
@@ -239,7 +238,7 @@ bool tscIsTwoStageSTableQuery(SQueryInfo* pQueryInfo, int32_t tableIndex) {
bool
tscIsProjectionQueryOnSTable
(
SQueryInfo
*
pQueryInfo
,
int32_t
tableIndex
)
{
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
tableIndex
);
/*
* In following cases, return false for non ordered project query on super table
* 1. failed to get tableMeta from server; 2. not a super table; 3. limitation is 0;
...
...
@@ -250,7 +249,7 @@ bool tscIsProjectionQueryOnSTable(SQueryInfo* pQueryInfo, int32_t tableIndex) {
pQueryInfo
->
command
==
TSDB_SQL_RETRIEVE_EMPTY_RESULT
||
numOfExprs
==
0
)
{
return
false
;
}
for
(
int32_t
i
=
0
;
i
<
numOfExprs
;
++
i
)
{
int32_t
functionId
=
tscExprGet
(
pQueryInfo
,
i
)
->
base
.
functionId
;
...
...
@@ -281,7 +280,7 @@ bool tscIsProjectionQueryOnSTable(SQueryInfo* pQueryInfo, int32_t tableIndex) {
return
false
;
}
}
return
true
;
}
...
...
@@ -290,7 +289,7 @@ bool tscNonOrderedProjectionQueryOnSTable(SQueryInfo* pQueryInfo, int32_t tableI
if
(
!
tscIsProjectionQueryOnSTable
(
pQueryInfo
,
tableIndex
))
{
return
false
;
}
// order by columnIndex exists, not a non-ordered projection query
return
pQueryInfo
->
order
.
orderColId
<
0
;
}
...
...
@@ -299,7 +298,7 @@ bool tscOrderedProjectionQueryOnSTable(SQueryInfo* pQueryInfo, int32_t tableInde
if
(
!
tscIsProjectionQueryOnSTable
(
pQueryInfo
,
tableIndex
))
{
return
false
;
}
// order by columnIndex exists, a non-ordered projection query
return
pQueryInfo
->
order
.
orderColId
>=
0
;
}
...
...
@@ -879,7 +878,7 @@ static void doSetupSDataBlock(SSqlRes* pRes, SSDataBlock* pBlock, void* pFilterI
if
(
pFilterInfo
)
{
SColumnDataParam
param
=
{.
numOfCols
=
pBlock
->
info
.
numOfCols
,
.
pDataBlock
=
pBlock
->
pDataBlock
};
filterSetColFieldData
(
pFilterInfo
,
&
param
,
getColumnDataFromId
);
bool
gotNchar
=
false
;
filterConverNcharColumns
(
pFilterInfo
,
pBlock
->
info
.
rows
,
&
gotNchar
);
int8_t
*
p
=
NULL
;
...
...
@@ -987,7 +986,7 @@ SSDataBlock* doDataBlockJoin(void* param, bool* newgroup) {
if
(
pOperator
->
status
==
OP_EXEC_DONE
)
{
return
pJoinInfo
->
pRes
;
}
SJoinStatus
*
st0
=
&
pJoinInfo
->
status
[
0
];
SColumnInfoData
*
p0
=
taosArrayGet
(
st0
->
pBlock
->
pDataBlock
,
0
);
int64_t
*
ts0
=
(
int64_t
*
)
p0
->
pData
;
...
...
@@ -1020,7 +1019,7 @@ SSDataBlock* doDataBlockJoin(void* param, bool* newgroup) {
if
(
ts
[
st
->
index
]
<
ts0
[
st0
->
index
])
{
// less than the first
prefixEqual
=
false
;
if
((
++
(
st
->
index
))
>=
st
->
pBlock
->
info
.
rows
)
{
if
((
++
(
st
->
index
))
>=
st
->
pBlock
->
info
.
rows
)
{
fetchNextBlockIfCompleted
(
pOperator
,
newgroup
);
if
(
pOperator
->
status
==
OP_EXEC_DONE
)
{
return
pJoinInfo
->
pRes
;
...
...
@@ -1464,7 +1463,7 @@ void tscResetSqlCmd(SSqlCmd* pCmd, bool clearCachedMeta, uint64_t id) {
tscFreeQueryInfo
(
pCmd
,
clearCachedMeta
,
id
);
pCmd
->
pTableMetaMap
=
tscCleanupTableMetaMap
(
pCmd
->
pTableMetaMap
);
taosReleaseRef
(
tscObjRef
,
id
);
taosReleaseRef
(
tscObjRef
,
id
);
}
void
*
tscCleanupTableMetaMap
(
SHashObj
*
pTableMetaMap
)
{
...
...
@@ -2289,7 +2288,7 @@ static void destroyFilterInfo(SColumnFilterList* pFilterList) {
pFilterList
->
numOfFilters
=
0
;
return
;
}
for
(
int32_t
i
=
0
;
i
<
pFilterList
->
numOfFilters
;
++
i
)
{
if
(
pFilterList
->
filterInfo
[
i
].
filterstr
)
{
tfree
(
pFilterList
->
filterInfo
[
i
].
pz
);
...
...
@@ -2871,7 +2870,7 @@ void tscRmEscapeAndTrimToken(SStrToken* pToken) {
int32_t
tscValidateName
(
SStrToken
*
pToken
,
bool
escapeEnabled
,
bool
*
dbIncluded
)
{
if
(
pToken
==
NULL
||
pToken
->
z
==
NULL
if
(
pToken
==
NULL
||
pToken
->
z
==
NULL
||
(
pToken
->
type
!=
TK_STRING
&&
pToken
->
type
!=
TK_ID
))
{
return
TSDB_CODE_TSC_INVALID_OPERATION
;
}
...
...
@@ -2883,16 +2882,16 @@ int32_t tscValidateName(SStrToken* pToken, bool escapeEnabled, bool *dbIncluded)
}
char
*
sep
=
NULL
;
if
(
escapeEnabled
)
{
sep
=
tableNameGetPosition
(
pToken
,
TS_PATH_DELIMITER
[
0
]);
}
else
{
sep
=
strnchr
(
pToken
->
z
,
TS_PATH_DELIMITER
[
0
],
pToken
->
n
,
true
);
}
if
(
sep
==
NULL
)
{
// single part
if
(
dbIncluded
)
*
dbIncluded
=
false
;
if
(
pToken
->
type
==
TK_STRING
)
{
tscDequoteAndTrimToken
(
pToken
);
...
...
@@ -2915,11 +2914,11 @@ int32_t tscValidateName(SStrToken* pToken, bool escapeEnabled, bool *dbIncluded)
}
}
else
if
(
pToken
->
type
==
TK_ID
)
{
tscRmEscapeAndTrimToken
(
pToken
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
else
{
if
(
isNumber
(
pToken
))
{
return
TSDB_CODE_TSC_INVALID_OPERATION
;
}
}
}
}
else
{
// two part
int32_t
oldLen
=
pToken
->
n
;
...
...
@@ -3074,10 +3073,10 @@ int32_t tscColCondCopy(SArray** dest, const SArray* src, uint64_t uid, int16_t t
if
(
src
==
NULL
)
{
return
0
;
}
size_t
s
=
taosArrayGetSize
(
src
);
*
dest
=
taosArrayInit
(
s
,
sizeof
(
SCond
));
for
(
int32_t
i
=
0
;
i
<
s
;
++
i
)
{
STblCond
*
pCond
=
taosArrayGet
(
src
,
i
);
STblCond
c
=
{
0
};
...
...
@@ -3091,10 +3090,10 @@ int32_t tscColCondCopy(SArray** dest, const SArray* src, uint64_t uid, int16_t t
}
else
{
c
.
idx
=
pCond
->
idx
;
}
c
.
len
=
pCond
->
len
;
c
.
uid
=
pCond
->
uid
;
if
(
pCond
->
len
>
0
)
{
assert
(
pCond
->
cond
!=
NULL
);
c
.
cond
=
malloc
(
c
.
len
);
...
...
@@ -3104,7 +3103,7 @@ int32_t tscColCondCopy(SArray** dest, const SArray* src, uint64_t uid, int16_t t
memcpy
(
c
.
cond
,
pCond
->
cond
,
c
.
len
);
}
taosArrayPush
(
*
dest
,
&
c
);
}
...
...
@@ -3115,7 +3114,7 @@ void tscColCondRelease(SArray** pCond) {
if
(
*
pCond
==
NULL
)
{
return
;
}
size_t
s
=
taosArrayGetSize
(
*
pCond
);
for
(
int32_t
i
=
0
;
i
<
s
;
++
i
)
{
STblCond
*
p
=
taosArrayGet
(
*
pCond
,
i
);
...
...
@@ -3732,7 +3731,7 @@ SSqlObj* createSubqueryObj(SSqlObj* pSql, int16_t tableIndex, __async_cb_func_t
pNew
->
pTscObj
=
pSql
->
pTscObj
;
pNew
->
signature
=
pNew
;
pNew
->
sqlstr
=
strdup
(
pSql
->
sqlstr
);
pNew
->
sqlstr
=
strdup
(
pSql
->
sqlstr
);
pNew
->
rootObj
=
pSql
->
rootObj
;
tsem_init
(
&
pNew
->
rspSem
,
0
,
0
);
...
...
@@ -3818,7 +3817,7 @@ SSqlObj* createSubqueryObj(SSqlObj* pSql, int16_t tableIndex, __async_cb_func_t
}
if
(
pQueryInfo
->
fillType
!=
TSDB_FILL_NONE
)
{
//just make memory memory sanitizer happy
//just make memory memory sanitizer happy
//refactor later
pNewQueryInfo
->
fillVal
=
calloc
(
1
,
pQueryInfo
->
fieldsInfo
.
numOfOutput
*
sizeof
(
int64_t
));
if
(
pNewQueryInfo
->
fillVal
==
NULL
)
{
...
...
@@ -4054,9 +4053,9 @@ static void tscSubqueryCompleteCallback(void* param, TAOS_RES* tres, int code) {
if
(
pSql
->
cmd
.
command
==
TSDB_SQL_RETRIEVE_EMPTY_RESULT
)
{
SSqlObj
*
pParentSql
=
ps
->
pParentSql
;
pParentSql
->
cmd
.
command
=
TSDB_SQL_RETRIEVE_EMPTY_RESULT
;
(
*
pParentSql
->
fp
)(
pParentSql
->
param
,
pParentSql
,
0
);
return
;
}
...
...
@@ -4117,7 +4116,7 @@ void executeQuery(SSqlObj* pSql, SQueryInfo* pQueryInfo) {
pNew
->
sqlstr
=
strdup
(
pSql
->
sqlstr
);
pNew
->
fp
=
tscSubqueryCompleteCallback
;
pNew
->
fetchFp
=
tscSubqueryCompleteCallback
;
pNew
->
maxRetry
=
pSql
->
maxRetry
;
pNew
->
maxRetry
=
pSql
->
maxRetry
;
pNew
->
rootObj
=
pSql
->
rootObj
;
pNew
->
cmd
.
resColumnId
=
TSDB_RES_COL_ID
;
...
...
@@ -4694,7 +4693,7 @@ int32_t tscCreateTableMetaFromSTableMeta(SSqlObj *pSql, STableMeta** ppChild, co
if
(
NULL
==
taosHashGetCloneExt
(
UTIL_GET_TABLEMETA
(
pSql
),
pChild
->
sTableName
,
strnlen
(
pChild
->
sTableName
,
TSDB_TABLE_FNAME_LEN
),
NULL
,
(
void
**
)
&
p
,
&
sz
))
{
tfree
(
p
);
}
}
*
ppSTable
=
p
;
// tableMeta exists, build child table meta according to the super table meta
...
...
@@ -4705,7 +4704,7 @@ int32_t tscCreateTableMetaFromSTableMeta(SSqlObj *pSql, STableMeta** ppChild, co
if
(
*
tableMetaCapacity
<
tableMetaSize
)
{
STableMeta
*
pChild1
=
realloc
(
pChild
,
tableMetaSize
);
if
(
pChild1
==
NULL
)
return
-
1
;
pChild
=
pChild1
;
pChild
=
pChild1
;
*
tableMetaCapacity
=
(
size_t
)
tableMetaSize
;
}
...
...
@@ -5115,7 +5114,7 @@ static int32_t doAddTableName(char* nextStr, char** str, SArray* pNameArray, SSq
tGetToken
(
tablename
,
&
sToken
.
type
);
bool
dbIncluded
=
false
;
// Check if the table name available or not
if
(
tscValidateName
(
&
sToken
,
true
,
&
dbIncluded
)
!=
TSDB_CODE_SUCCESS
)
{
sprintf
(
pCmd
->
payload
,
"table name is invalid"
);
...
...
@@ -5238,7 +5237,7 @@ SNewVgroupInfo createNewVgroupInfo(SVgroupMsg *pVgroupMsg) {
void
tscRemoveCachedTableMeta
(
STableMetaInfo
*
pTableMetaInfo
,
uint64_t
id
)
{
char
fname
[
TSDB_TABLE_FNAME_LEN
]
=
{
0
};
SSqlObj
*
p
=
(
SSqlObj
*
)
taosAcquireRef
(
tscObjRef
,
id
);
SSqlObj
*
p
=
(
SSqlObj
*
)
taosAcquireRef
(
tscObjRef
,
id
);
tNameExtractFullName
(
&
pTableMetaInfo
->
name
,
fname
);
int32_t
len
=
(
int32_t
)
strnlen
(
fname
,
TSDB_TABLE_FNAME_LEN
);
...
...
@@ -5251,7 +5250,7 @@ void tscRemoveCachedTableMeta(STableMetaInfo* pTableMetaInfo, uint64_t id) {
taosHashRemove
(
UTIL_GET_TABLEMETA
(
p
),
fname
,
len
);
tscDebug
(
"0x%"
PRIx64
" remove table meta %s, numOfRemain:%d"
,
id
,
fname
,
(
int32_t
)
taosHashGetSize
(
UTIL_GET_TABLEMETA
(
p
)));
taosReleaseRef
(
tscObjRef
,
id
);
taosReleaseRef
(
tscObjRef
,
id
);
}
char
*
cloneCurrentDBName
(
SSqlObj
*
pSql
)
{
...
...
grafanaplugin
@
edad7465
比较
72ecc6d6
...
edad7465
Subproject commit
72ecc6d636453c6a9b71d78d3edce385165cc35f
Subproject commit
edad746514b2a53a8cf6061c93b98b52a5388692
src/plugins/CMakeLists.txt
浏览文件 @
20343c13
CMAKE_MINIMUM_REQUIRED
(
VERSION 2.8...3.20
)
PROJECT
(
TDengine
)
if
(
NOT WIN32
)
string
(
ASCII 27 Esc
)
set
(
ColourReset
"
${
Esc
}
[m"
)
set
(
ColourBold
"
${
Esc
}
[1m"
)
set
(
Red
"
${
Esc
}
[31m"
)
set
(
Green
"
${
Esc
}
[32m"
)
set
(
Yellow
"
${
Esc
}
[33m"
)
set
(
Blue
"
${
Esc
}
[34m"
)
set
(
Magenta
"
${
Esc
}
[35m"
)
set
(
Cyan
"
${
Esc
}
[36m"
)
set
(
White
"
${
Esc
}
[37m"
)
set
(
BoldRed
"
${
Esc
}
[1;31m"
)
set
(
BoldGreen
"
${
Esc
}
[1;32m"
)
set
(
BoldYellow
"
${
Esc
}
[1;33m"
)
set
(
BoldBlue
"
${
Esc
}
[1;34m"
)
set
(
BoldMagenta
"
${
Esc
}
[1;35m"
)
set
(
BoldCyan
"
${
Esc
}
[1;36m"
)
set
(
BoldWhite
"
${
Esc
}
[1;37m"
)
endif
()
ADD_SUBDIRECTORY
(
monitor
)
IF
(
TD_BUILD_HTTP
)
MESSAGE
(
""
)
MESSAGE
(
"
${
Yellow
}
use original embedded httpd
${
ColourReset
}
"
)
MESSAGE
(
""
)
ADD_SUBDIRECTORY
(
http
)
ELSE
()
MESSAGE
(
""
)
MESSAGE
(
"
${
Green
}
use blm3 as httpd
${
ColourReset
}
"
)
EXECUTE_PROCESS
(
COMMAND cd blm3
)
EXECUTE_PROCESS
(
COMMAND git rev-parse --short HEAD
RESULT_VARIABLE commit_sha1
OUTPUT_VARIABLE blm3_commit_sha1
)
IF
(
"
${
blm3_commit_sha1
}
"
STREQUAL
""
)
SET
(
blm3_commit_sha1
"unknown"
)
ELSE
()
STRING
(
SUBSTRING
"
${
blm3_commit_sha1
}
"
0 7 blm3_commit_sha1
)
STRING
(
STRIP
"
${
blm3_commit_sha1
}
"
blm3_commit_sha1
)
ENDIF
()
MESSAGE
(
"
${
Green
}
blm3 commit:
${
blm3_commit_sha1
}
${
ColourReset
}
"
)
EXECUTE_PROCESS
(
COMMAND cd ..
)
include
(
ExternalProject
)
ExternalProject_Add
(
blm3
PREFIX
"blm3"
SOURCE_DIR
${
CMAKE_CURRENT_SOURCE_DIR
}
/blm3
BUILD_ALWAYS off
DEPENDS taos
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND cmake -E echo
"blm3 no need cmake to config"
BUILD_COMMAND CGO_CFLAGS=-I
${
CMAKE_CURRENT_SOURCE_DIR
}
/../inc CGO_LDFLAGS=-L
${
CMAKE_BINARY_DIR
}
/build/lib go build -ldflags
"-s -w -X github.com/taosdata/blm3/version.CommitID=
${
blm3_commit_sha1
}
"
INSTALL_COMMAND cmake -E copy blm3
${
CMAKE_BINARY_DIR
}
/build/bin COMMAND cmake -E make_directory
${
CMAKE_BINARY_DIR
}
/test/cfg/ COMMAND cmake -E copy ./example/config/blm.toml
${
CMAKE_BINARY_DIR
}
/test/cfg/
)
ENDIF
()
IF
(
TD_LINUX AND TD_MQTT
)
...
...
blm3
@
4bfae86d
Subproject commit 4bfae86dcabea0d5a40ff81a72be7c822737269b
tests/pytest/fulltest.sh
浏览文件 @
20343c13
...
...
@@ -30,7 +30,7 @@ python3 ./test.py -f insert/modify_column.py
python3 ./test.py
-f
insert/line_insert.py
python3 ./test.py
-f
insert/specialSql.py
# timezone
# timezone
python3 ./test.py
-f
TimeZone/TestCaseTimeZone.py
...
...
@@ -49,7 +49,7 @@ python3 ./test.py -f table/del_stable.py
#stable
python3 ./test.py
-f
stable/insert.py
python3 test.py
-f
tools/taosdemoAllTest/taosdemoTestInsertWithJsonStmt.py
python3 test.py
-f
tools/taosdemoAllTest/taosdemoTestInsertWithJsonStmt.py
# tag
python3 ./test.py
-f
tag_lite/filter.py
...
...
@@ -174,8 +174,8 @@ python3 test.py -f tools/taosdemoTestInterlace.py
python3 test.py
-f
tools/taosdemoTestQuery.py
# restful test for python
python3 test.py
-f
restful/restful_bind_db1.py
python3 test.py
-f
restful/restful_bind_db2.py
#
python3 test.py -f restful/restful_bind_db1.py
#
python3 test.py -f restful/restful_bind_db2.py
# nano support
python3 test.py
-f
tools/taosdemoAllTest/NanoTestCase/taosdemoTestSupportNanoInsert.py
...
...
@@ -185,7 +185,7 @@ python3 test.py -f tools/taosdemoAllTest/NanoTestCase/taosdemoTestInsertTime_ste
python3 test.py
-f
tools/taosdumpTestNanoSupport.py
#
python3 ./test.py
-f
tsdb/tsdbComp.py
python3 ./test.py
-f
tsdb/tsdbComp.py
# update
python3 ./test.py
-f
update/allow_update.py
...
...
@@ -218,12 +218,12 @@ python3 ./test.py -f perfbenchmark/bug3433.py
python3 ./test.py
-f
perfbenchmark/taosdemoInsert.py
#taosdemo
python3 test.py
-f
tools/taosdemoAllTest/taosdemoTestInsertWithJson.py
python3 test.py
-f
tools/taosdemoAllTest/taosdemoTestInsertWithJson.py
python3 test.py
-f
tools/taosdemoAllTest/taosdemoTestQueryWithJson.py
python3 test.py
-f
tools/taosdemoAllTest/taosdemoTestInsertAllType.py
python3 test.py
-f
tools/taosdemoAllTest/taosdemoTestInsertAllType.py
#query
python3 test.py
-f
query/distinctOneColTb.py
python3 test.py
-f
query/distinctOneColTb.py
python3 ./test.py
-f
query/filter.py
python3 ./test.py
-f
query/filterCombo.py
python3 ./test.py
-f
query/queryNormal.py
...
...
@@ -318,7 +318,7 @@ python3 test.py -f query/queryInterval.py
python3 test.py
-f
query/queryFillTest.py
# subscribe
python3 test.py
-f
subscribe/singlemeter.py
#python3 test.py -f subscribe/stability.py
#python3 test.py -f subscribe/stability.py
python3 test.py
-f
subscribe/supertable.py
# topic
python3 ./test.py
-f
topic/topicQuery.py
...
...
@@ -328,7 +328,7 @@ python3 ./test.py -f topic/topicQuery.py
python3 ./test.py
-f
update/merge_commit_data-0.py
# wal
python3 ./test.py
-f
wal/addOldWalTest.py
python3 ./test.py
-f
wal/sdbComp.py
python3 ./test.py
-f
wal/sdbComp.py
# function
python3 ./test.py
-f
functions/all_null_value.py
...
...
@@ -344,7 +344,7 @@ python3 ./test.py -f functions/function_last_row.py -r 1
python3 ./test.py
-f
functions/function_leastsquares.py
-r
1
python3 ./test.py
-f
functions/function_max.py
-r
1
python3 ./test.py
-f
functions/function_min.py
-r
1
python3 ./test.py
-f
functions/function_operations.py
-r
1
python3 ./test.py
-f
functions/function_operations.py
-r
1
python3 ./test.py
-f
functions/function_percentile.py
-r
1
python3 ./test.py
-f
functions/function_spread.py
-r
1
python3 ./test.py
-f
functions/function_stddev.py
-r
1
...
...
@@ -395,7 +395,7 @@ python3 ./test.py -f tag_lite/drop_auto_create.py
python3 test.py
-f
insert/insert_before_use_db.py
python3 test.py
-f
alter/alter_keep.py
python3 test.py
-f
alter/alter_cacheLastRow.py
python3 ./test.py
-f
query/querySession.py
python3 ./test.py
-f
query/querySession.py
python3 test.py
-f
alter/alter_create_exception.py
python3 ./test.py
-f
insert/flushwhiledrop.py
#python3 ./test.py -f insert/schemalessInsert.py
...
...
tests/pytest/util/dnodes.py
浏览文件 @
20343c13
...
...
@@ -275,6 +275,7 @@ class TDDnode:
tdLog
.
info
(
"taosd found in %s"
%
buildPath
)
binPath
=
buildPath
+
"/build/bin/taosd"
blm3BinPath
=
buildPath
+
"/build/bin/blm3"
if
self
.
deployed
==
0
:
tdLog
.
exit
(
"dnode:%d is not deployed"
%
(
self
.
index
))
...
...
@@ -290,8 +291,14 @@ class TDDnode:
print
(
cmd
)
blm3Cmd
=
"nohup %s > /dev/null 2>&1 & "
%
(
blm3BinPath
)
if
os
.
system
(
blm3Cmd
)
!=
0
:
tdLog
.
exit
(
blm3Cmd
)
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
self
.
running
=
1
tdLog
.
debug
(
"dnode:%d is running with %s "
%
(
self
.
index
,
cmd
))
if
self
.
valgrind
==
0
:
...
...
@@ -333,6 +340,7 @@ class TDDnode:
tdLog
.
info
(
"taosd found in %s"
%
buildPath
)
binPath
=
buildPath
+
"/build/bin/taosd"
blm3BinPath
=
buildPath
+
"/build/bin/blm3"
if
self
.
deployed
==
0
:
tdLog
.
exit
(
"dnode:%d is not deployed"
%
(
self
.
index
))
...
...
@@ -348,12 +356,29 @@ class TDDnode:
print
(
cmd
)
blm3Cmd
=
"%s > /dev/null 2>&1 & "
%
(
blm3BinPath
)
if
os
.
system
(
blm3Cmd
)
!=
0
:
tdLog
.
exit
(
blm3Cmd
)
if
os
.
system
(
cmd
)
!=
0
:
tdLog
.
exit
(
cmd
)
self
.
running
=
1
tdLog
.
debug
(
"dnode:%d is running with %s "
%
(
self
.
index
,
cmd
))
def
stop
(
self
):
blm3ToBeKilled
=
"blm3"
blm3PsCmd
=
"ps -ef|grep -w %s| grep -v grep | awk '{print $2}'"
%
blm3ToBeKilled
blm3ProcessID
=
subprocess
.
check_output
(
blm3PsCmd
,
shell
=
True
).
decode
(
"utf-8"
)
while
(
blm3ProcessID
):
blm3KillCmd
=
"kill -INT %s > /dev/null 2>&1"
%
blm3ProcessID
os
.
system
(
blm3KillCmd
)
time
.
sleep
(
1
)
blm3ProcessID
=
subprocess
.
check_output
(
blm3PsCmd
,
shell
=
True
).
decode
(
"utf-8"
)
if
self
.
valgrind
==
0
:
toBeKilled
=
"taosd"
else
:
...
...
tests/script/jenkins/basic.txt
浏览文件 @
20343c13
...
...
@@ -15,17 +15,17 @@ cd ../../../debug; make
./test.sh -f general/field/smallint.sim
./test.sh -f general/field/tinyint.sim
./test.sh -f general/http/autocreate.sim
./test.sh -f general/http/chunked.sim
./test.sh -f general/http/gzip.sim
./test.sh -f general/http/restful.sim
./test.sh -f general/http/restful_insert.sim
./test.sh -f general/http/restful_limit.sim
./test.sh -f general/http/restful_full.sim
./test.sh -f general/http/prepare.sim
./test.sh -f general/http/telegraf.sim
./test.sh -f general/http/grafana_bug.sim
./test.sh -f general/http/grafana.sim
#
./test.sh -f general/http/autocreate.sim
#
./test.sh -f general/http/chunked.sim
#
./test.sh -f general/http/gzip.sim
#
./test.sh -f general/http/restful.sim
#
./test.sh -f general/http/restful_insert.sim
#
./test.sh -f general/http/restful_limit.sim
#
./test.sh -f general/http/restful_full.sim
#
./test.sh -f general/http/prepare.sim
#
./test.sh -f general/http/telegraf.sim
#
./test.sh -f general/http/grafana_bug.sim
#
./test.sh -f general/http/grafana.sim
./test.sh -f general/insert/basic.sim
./test.sh -f general/insert/insert_drop.sim
...
...
@@ -90,8 +90,8 @@ cd ../../../debug; make
./test.sh -f general/parser/function.sim
./test.sh -f unique/cluster/vgroup100.sim
./test.sh -f unique/http/admin.sim
./test.sh -f unique/http/opentsdb.sim
#
./test.sh -f unique/http/admin.sim
#
./test.sh -f unique/http/opentsdb.sim
./test.sh -f unique/import/replica2.sim
./test.sh -f unique/import/replica3.sim
...
...
@@ -142,8 +142,8 @@ cd ../../../debug; make
./test.sh -f unique/cluster/alter.sim
./test.sh -f unique/cluster/cache.sim
./test.sh -f unique/http/admin.sim
./test.sh -f unique/http/opentsdb.sim
#
./test.sh -f unique/http/admin.sim
#
./test.sh -f unique/http/opentsdb.sim
./test.sh -f unique/import/replica2.sim
./test.sh -f unique/import/replica3.sim
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录