Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
向上的车轮
TDengine
提交
49fbb914
TDengine
项目概览
向上的车轮
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
49fbb914
编写于
10月 10, 2021
作者:
A
AlexDuan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revert "fixed apercentile coredump"
This reverts commit
bde46679
.
上级
bde46679
变更
17
展开全部
隐藏空白更改
内联
并排
Showing
17 changed file
with
10 addition
and
1933 deletion
+10
-1933
rpmworkroom/BUILDROOT/tdengine-2.1.3.0-3.el8.x86_64/usr/local/taos/bin/set_core.sh
...ngine-2.1.3.0-3.el8.x86_64/usr/local/taos/bin/set_core.sh
+0
-40
rpmworkroom/BUILDROOT/tdengine-2.1.3.0-3.el8.x86_64/usr/local/taos/bin/startPre.sh
...ngine-2.1.3.0-3.el8.x86_64/usr/local/taos/bin/startPre.sh
+0
-50
rpmworkroom/BUILDROOT/tdengine-2.1.3.0-3.el8.x86_64/usr/local/taos/bin/taos
...OOT/tdengine-2.1.3.0-3.el8.x86_64/usr/local/taos/bin/taos
+0
-0
rpmworkroom/BUILDROOT/tdengine-2.1.3.0-3.el8.x86_64/usr/local/taos/bin/taosd
...OT/tdengine-2.1.3.0-3.el8.x86_64/usr/local/taos/bin/taosd
+0
-0
rpmworkroom/BUILDROOT/tdengine-2.1.3.0-3.el8.x86_64/usr/local/taos/bin/taosd-dump-cfg.gdb
....1.3.0-3.el8.x86_64/usr/local/taos/bin/taosd-dump-cfg.gdb
+0
-144
rpmworkroom/BUILDROOT/tdengine-2.1.3.0-3.el8.x86_64/usr/local/taos/bin/taosdemo
...tdengine-2.1.3.0-3.el8.x86_64/usr/local/taos/bin/taosdemo
+0
-0
rpmworkroom/BUILDROOT/tdengine-2.1.3.0-3.el8.x86_64/usr/local/taos/bin/taosdump
...tdengine-2.1.3.0-3.el8.x86_64/usr/local/taos/bin/taosdump
+0
-0
rpmworkroom/BUILDROOT/tdengine-2.1.3.0-3.el8.x86_64/usr/local/taos/cfg/taos.cfg
...tdengine-2.1.3.0-3.el8.x86_64/usr/local/taos/cfg/taos.cfg
+0
-286
rpmworkroom/BUILDROOT/tdengine-2.1.3.0-3.el8.x86_64/usr/local/taos/driver/libtaos.so.2.1.3.0
...3.0-3.el8.x86_64/usr/local/taos/driver/libtaos.so.2.1.3.0
+0
-0
rpmworkroom/BUILDROOT/tdengine-2.1.3.0-3.el8.x86_64/usr/local/taos/include/taos.h
...engine-2.1.3.0-3.el8.x86_64/usr/local/taos/include/taos.h
+0
-179
rpmworkroom/BUILDROOT/tdengine-2.1.3.0-3.el8.x86_64/usr/local/taos/include/taoserror.h
...e-2.1.3.0-3.el8.x86_64/usr/local/taos/include/taoserror.h
+0
-460
rpmworkroom/BUILDROOT/tdengine-2.1.3.0-3.el8.x86_64/usr/local/taos/init.d/taosd
...tdengine-2.1.3.0-3.el8.x86_64/usr/local/taos/init.d/taosd
+0
-145
rpmworkroom/BUILDROOT/tdengine-2.1.3.0-3.el8.x86_64/usr/local/taos/script/post.sh
...engine-2.1.3.0-3.el8.x86_64/usr/local/taos/script/post.sh
+0
-496
rpmworkroom/BUILDROOT/tdengine-2.1.3.0-3.el8.x86_64/usr/local/taos/script/preun.sh
...ngine-2.1.3.0-3.el8.x86_64/usr/local/taos/script/preun.sh
+0
-122
src/query/inc/qHistogram.h
src/query/inc/qHistogram.h
+1
-1
src/query/src/qHistogram.c
src/query/src/qHistogram.c
+4
-5
src/query/tests/histogramTest.cpp
src/query/tests/histogramTest.cpp
+5
-5
未找到文件。
rpmworkroom/BUILDROOT/tdengine-2.1.3.0-3.el8.x86_64/usr/local/taos/bin/set_core.sh
已删除
100755 → 0
浏览文件 @
bde46679
#!/bin/bash
#
# This file is used to set config for core when taosd crash
# Color setting
RED
=
'\033[0;31m'
GREEN
=
'\033[1;32m'
GREEN_DARK
=
'\033[0;32m'
GREEN_UNDERLINE
=
'\033[4;32m'
NC
=
'\033[0m'
# set -e
# set -x
corePath
=
$1
csudo
=
""
if
command
-v
sudo
>
/dev/null
;
then
csudo
=
"sudo"
fi
if
[[
!
-n
${
corePath
}
]]
;
then
echo
-e
-n
"
${
GREEN
}
Please enter a file directory to save the coredump file
${
NC
}
:"
read
corePath
while
true
;
do
if
[[
!
-z
"
$corePath
"
]]
;
then
break
else
read
-p
"Please enter a file directory to save the coredump file:"
corePath
fi
done
fi
ulimit
-c
unlimited
${
csudo
}
sed
-i
'/ulimit -c unlimited/d'
/etc/profile
||
:
${
csudo
}
sed
-i
'$a\ulimit -c unlimited'
/etc/profile
||
:
source
/etc/profile
${
csudo
}
mkdir
-p
${
corePath
}
||
:
${
csudo
}
sysctl
-w
kernel.core_pattern
=
${
corePath
}
/core-%e-%p
||
:
${
csudo
}
echo
"
${
corePath
}
/core-%e-%p"
|
${
csudo
}
tee
/proc/sys/kernel/core_pattern
||
:
rpmworkroom/BUILDROOT/tdengine-2.1.3.0-3.el8.x86_64/usr/local/taos/bin/startPre.sh
已删除
100755 → 0
浏览文件 @
bde46679
#!/bin/bash
#
# if enable core dump, set start count to 3, disable core dump, set start count to 20.
# set -e
# set -x
taosd
=
/etc/systemd/system/taosd.service
line
=
`
grep
StartLimitBurst
${
taosd
}
`
num
=
${
line
##*=
}
#echo "burst num: ${num}"
startSeqFile
=
/usr/local/taos/.startSeq
recordFile
=
/usr/local/taos/.startRecord
startSeq
=
0
if
[[
!
-e
${
startSeqFile
}
]]
;
then
startSeq
=
0
else
startSeq
=
$(
cat
${
startSeqFile
}
)
fi
nextSeq
=
`
expr
$startSeq
+ 1
`
echo
"
${
nextSeq
}
"
>
${
startSeqFile
}
curTime
=
$(
date
"+%Y-%m-%d %H:%M:%S"
)
echo
"startSeq:
${
startSeq
}
startPre.sh exec
${
curTime
}
, burstCnt:
${
num
}
"
>>
${
recordFile
}
coreFlag
=
`
ulimit
-c
`
echo
"coreFlag:
${
coreFlag
}
"
>>
${
recordFile
}
if
[
${
coreFlag
}
=
"0"
]
;
then
#echo "core is 0"
if
[
${
num
}
!=
"20"
]
;
then
sed
-i
"s/^.*StartLimitBurst.*
$/
StartLimitBurst=20/"
${
taosd
}
systemctl daemon-reload
echo
"modify burst count from
${
num
}
to 20"
>>
${
recordFile
}
fi
fi
if
[
${
coreFlag
}
=
"unlimited"
]
;
then
#echo "core is unlimited"
if
[
${
num
}
!=
"3"
]
;
then
sed
-i
"s/^.*StartLimitBurst.*
$/
StartLimitBurst=3/"
${
taosd
}
systemctl daemon-reload
echo
"modify burst count from
${
num
}
to 3"
>>
${
recordFile
}
fi
fi
rpmworkroom/BUILDROOT/tdengine-2.1.3.0-3.el8.x86_64/usr/local/taos/bin/taos
已删除
100755 → 0
浏览文件 @
bde46679
文件已删除
rpmworkroom/BUILDROOT/tdengine-2.1.3.0-3.el8.x86_64/usr/local/taos/bin/taosd
已删除
100755 → 0
浏览文件 @
bde46679
文件已删除
rpmworkroom/BUILDROOT/tdengine-2.1.3.0-3.el8.x86_64/usr/local/taos/bin/taosd-dump-cfg.gdb
已删除
100644 → 0
浏览文件 @
bde46679
# Usage:
# sudo gdb -x ./taosd-dump-cfg.gdb
define attach_pidof
if $argc != 1
help attach_pidof
else
shell echo -e "\
set \$PID = "$(echo $(pidof $arg0) 0 | cut -d " " -f 1)"\n\
if \$PID > 0\n\
attach "$(pidof -s $arg0)"\n\
else\n\
print \"Process '"$arg0"' not found\"\n\
end" > /tmp/gdb.pidof
source /tmp/gdb.pidof
end
end
document attach_pidof
Attach to process by name
Usage: attach_pidof PROG_NAME
end
set $TAOS_CFG_VTYPE_INT8 = 0
set $TAOS_CFG_VTYPE_INT16 = 1
set $TAOS_CFG_VTYPE_INT32 = 2
set $TAOS_CFG_VTYPE_FLOAT = 3
set $TAOS_CFG_VTYPE_STRING = 4
set $TAOS_CFG_VTYPE_IPSTR = 5
set $TAOS_CFG_VTYPE_DIRECTORY = 6
set $TSDB_CFG_CTYPE_B_CONFIG = 1U
set $TSDB_CFG_CTYPE_B_SHOW = 2U
set $TSDB_CFG_CTYPE_B_LOG = 4U
set $TSDB_CFG_CTYPE_B_CLIENT = 8U
set $TSDB_CFG_CTYPE_B_OPTION = 16U
set $TSDB_CFG_CTYPE_B_NOT_PRINT = 32U
set $TSDB_CFG_PRINT_LEN = 53
define print_blank
if $argc == 1
set $blank_len = $arg0
while $blank_len > 0
printf "%s", " "
set $blank_len = $blank_len - 1
end
end
end
define dump_cfg
if $argc != 1
help dump_cfg
else
set $blen = $TSDB_CFG_PRINT_LEN - (int)strlen($arg0.option)
if $blen < 0
$blen = 0
end
#printf "%s: %d\n", "******blen: ", $blen
printf "%s: ", $arg0.option
print_blank $blen
if $arg0.valType == $TAOS_CFG_VTYPE_INT8
printf "%d\n", *((int8_t *) $arg0.ptr)
else
if $arg0.valType == $TAOS_CFG_VTYPE_INT16
printf "%d\n", *((int16_t *) $arg0.ptr)
else
if $arg0.valType == $TAOS_CFG_VTYPE_INT32
printf "%d\n", *((int32_t *) $arg0.ptr)
else
if $arg0.valType == $TAOS_CFG_VTYPE_FLOAT
printf "%f\n", *((float *) $arg0.ptr)
else
printf "%s\n", $arg0.ptr
end
end
end
end
end
end
document dump_cfg
Dump a cfg entry
Usage: dump_cfg cfg
end
set pagination off
attach_pidof taosd
set $idx=0
#print tsGlobalConfigNum
#set $end=$1
set $end=tsGlobalConfigNum
p "*=*=*=*=*=*=*=*=*= taos global config:"
#while ($idx .lt. $end)
while ($idx < $end)
# print tsGlobalConfig[$idx].option
set $cfg = tsGlobalConfig[$idx]
set $tsce = tscEmbedded
# p "1"
if ($tsce == 0)
if !($cfg.cfgType & $TSDB_CFG_CTYPE_B_CLIENT)
end
else
if $cfg.cfgType & $TSDB_CFG_CTYPE_B_NOT_PRINT
else
if !($cfg.cfgType & $TSDB_CFG_CTYPE_B_SHOW)
else
dump_cfg $cfg
end
end
end
set $idx=$idx+1
end
set $idx=0
p "*=*=*=*=*=*=*=*=*= taos local config:"
while ($idx < $end)
set $cfg = tsGlobalConfig[$idx]
set $tsce = tscEmbedded
if ($tsce == 0)
if !($cfg.cfgType & $TSDB_CFG_CTYPE_B_CLIENT)
end
else
if $cfg.cfgType & $TSDB_CFG_CTYPE_B_NOT_PRINT
else
if ($cfg.cfgType & $TSDB_CFG_CTYPE_B_SHOW)
else
dump_cfg $cfg
end
end
end
set $idx=$idx+1
end
detach
quit
rpmworkroom/BUILDROOT/tdengine-2.1.3.0-3.el8.x86_64/usr/local/taos/bin/taosdemo
已删除
100755 → 0
浏览文件 @
bde46679
文件已删除
rpmworkroom/BUILDROOT/tdengine-2.1.3.0-3.el8.x86_64/usr/local/taos/bin/taosdump
已删除
100755 → 0
浏览文件 @
bde46679
文件已删除
rpmworkroom/BUILDROOT/tdengine-2.1.3.0-3.el8.x86_64/usr/local/taos/cfg/taos.cfg
已删除
100644 → 0
浏览文件 @
bde46679
########################################################
# #
# TDengine Configuration #
# Any questions, please email support@taosdata.com #
# #
########################################################
# first fully qualified domain name (FQDN) for TDengine system
# firstEp hostname:6030
# local fully qualified domain name (FQDN)
# fqdn hostname
# first port number for the connection (12 continuous UDP/TCP port number are used)
# serverPort 6030
# log file's directory
# logDir /var/log/taos
# data file's directory
# dataDir /var/lib/taos
# temporary file's directory
# tempDir /tmp/
# the arbitrator's fully qualified domain name (FQDN) for TDengine system, for cluster only
# arbitrator arbitrator_hostname:6042
# number of threads per CPU core
# numOfThreadsPerCore 1.0
# number of threads to commit cache data
# numOfCommitThreads 4
# the proportion of total CPU cores available for query processing
# 2.0: the query threads will be set to double of the CPU cores.
# 1.0: all CPU cores are available for query processing [default].
# 0.5: only half of the CPU cores are available for query.
# 0.0: only one core available.
# ratioOfQueryCores 1.0
# the last_row/first/last aggregator will not change the original column name in the result fields
keepColumnName 1
# number of management nodes in the system
# numOfMnodes 3
# enable/disable backuping vnode directory when removing vnode
# vnodeBak 1
# enable/disable installation / usage report
# telemetryReporting 1
# enable/disable load balancing
# balance 1
# role for dnode. 0 - any, 1 - mnode, 2 - dnode
# role 0
# max timer control blocks
# maxTmrCtrl 512
# time interval of system monitor, seconds
# monitorInterval 30
# number of seconds allowed for a dnode to be offline, for cluster only
# offlineThreshold 864000
# RPC re-try timer, millisecond
# rpcTimer 300
# RPC maximum time for ack, seconds.
# rpcMaxTime 600
# time interval of dnode status reporting to mnode, seconds, for cluster only
# statusInterval 1
# time interval of heart beat from shell to dnode, seconds
# shellActivityTimer 3
# minimum sliding window time, milli-second
# minSlidingTime 10
# minimum time window, milli-second
# minIntervalTime 10
# maximum delay before launching a stream computation, milli-second
# maxStreamCompDelay 20000
# maximum delay before launching a stream computation for the first time, milli-second
# maxFirstStreamCompDelay 10000
# retry delay when a stream computation fails, milli-second
# retryStreamCompDelay 10
# the delayed time for launching a stream computation, from 0.1(default, 10% of whole computing time window) to 0.9
# streamCompDelayRatio 0.1
# max number of vgroups per db, 0 means configured automatically
# maxVgroupsPerDb 0
# max number of tables per vnode
# maxTablesPerVnode 1000000
# cache block size (Mbyte)
# cache 16
# number of cache blocks per vnode
# blocks 6
# number of days per DB file
# days 10
# number of days to keep DB file
# keep 3650
# minimum rows of records in file block
# minRows 100
# maximum rows of records in file block
# maxRows 4096
# the number of acknowledgments required for successful data writing
# quorum 1
# enable/disable compression
# comp 2
# write ahead log (WAL) level, 0: no wal; 1: write wal, but no fysnc; 2: write wal, and call fsync
# walLevel 1
# if walLevel is set to 2, the cycle of fsync being executed, if set to 0, fsync is called right away
# fsync 3000
# number of replications, for cluster only
# replica 1
# the compressed rpc message, option:
# -1 (no compression)
# 0 (all message compressed),
# > 0 (rpc message body which larger than this value will be compressed)
# compressMsgSize -1
# max length of an SQL
# maxSQLLength 65480
# max length of WildCards
# maxWildCardsLength 100
# the maximum number of records allowed for super table time sorting
# maxNumOfOrderedRes 100000
# system time zone
# timezone Asia/Shanghai (CST, +0800)
# system time zone (for windows 10)
# timezone UTC-8
# system locale
# locale en_US.UTF-8
# default system charset
# charset UTF-8
# max number of connections allowed in dnode
# maxShellConns 5000
# max number of connections allowed in client
# maxConnections 5000
# stop writing logs when the disk size of the log folder is less than this value
# minimalLogDirGB 0.1
# stop writing temporary files when the disk size of the tmp folder is less than this value
# minimalTmpDirGB 0.1
# if disk free space is less than this value, taosd service exit directly within startup process
# minimalDataDirGB 0.1
# One mnode is equal to the number of vnode consumed
# mnodeEqualVnodeNum 4
# enbale/disable http service
# http 1
# enable/disable system monitor
# monitor 1
# enable/disable recording the SQL statements via restful interface
# httpEnableRecordSql 0
# number of threads used to process http requests
# httpMaxThreads 2
# maximum number of rows returned by the restful interface
# restfulRowLimit 10240
# The following parameter is used to limit the maximum number of lines in log files.
# max number of lines per log filters
# numOfLogLines 10000000
# enable/disable async log
# asyncLog 1
# time of keeping log files, days
# logKeepDays 0
# The following parameters are used for debug purpose only.
# debugFlag 8 bits mask: FILE-SCREEN-UNUSED-HeartBeat-DUMP-TRACE_WARN-ERROR
# 131: output warning and error
# 135: output debug, warning and error
# 143: output trace, debug, warning and error to log
# 199: output debug, warning and error to both screen and file
# 207: output trace, debug, warning and error to both screen and file
# debug flag for all log type, take effect when non-zero value
# debugFlag 0
# debug flag for meta management messages
# mDebugFlag 135
# debug flag for dnode messages
# dDebugFlag 135
# debug flag for sync module
# sDebugFlag 135
# debug flag for WAL
# wDebugFlag 135
# debug flag for SDB
# sdbDebugFlag 135
# debug flag for RPC
# rpcDebugFlag 131
# debug flag for TAOS TIMER
# tmrDebugFlag 131
# debug flag for TDengine client
# cDebugFlag 131
# debug flag for JNI
# jniDebugFlag 131
# debug flag for storage
# uDebugFlag 131
# debug flag for http server
# httpDebugFlag 131
# debug flag for monitor
# monDebugFlag 131
# debug flag for query
# qDebugFlag 131
# debug flag for vnode
# vDebugFlag 131
# debug flag for TSDB
# tsdbDebugFlag 131
# debug flag for continue query
# cqDebugFlag 131
# enable/disable recording the SQL in taos client
# enableRecordSql 0
# generate core file when service crash
# enableCoreFile 1
# maximum display width of binary and nchar fields in the shell. The parts exceeding this limit will be hidden
# maxBinaryDisplayWidth 30
# enable/disable stream (continuous query)
# stream 1
# in retrieve blocking model, only in 50% query threads will be used in query processing in dnode
# retrieveBlockingModel 0
# the maximum allowed query buffer size in MB during query processing for each data node
# -1 no limit (default)
# 0 no query allowed, queries are disabled
# queryBufferSize -1
rpmworkroom/BUILDROOT/tdengine-2.1.3.0-3.el8.x86_64/usr/local/taos/driver/libtaos.so.2.1.3.0
已删除
100755 → 0
浏览文件 @
bde46679
文件已删除
rpmworkroom/BUILDROOT/tdengine-2.1.3.0-3.el8.x86_64/usr/local/taos/include/taos.h
已删除
100644 → 0
浏览文件 @
bde46679
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TDENGINE_TAOS_H
#define TDENGINE_TAOS_H
#include <stdint.h>
#include <stdbool.h>
#ifdef __cplusplus
extern
"C"
{
#endif
typedef
void
TAOS
;
typedef
void
TAOS_STMT
;
typedef
void
TAOS_RES
;
typedef
void
TAOS_STREAM
;
typedef
void
TAOS_SUB
;
typedef
void
**
TAOS_ROW
;
// Data type definition
#define TSDB_DATA_TYPE_NULL 0 // 1 bytes
#define TSDB_DATA_TYPE_BOOL 1 // 1 bytes
#define TSDB_DATA_TYPE_TINYINT 2 // 1 byte
#define TSDB_DATA_TYPE_SMALLINT 3 // 2 bytes
#define TSDB_DATA_TYPE_INT 4 // 4 bytes
#define TSDB_DATA_TYPE_BIGINT 5 // 8 bytes
#define TSDB_DATA_TYPE_FLOAT 6 // 4 bytes
#define TSDB_DATA_TYPE_DOUBLE 7 // 8 bytes
#define TSDB_DATA_TYPE_BINARY 8 // string
#define TSDB_DATA_TYPE_TIMESTAMP 9 // 8 bytes
#define TSDB_DATA_TYPE_NCHAR 10 // unicode string
#define TSDB_DATA_TYPE_UTINYINT 11 // 1 byte
#define TSDB_DATA_TYPE_USMALLINT 12 // 2 bytes
#define TSDB_DATA_TYPE_UINT 13 // 4 bytes
#define TSDB_DATA_TYPE_UBIGINT 14 // 8 bytes
typedef
enum
{
TSDB_OPTION_LOCALE
,
TSDB_OPTION_CHARSET
,
TSDB_OPTION_TIMEZONE
,
TSDB_OPTION_CONFIGDIR
,
TSDB_OPTION_SHELL_ACTIVITY_TIMER
,
TSDB_MAX_OPTIONS
}
TSDB_OPTION
;
typedef
struct
taosField
{
char
name
[
65
];
uint8_t
type
;
int16_t
bytes
;
}
TAOS_FIELD
;
#ifdef _TD_GO_DLL_
#define DLL_EXPORT __declspec(dllexport)
#else
#define DLL_EXPORT
#endif
DLL_EXPORT
int
taos_init
();
DLL_EXPORT
void
taos_cleanup
(
void
);
DLL_EXPORT
int
taos_options
(
TSDB_OPTION
option
,
const
void
*
arg
,
...);
DLL_EXPORT
TAOS
*
taos_connect
(
const
char
*
ip
,
const
char
*
user
,
const
char
*
pass
,
const
char
*
db
,
uint16_t
port
);
DLL_EXPORT
TAOS
*
taos_connect_auth
(
const
char
*
ip
,
const
char
*
user
,
const
char
*
auth
,
const
char
*
db
,
uint16_t
port
);
DLL_EXPORT
void
taos_close
(
TAOS
*
taos
);
const
char
*
taos_data_type
(
int
type
);
typedef
struct
TAOS_BIND
{
int
buffer_type
;
void
*
buffer
;
uintptr_t
buffer_length
;
// unused
uintptr_t
*
length
;
int
*
is_null
;
int
is_unsigned
;
// unused
int
*
error
;
// unused
union
{
int64_t
ts
;
int8_t
b
;
int8_t
v1
;
int16_t
v2
;
int32_t
v4
;
int64_t
v8
;
float
f4
;
double
f8
;
unsigned
char
*
bin
;
char
*
nchar
;
}
u
;
unsigned
int
allocated
;
}
TAOS_BIND
;
typedef
struct
TAOS_MULTI_BIND
{
int
buffer_type
;
void
*
buffer
;
uintptr_t
buffer_length
;
int32_t
*
length
;
char
*
is_null
;
int
num
;
}
TAOS_MULTI_BIND
;
DLL_EXPORT
TAOS_STMT
*
taos_stmt_init
(
TAOS
*
taos
);
DLL_EXPORT
int
taos_stmt_prepare
(
TAOS_STMT
*
stmt
,
const
char
*
sql
,
unsigned
long
length
);
DLL_EXPORT
int
taos_stmt_set_tbname_tags
(
TAOS_STMT
*
stmt
,
const
char
*
name
,
TAOS_BIND
*
tags
);
DLL_EXPORT
int
taos_stmt_set_tbname
(
TAOS_STMT
*
stmt
,
const
char
*
name
);
DLL_EXPORT
int
taos_stmt_set_sub_tbname
(
TAOS_STMT
*
stmt
,
const
char
*
name
);
DLL_EXPORT
int
taos_stmt_is_insert
(
TAOS_STMT
*
stmt
,
int
*
insert
);
DLL_EXPORT
int
taos_stmt_num_params
(
TAOS_STMT
*
stmt
,
int
*
nums
);
DLL_EXPORT
int
taos_stmt_get_param
(
TAOS_STMT
*
stmt
,
int
idx
,
int
*
type
,
int
*
bytes
);
DLL_EXPORT
int
taos_stmt_bind_param
(
TAOS_STMT
*
stmt
,
TAOS_BIND
*
bind
);
DLL_EXPORT
int
taos_stmt_bind_param_batch
(
TAOS_STMT
*
stmt
,
TAOS_MULTI_BIND
*
bind
);
DLL_EXPORT
int
taos_stmt_bind_single_param_batch
(
TAOS_STMT
*
stmt
,
TAOS_MULTI_BIND
*
bind
,
int
colIdx
);
DLL_EXPORT
int
taos_stmt_add_batch
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
int
taos_stmt_execute
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
TAOS_RES
*
taos_stmt_use_result
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
int
taos_stmt_close
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
char
*
taos_stmt_errstr
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
TAOS_RES
*
taos_query
(
TAOS
*
taos
,
const
char
*
sql
);
DLL_EXPORT
TAOS_ROW
taos_fetch_row
(
TAOS_RES
*
res
);
DLL_EXPORT
int
taos_result_precision
(
TAOS_RES
*
res
);
// get the time precision of result
DLL_EXPORT
void
taos_free_result
(
TAOS_RES
*
res
);
DLL_EXPORT
int
taos_field_count
(
TAOS_RES
*
res
);
DLL_EXPORT
int
taos_num_fields
(
TAOS_RES
*
res
);
DLL_EXPORT
int
taos_affected_rows
(
TAOS_RES
*
res
);
DLL_EXPORT
TAOS_FIELD
*
taos_fetch_fields
(
TAOS_RES
*
res
);
DLL_EXPORT
int
taos_select_db
(
TAOS
*
taos
,
const
char
*
db
);
DLL_EXPORT
int
taos_print_row
(
char
*
str
,
TAOS_ROW
row
,
TAOS_FIELD
*
fields
,
int
num_fields
);
DLL_EXPORT
void
taos_stop_query
(
TAOS_RES
*
res
);
DLL_EXPORT
bool
taos_is_null
(
TAOS_RES
*
res
,
int32_t
row
,
int32_t
col
);
DLL_EXPORT
int
taos_fetch_block
(
TAOS_RES
*
res
,
TAOS_ROW
*
rows
);
DLL_EXPORT
int
taos_validate_sql
(
TAOS
*
taos
,
const
char
*
sql
);
DLL_EXPORT
int
*
taos_fetch_lengths
(
TAOS_RES
*
res
);
// TAOS_RES *taos_list_tables(TAOS *mysql, const char *wild);
// TAOS_RES *taos_list_dbs(TAOS *mysql, const char *wild);
// TODO: the return value should be `const`
DLL_EXPORT
char
*
taos_get_server_info
(
TAOS
*
taos
);
DLL_EXPORT
char
*
taos_get_client_info
();
DLL_EXPORT
char
*
taos_errstr
(
TAOS_RES
*
tres
);
DLL_EXPORT
int
taos_errno
(
TAOS_RES
*
tres
);
DLL_EXPORT
void
taos_query_a
(
TAOS
*
taos
,
const
char
*
sql
,
void
(
*
fp
)(
void
*
param
,
TAOS_RES
*
,
int
code
),
void
*
param
);
DLL_EXPORT
void
taos_fetch_rows_a
(
TAOS_RES
*
res
,
void
(
*
fp
)(
void
*
param
,
TAOS_RES
*
,
int
numOfRows
),
void
*
param
);
//DLL_EXPORT void taos_fetch_row_a(TAOS_RES *res, void (*fp)(void *param, TAOS_RES *, TAOS_ROW row), void *param);
typedef
void
(
*
TAOS_SUBSCRIBE_CALLBACK
)(
TAOS_SUB
*
tsub
,
TAOS_RES
*
res
,
void
*
param
,
int
code
);
DLL_EXPORT
TAOS_SUB
*
taos_subscribe
(
TAOS
*
taos
,
int
restart
,
const
char
*
topic
,
const
char
*
sql
,
TAOS_SUBSCRIBE_CALLBACK
fp
,
void
*
param
,
int
interval
);
DLL_EXPORT
TAOS_RES
*
taos_consume
(
TAOS_SUB
*
tsub
);
DLL_EXPORT
void
taos_unsubscribe
(
TAOS_SUB
*
tsub
,
int
keepProgress
);
DLL_EXPORT
TAOS_STREAM
*
taos_open_stream
(
TAOS
*
taos
,
const
char
*
sql
,
void
(
*
fp
)(
void
*
param
,
TAOS_RES
*
,
TAOS_ROW
row
),
int64_t
stime
,
void
*
param
,
void
(
*
callback
)(
void
*
));
DLL_EXPORT
void
taos_close_stream
(
TAOS_STREAM
*
tstr
);
DLL_EXPORT
int
taos_load_table_info
(
TAOS
*
taos
,
const
char
*
tableNameList
);
DLL_EXPORT
int
taos_insert_lines
(
TAOS
*
taos
,
char
*
lines
[],
int
numLines
);
#ifdef __cplusplus
}
#endif
#endif
rpmworkroom/BUILDROOT/tdengine-2.1.3.0-3.el8.x86_64/usr/local/taos/include/taoserror.h
已删除
100644 → 0
浏览文件 @
bde46679
此差异已折叠。
点击以展开。
rpmworkroom/BUILDROOT/tdengine-2.1.3.0-3.el8.x86_64/usr/local/taos/init.d/taosd
已删除
100644 → 0
浏览文件 @
bde46679
#!/bin/bash
#
# taosd This shell script takes care of starting and stopping TDEngine.
#
# chkconfig: 2345 99 01
# description: TDEngine is a districuted, scalable, high-performance Time Series Database
# (TSDB). More than just a pure database, TDEngine also provides the ability
# to do stream computing, aggregation etc.
#
#
### BEGIN INIT INFO
# Provides: taosd
# Required-Start: $network $local_fs $remote_fs
# Required-Stop: $network $local_fs $remote_fs
# Short-Description: start and stop taosd
# Description: TDEngine is a districuted, scalable, high-performance Time Series Database
# (TSDB). More than just a pure database, TDEngine also provides the ability
# to do stream computing, aggregation etc.
### END INIT INFO
# Source init functions
.
/etc/init.d/functions
# Maximum number of open files
MAX_OPEN_FILES
=
65535
# Default program options
NAME
=
taosd
PROG
=
/usr/local/taos/bin/taosd
USER
=
root
GROUP
=
root
# Default directories
LOCK_DIR
=
/var/lock/subsys
PID_DIR
=
/var/run/
$NAME
# Set file names
LOCK_FILE
=
$LOCK_DIR
/
$NAME
PID_FILE
=
$PID_DIR
/
$NAME
.pid
[
-e
$PID_DIR
]
||
mkdir
-p
$PID_DIR
PROG_OPTS
=
""
start
()
{
echo
-n
"Starting
${
NAME
}
: "
# check identity
curid
=
"
`
id
-u
-n
`
"
if
[
"
$curid
"
!=
root
]
&&
[
"
$curid
"
!=
"
$USER
"
]
;
then
echo
"Must be run as root or
$USER
, but was run as
$curid
"
return
1
fi
# Sets the maximum number of open file descriptors allowed.
ulimit
-n
$MAX_OPEN_FILES
curulimit
=
"
`
ulimit
-n
`
"
if
[
"
$curulimit
"
-lt
$MAX_OPEN_FILES
]
;
then
echo
"'ulimit -n' must be greater than or equal to
$MAX_OPEN_FILES
, is
$curulimit
"
return
1
fi
if
[
"
`
id
-u
-n
`
"
==
root
]
;
then
# Changes the owner of the lock, and the pid files to allow
# non-root OpenTSDB daemons to run /usr/share/opentsdb/bin/opentsdb_restart.py.
touch
$LOCK_FILE
&&
chown
$USER
:
$GROUP
$LOCK_FILE
touch
$PID_FILE
&&
chown
$USER
:
$GROUP
$PID_FILE
daemon
--user
$USER
--pidfile
$PID_FILE
"
$PROG
$PROG_OPTS
&> /dev/null &"
else
# Don't have to change user.
daemon
--pidfile
$PID_FILE
"
$PROG
$PROG_OPTS
&> /dev/null &"
fi
retval
=
$?
sleep
2
echo
[
$retval
-eq
0
]
&&
(
findproc
>
$PID_FILE
&&
touch
$LOCK_FILE
)
return
$retval
}
stop
()
{
echo
-n
"Stopping
${
NAME
}
: "
killproc
-p
$PID_FILE
$NAME
retval
=
$?
echo
# Non-root users don't have enough permission to remove pid and lock files.
# So, the opentsdb_restart.py cannot get rid of the files, and the command
# "service opentsdb status" will complain about the existing pid file.
# Makes the pid file empty.
echo
>
$PID_FILE
[
$retval
-eq
0
]
&&
(
rm
-f
$PID_FILE
&&
rm
-f
$LOCK_FILE
)
return
$retval
}
restart
()
{
stop
start
}
reload
()
{
restart
}
force_reload
()
{
restart
}
rh_status
()
{
# run checks to determine if the service is running or use generic status
status
-p
$PID_FILE
-l
$LOCK_FILE
$NAME
}
rh_status_q
()
{
rh_status
>
/dev/null 2>&1
}
case
"
$1
"
in
start
)
rh_status_q
&&
exit
0
$1
;;
stop
)
rh_status_q
||
exit
0
$1
;;
restart
)
$1
;;
reload
)
rh_status_q
||
exit
7
$1
;;
force-reload
)
force_reload
;;
status
)
rh_status
;;
condrestart|try-restart
)
rh_status_q
||
exit
0
restart
;;
*
)
echo
"Usage:
$0
{start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
exit
2
esac
exit
$?
rpmworkroom/BUILDROOT/tdengine-2.1.3.0-3.el8.x86_64/usr/local/taos/script/post.sh
已删除
100755 → 0
浏览文件 @
bde46679
#!/bin/bash
#
# 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
iplist
=
""
serverFqdn
=
""
# -----------------------Variables definition---------------------
script_dir
=
$(
dirname
$(
readlink
-f
"
$0
"
))
# Dynamic directory
data_dir
=
"/var/lib/taos"
log_dir
=
"/var/log/taos"
data_link_dir
=
"/usr/local/taos/data"
log_link_dir
=
"/usr/local/taos/log"
install_main_dir
=
"/usr/local/taos"
# static directory
cfg_dir
=
"/usr/local/taos/cfg"
bin_dir
=
"/usr/local/taos/bin"
lib_dir
=
"/usr/local/taos/driver"
init_d_dir
=
"/usr/local/taos/init.d"
inc_dir
=
"/usr/local/taos/include"
cfg_install_dir
=
"/etc/taos"
bin_link_dir
=
"/usr/bin"
lib_link_dir
=
"/usr/lib"
lib64_link_dir
=
"/usr/lib64"
inc_link_dir
=
"/usr/include"
service_config_dir
=
"/etc/systemd/system"
# Color setting
RED
=
'\033[0;31m'
GREEN
=
'\033[1;32m'
GREEN_DARK
=
'\033[0;32m'
GREEN_UNDERLINE
=
'\033[4;32m'
NC
=
'\033[0m'
csudo
=
""
if
command
-v
sudo
>
/dev/null
;
then
csudo
=
"sudo"
fi
initd_mod
=
0
service_mod
=
2
if
pidof systemd &> /dev/null
;
then
service_mod
=
0
elif
$(
which service &> /dev/null
)
;
then
service_mod
=
1
service_config_dir
=
"/etc/init.d"
if
$(
which chkconfig &> /dev/null
)
;
then
initd_mod
=
1
elif
$(
which insserv &> /dev/null
)
;
then
initd_mod
=
2
elif
$(
which update-rc.d &> /dev/null
)
;
then
initd_mod
=
3
else
service_mod
=
2
fi
else
service_mod
=
2
fi
function
kill_taosd
()
{
# ${csudo} pkill -f taosd || :
pid
=
$(
ps
-ef
|
grep
"taosd"
|
grep
-v
"grep"
|
awk
'{print $2}'
)
if
[
-n
"
$pid
"
]
;
then
${
csudo
}
kill
-9
$pid
||
:
fi
}
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
}
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
||
:
fi
}
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
}
/taosdemo
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/taosdump
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/rmtaos
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/set_core
||
:
${
csudo
}
chmod
0555
${
bin_dir
}
/
*
#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
}
/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
||
:
}
function
add_newHostname_to_hosts
()
{
localIp
=
"127.0.0.1"
OLD_IFS
=
"
$IFS
"
IFS
=
" "
iphost
=
$(
cat
/etc/hosts |
grep
$1
|
awk
'{print $1}'
)
arr
=(
$iphost
)
IFS
=
"
$OLD_IFS
"
for
s
in
${
arr
[@]
}
do
if
[[
"
$s
"
==
"
$localIp
"
]]
;
then
return
fi
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
while
true
;
do
if
[[
!
-z
"
$newHostname
"
&&
"
$newHostname
"
!=
"localhost"
]]
;
then
break
else
read
-p
"Please enter one hostname(must not be 'localhost'):"
newHostname
fi
done
${
csudo
}
hostname
$newHostname
||
:
retval
=
`
echo
$?
`
if
[[
$retval
!=
0
]]
;
then
echo
echo
"set hostname fail!"
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
if
[[
-e
/etc/hosts
]]
;
then
add_newHostname_to_hosts
$newHostname
fi
}
function
is_correct_ipaddr
()
{
newIp
=
$1
OLD_IFS
=
"
$IFS
"
IFS
=
" "
arr
=(
$iplist
)
IFS
=
"
$OLD_IFS
"
for
s
in
${
arr
[@]
}
do
if
[[
"
$s
"
==
"
$newIp
"
]]
;
then
return
0
fi
done
return
1
}
function
set_ipAsFqdn
()
{
iplist
=
$(
ip address |grep inet |grep
-v
inet6 |grep
-v
127.0.0.1 |awk
'{print $2}'
|awk
-F
"/"
'{print $1}'
)
||
:
if
[
-z
"
$iplist
"
]
;
then
iplist
=
$(
ifconfig |grep inet |grep
-v
inet6 |grep
-v
127.0.0.1 |awk
'{print $2}'
|awk
-F
":"
'{print $2}'
)
||
:
fi
if
[
-z
"
$iplist
"
]
;
then
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
serverFqdn
=
$localFqdn
echo
return
fi
echo
-e
-n
"
${
GREEN
}
Please choose an IP from local IP list
${
NC
}
:"
echo
echo
-e
-n
"
${
GREEN
}
$iplist
${
NC
}
"
echo
echo
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
# 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
serverFqdn
=
$localFqdn
break
fi
else
read
-p
"Please choose an IP from local IP list:"
localFqdn
fi
done
}
function
local_fqdn_check
()
{
#serverFqdn=$(hostname)
echo
echo
-e
-n
"System hostname is:
${
GREEN
}
$serverFqdn
${
NC
}
"
echo
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
done
fi
}
function
install_config
()
{
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
local_fqdn_check
# restore the backup standard input, and turn off 6
exec
0<&6 6<&-
${
csudo
}
mv
${
cfg_dir
}
/taos.cfg
${
cfg_dir
}
/taos.cfg.org
${
csudo
}
ln
-s
${
cfg_install_dir
}
/taos.cfg
${
cfg_dir
}
#FQDN_FORMAT="(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)"
#FQDN_FORMAT="(:[1-6][0-9][0-9][0-9][0-9]$)"
#PORT_FORMAT="(/[1-6][0-9][0-9][0-9][0-9]?/)"
#FQDN_PATTERN=":[0-9]{1,5}$"
# first full-qualified domain name (FQDN) for TDengine cluster system
echo
echo
-e
-n
"
${
GREEN
}
Enter FQDN:port (like h1.taosdata.com:6030) of an existing TDengine cluster node to join
${
NC
}
"
echo
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
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
break
#else
# read -p "Please enter the correct FQDN:port: " firstEp
#fi
else
break
fi
done
# 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-]+)+$"
echo
echo
-e
-n
"
${
GREEN
}
Enter your email address for priority support or enter empty to skip
${
NC
}
: "
read
emailAddr
while
true
;
do
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"
${
csudo
}
bash
-c
"echo
$emailAddr
>
${
email_file
}
"
break
#else
# read -p "Please enter the correct email address: " emailAddr
#fi
else
break
fi
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 || :
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
${
csudo
}
insserv
-r
taosd
||
:
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
}
function
install_service_on_sysvinit
()
{
clean_service_on_sysvinit
sleep
1
# 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
||
:
elif
((
${
initd_mod
}
==
2
))
;
then
${
csudo
}
insserv taosd
||
:
${
csudo
}
insserv
-d
taosd
||
:
elif
((
${
initd_mod
}
==
3
))
;
then
${
csudo
}
update-rc.d taosd defaults
||
:
fi
}
function
clean_service_on_systemd
()
{
taosd_service_config
=
"
${
service_config_dir
}
/taosd.service"
# taosd service already is stoped before install in preinst script
#if systemctl is-active --quiet taosd; then
# echo "TDengine is running, stopping it..."
# ${csudo} systemctl stop taosd &> /dev/null || echo &> /dev/null
#fi
${
csudo
}
systemctl disable taosd &> /dev/null
||
echo
&> /dev/null
${
csudo
}
rm
-f
${
taosd_service_config
}
}
# taos:2345:respawn:/etc/init.d/taosd start
function
install_service_on_systemd
()
{
clean_service_on_systemd
taosd_service_config
=
"
${
service_config_dir
}
/taosd.service"
${
csudo
}
bash
-c
"echo '[Unit]' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'Description=TDengine server service' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'After=network-online.target' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'Wants=network-online.target' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo '[Service]' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'Type=simple' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'ExecStart=/usr/bin/taosd' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'ExecStartPre=/usr/local/taos/bin/startPre.sh' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'TimeoutStopSec=1000000s' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'LimitNOFILE=infinity' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'LimitNPROC=infinity' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'LimitCORE=infinity' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'TimeoutStartSec=0' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'StandardOutput=null' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'Restart=always' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'StartLimitBurst=3' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'StartLimitInterval=60s' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo '[Install]' >>
${
taosd_service_config
}
"
${
csudo
}
bash
-c
"echo 'WantedBy=multi-user.target' >>
${
taosd_service_config
}
"
${
csudo
}
systemctl
enable
taosd
}
function
install_service
()
{
if
((
${
service_mod
}
==
0
))
;
then
install_service_on_systemd
elif
((
${
service_mod
}
==
1
))
;
then
install_service_on_sysvinit
else
# manual start taosd
kill_taosd
fi
}
function
install_TDengine
()
{
echo
-e
"
${
GREEN
}
Start to install TDengine...
${
NC
}
"
#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
}
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
# Ask if to start the service
#echo
#echo -e "\033[44;32;1mTDengine is installed successfully!${NC}"
echo
echo
-e
"
${
GREEN_DARK
}
To configure TDengine
${
NC
}
: edit /etc/taos/taos.cfg"
if
((
${
service_mod
}
==
0
))
;
then
echo
-e
"
${
GREEN_DARK
}
To start TDengine
${
NC
}
:
${
csudo
}
systemctl start taosd
${
NC
}
"
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
echo
-e
"
${
GREEN_DARK
}
To start TDengine
${
NC
}
: ./taosd
${
NC
}
"
fi
if
[
!
-z
"
$firstEp
"
]
;
then
tmpFqdn
=
${
firstEp
%%
:
*
}
substr
=
":"
if
[[
$firstEp
=
~
$substr
]]
;
then
tmpPort
=
${
firstEp
#*
:
}
else
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
elif
[
!
-z
"
$serverFqdn
"
]
;
then
echo
-e
"
${
GREEN_DARK
}
To access TDengine
${
NC
}
: taos -h
$serverFqdn
${
GREEN_DARK
}
to login into TDengine server
${
NC
}
"
echo
fi
echo
echo
-e
"
\0
33[44;32;1mTDengine is installed successfully!
${
NC
}
"
}
## ==============================Main program starts from here============================
serverFqdn
=
$(
hostname
)
install_TDengine
rpmworkroom/BUILDROOT/tdengine-2.1.3.0-3.el8.x86_64/usr/local/taos/script/preun.sh
已删除
100755 → 0
浏览文件 @
bde46679
#!/bin/bash
#
# Script to stop the service and uninstall TSDB
RED
=
'\033[0;31m'
GREEN
=
'\033[1;32m'
NC
=
'\033[0m'
bin_link_dir
=
"/usr/bin"
lib_link_dir
=
"/usr/lib"
lib64_link_dir
=
"/usr/lib64"
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"
service_config_dir
=
"/etc/systemd/system"
taos_service_name
=
"taosd"
csudo
=
""
if
command
-v
sudo
>
/dev/null
;
then
csudo
=
"sudo"
fi
initd_mod
=
0
service_mod
=
2
if
pidof systemd &> /dev/null
;
then
service_mod
=
0
elif
$(
which service &> /dev/null
)
;
then
service_mod
=
1
service_config_dir
=
"/etc/init.d"
if
$(
which chkconfig &> /dev/null
)
;
then
initd_mod
=
1
elif
$(
which insserv &> /dev/null
)
;
then
initd_mod
=
2
elif
$(
which update-rc.d &> /dev/null
)
;
then
initd_mod
=
3
else
service_mod
=
2
fi
else
service_mod
=
2
fi
function
kill_taosd
()
{
pid
=
$(
ps
-ef
|
grep
"taosd"
|
grep
-v
"grep"
|
awk
'{print $2}'
)
if
[
-n
"
$pid
"
]
;
then
${
csudo
}
kill
-9
$pid
||
:
fi
}
function
clean_service_on_systemd
()
{
taosd_service_config
=
"
${
service_config_dir
}
/
${
taos_service_name
}
.service"
if
systemctl is-active
--quiet
${
taos_service_name
}
;
then
echo
"TDengine taosd is running, stopping it..."
${
csudo
}
systemctl stop
${
taos_service_name
}
&> /dev/null
||
echo
&> /dev/null
fi
${
csudo
}
systemctl disable
${
taos_service_name
}
&> /dev/null
||
echo
&> /dev/null
${
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 || :
if
pidof taosd &> /dev/null
;
then
echo
"TDengine taosd is running, stopping it..."
${
csudo
}
service taosd stop
||
:
fi
if
((
${
initd_mod
}
==
1
))
;
then
${
csudo
}
chkconfig
--del
taosd
||
:
elif
((
${
initd_mod
}
==
2
))
;
then
${
csudo
}
insserv
-r
taosd
||
:
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
}
function
clean_service
()
{
if
((
${
service_mod
}
==
0
))
;
then
clean_service_on_systemd
elif
((
${
service_mod
}
==
1
))
;
then
clean_service_on_sysvinit
else
# must manual stop taosd
kill_taosd
fi
}
# Stop service and disable booting start.
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
}
/taosdemo
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/taosdump
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/set_core
||
:
${
csudo
}
rm
-f
${
cfg_link_dir
}
/
*
||
:
${
csudo
}
rm
-f
${
inc_link_dir
}
/taos.h
||
:
${
csudo
}
rm
-f
${
inc_link_dir
}
/taoserror.h
||
:
${
csudo
}
rm
-f
${
lib_link_dir
}
/libtaos.
*
||
:
${
csudo
}
rm
-f
${
lib64_link_dir
}
/libtaos.
*
||
:
${
csudo
}
rm
-f
${
log_link_dir
}
||
:
${
csudo
}
rm
-f
${
data_link_dir
}
||
:
if
((
${
service_mod
}
==
2
))
;
then
kill_taosd
fi
echo
-e
"
${
GREEN
}
TDengine is removed successfully!
${
NC
}
"
src/query/inc/qHistogram.h
浏览文件 @
49fbb914
...
...
@@ -67,7 +67,7 @@ void tHistogramDestroy(SHistogramInfo** pHisto);
void
tHistogramPrint
(
SHistogramInfo
*
pHisto
);
int32_t
histoBinarySearch
(
SHistBin
*
pEntry
,
int32_t
len
,
double
val
,
int32_t
maxEntries
);
int32_t
histoBinarySearch
(
SHistBin
*
pEntry
,
int32_t
len
,
double
val
);
SHeapEntry
*
tHeapCreate
(
int32_t
numOfEntries
);
void
tHeapSort
(
SHeapEntry
*
pEntry
,
int32_t
len
);
...
...
src/query/src/qHistogram.c
浏览文件 @
49fbb914
...
...
@@ -161,8 +161,8 @@ int32_t tHistogramAdd(SHistogramInfo** pHisto, double val) {
}
#if defined(USE_ARRAYLIST)
int32_t
idx
=
histoBinarySearch
((
*
pHisto
)
->
elems
,
(
*
pHisto
)
->
numOfEntries
,
val
,
(
*
pHisto
)
->
maxEntries
);
assert
(
idx
>=
0
&&
idx
<
(
*
pHisto
)
->
maxEntries
&&
(
*
pHisto
)
->
elems
!=
NULL
);
int32_t
idx
=
histoBinarySearch
((
*
pHisto
)
->
elems
,
(
*
pHisto
)
->
numOfEntries
,
val
);
assert
(
idx
>=
0
&&
idx
<
=
(
*
pHisto
)
->
maxEntries
&&
(
*
pHisto
)
->
elems
!=
NULL
);
if
((
*
pHisto
)
->
elems
[
idx
].
val
==
val
&&
idx
>=
0
)
{
(
*
pHisto
)
->
elems
[
idx
].
num
+=
1
;
...
...
@@ -359,7 +359,7 @@ int32_t tHistogramAdd(SHistogramInfo** pHisto, double val) {
return
0
;
}
int32_t
histoBinarySearch
(
SHistBin
*
pEntry
,
int32_t
len
,
double
val
,
int32_t
maxEntries
)
{
int32_t
histoBinarySearch
(
SHistBin
*
pEntry
,
int32_t
len
,
double
val
)
{
int32_t
end
=
len
-
1
;
int32_t
start
=
0
;
...
...
@@ -377,7 +377,6 @@ int32_t histoBinarySearch(SHistBin* pEntry, int32_t len, double val, int32_t max
}
int32_t
ret
=
start
>
end
?
start
:
end
;
if
(
ret
>=
maxEntries
)
ret
=
maxEntries
-
1
;
if
(
ret
<
0
)
{
return
0
;
}
else
{
...
...
@@ -470,7 +469,7 @@ void tHistogramPrint(SHistogramInfo* pHisto) {
*/
int64_t
tHistogramSum
(
SHistogramInfo
*
pHisto
,
double
v
)
{
#if defined(USE_ARRAYLIST)
int32_t
slotIdx
=
histoBinarySearch
(
pHisto
->
elems
,
pHisto
->
numOfEntries
,
v
,
pHisto
->
maxEntries
);
int32_t
slotIdx
=
histoBinarySearch
(
pHisto
->
elems
,
pHisto
->
numOfEntries
,
v
);
if
(
pHisto
->
elems
[
slotIdx
].
val
!=
v
)
{
slotIdx
-=
1
;
...
...
src/query/tests/histogramTest.cpp
浏览文件 @
49fbb914
...
...
@@ -98,19 +98,19 @@ TEST(testCase, histogram_binary_search) {
pHisto
->
elems
[
i
].
val
=
i
;
}
int32_t
idx
=
histoBinarySearch
(
pHisto
->
elems
,
pHisto
->
numOfEntries
,
1
,
pHisto
->
maxEntries
);
int32_t
idx
=
histoBinarySearch
(
pHisto
->
elems
,
pHisto
->
numOfEntries
,
1
);
assert
(
idx
==
1
);
idx
=
histoBinarySearch
(
pHisto
->
elems
,
pHisto
->
numOfEntries
,
9
,
pHisto
->
maxEntries
);
idx
=
histoBinarySearch
(
pHisto
->
elems
,
pHisto
->
numOfEntries
,
9
);
assert
(
idx
==
9
);
idx
=
histoBinarySearch
(
pHisto
->
elems
,
pHisto
->
numOfEntries
,
20
,
pHisto
->
maxEntries
);
idx
=
histoBinarySearch
(
pHisto
->
elems
,
pHisto
->
numOfEntries
,
20
);
assert
(
idx
==
10
);
idx
=
histoBinarySearch
(
pHisto
->
elems
,
pHisto
->
numOfEntries
,
-
1
,
pHisto
->
maxEntries
);
idx
=
histoBinarySearch
(
pHisto
->
elems
,
pHisto
->
numOfEntries
,
-
1
);
assert
(
idx
==
0
);
idx
=
histoBinarySearch
(
pHisto
->
elems
,
pHisto
->
numOfEntries
,
3.9
,
pHisto
->
maxEntries
);
idx
=
histoBinarySearch
(
pHisto
->
elems
,
pHisto
->
numOfEntries
,
3.9
);
assert
(
idx
==
4
);
free
(
pHisto
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录