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
...
...
@@ -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
)
...
...
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
...
...
@@ -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
...
...
@@ -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,7 +168,6 @@ function check_lib_path() {
echo
-e
"Check lib path:
\0
33[32mOK
\0
33[0m!"
}
function
check_header_path
()
{
# check all header
header_dir
=(
"taos.h"
"taoserror.h"
)
...
...
@@ -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
...
...
@@ -216,6 +221,7 @@ 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
||
:
`
...
...
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
*
||
:
packaging/deb/DEBIAN/prerm
浏览文件 @
20343c13
...
...
@@ -25,6 +25,7 @@ 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
}
/
*
||
:
...
...
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
...
...
packaging/tools/make_install.sh
浏览文件 @
20343c13
...
...
@@ -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
||
:
...
...
@@ -168,6 +176,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/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
||
:
...
...
@@ -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
...
...
@@ -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
...
...
@@ -532,6 +562,7 @@ function install_TDengine() {
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
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
...
...
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/
*
||
:
...
...
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
...
...
@@ -64,6 +64,14 @@ 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}'
)
...
...
@@ -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
||
:
...
...
@@ -261,8 +271,27 @@ function local_fqdn_check() {
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
}
/
*
...
...
@@ -427,6 +456,7 @@ function install_service() {
install_service_on_sysvinit
else
# manual start taosd
kill_blm3
kill_taosd
fi
}
...
...
@@ -450,6 +480,7 @@ function install_TDengine() {
install_bin
install_service
install_config
install_blm3_config
# Ask if to start the service
#echo
...
...
packaging/tools/preun.sh
浏览文件 @
20343c13
...
...
@@ -43,6 +43,13 @@ 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
...
...
@@ -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
...
...
@@ -54,6 +54,13 @@ 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
||
:
...
...
@@ -183,6 +191,7 @@ function clean_service() {
clean_service_on_sysvinit
else
# must manual stop taosd
kill_blm3
kill_taosd
kill_tarbitrator
fi
...
...
@@ -213,13 +222,13 @@ 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
}
"
...
...
packaging/tools/startPre.sh
浏览文件 @
20343c13
...
...
@@ -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"
...
...
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
...
...
@@ -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
...
...
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录