提交 daebd8ff 编写于 作者: wafwerar's avatar wafwerar

fix(os): client install package

上级 eb48e8d9
[Unit] [Unit]
Description=Nginx For TDengine Service Description=Nginx For TDengine Service
After=network-online.target After=network-online.target
Wants=network-online.target Wants=network-online.target
[Service] [Service]
Type=forking Type=forking
PIDFile=/usr/local/nginxd/logs/nginx.pid PIDFile=/usr/local/nginxd/logs/nginx.pid
ExecStart=/usr/local/nginxd/sbin/nginx ExecStart=/usr/local/nginxd/sbin/nginx
ExecStop=/usr/local/nginxd/sbin/nginx -s stop ExecStop=/usr/local/nginxd/sbin/nginx -s stop
TimeoutStopSec=1000000s TimeoutStopSec=1000000s
LimitNOFILE=infinity LimitNOFILE=infinity
LimitNPROC=infinity LimitNPROC=infinity
LimitCORE=infinity LimitCORE=infinity
TimeoutStartSec=0 TimeoutStartSec=0
StandardOutput=null StandardOutput=null
Restart=always Restart=always
StartLimitBurst=3 StartLimitBurst=3
StartLimitInterval=60s StartLimitInterval=60s
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
######################################################## ########################################################
# # # #
# TDengine Configuration # # TDengine Configuration #
# Any questions, please email support@taosdata.com # # Any questions, please email support@taosdata.com #
# # # #
######################################################## ########################################################
# first fully qualified domain name (FQDN) for TDengine system # first fully qualified domain name (FQDN) for TDengine system
# firstEp hostname:6030 # firstEp hostname:6030
# local fully qualified domain name (FQDN) # local fully qualified domain name (FQDN)
# fqdn hostname # fqdn hostname
# first port number for the connection (12 continuous UDP/TCP port number are used) # first port number for the connection (12 continuous UDP/TCP port number are used)
# serverPort 6030 # serverPort 6030
# log file's directory # log file's directory
# logDir /var/log/taos # logDir /var/log/taos
# data file's directory # data file's directory
# dataDir /var/lib/taos # dataDir /var/lib/taos
# temporary file's directory # temporary file's directory
# tempDir /tmp/ # tempDir /tmp/
# the arbitrator's fully qualified domain name (FQDN) for TDengine system, for cluster only # the arbitrator's fully qualified domain name (FQDN) for TDengine system, for cluster only
# arbitrator arbitrator_hostname:6042 # arbitrator arbitrator_hostname:6042
# number of threads per CPU core # number of threads per CPU core
# numOfThreadsPerCore 1.0 # numOfThreadsPerCore 1.0
# number of threads to commit cache data # number of threads to commit cache data
# numOfCommitThreads 4 # numOfCommitThreads 4
# the proportion of total CPU cores available for query processing # the proportion of total CPU cores available for query processing
# 2.0: the query threads will be set to double of the CPU cores. # 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]. # 1.0: all CPU cores are available for query processing [default].
# 0.5: only half of the CPU cores are available for query. # 0.5: only half of the CPU cores are available for query.
# 0.0: only one core available. # 0.0: only one core available.
# ratioOfQueryCores 1.0 # ratioOfQueryCores 1.0
# the last_row/first/last aggregator will not change the original column name in the result fields # the last_row/first/last aggregator will not change the original column name in the result fields
keepColumnName 1 keepColumnName 1
# number of management nodes in the system # number of management nodes in the system
# numOfMnodes 1 # numOfMnodes 1
# enable/disable backuping vnode directory when removing vnode # enable/disable backuping vnode directory when removing vnode
# vnodeBak 1 # vnodeBak 1
# enable/disable installation / usage report # enable/disable installation / usage report
# telemetryReporting 1 # telemetryReporting 1
# enable/disable load balancing # enable/disable load balancing
# balance 1 # balance 1
# role for dnode. 0 - any, 1 - mnode, 2 - dnode # role for dnode. 0 - any, 1 - mnode, 2 - dnode
# role 0 # role 0
# max timer control blocks # max timer control blocks
# maxTmrCtrl 512 # maxTmrCtrl 512
# time interval of system monitor, seconds # time interval of system monitor, seconds
# monitorInterval 30 # monitorInterval 30
# number of seconds allowed for a dnode to be offline, for cluster only # number of seconds allowed for a dnode to be offline, for cluster only
# offlineThreshold 864000 # offlineThreshold 864000
# RPC re-try timer, millisecond # RPC re-try timer, millisecond
# rpcTimer 300 # rpcTimer 300
# RPC maximum time for ack, seconds. # RPC maximum time for ack, seconds.
# rpcMaxTime 600 # rpcMaxTime 600
# time interval of dnode status reporting to mnode, seconds, for cluster only # time interval of dnode status reporting to mnode, seconds, for cluster only
# statusInterval 1 # statusInterval 1
# time interval of heart beat from shell to dnode, seconds # time interval of heart beat from shell to dnode, seconds
# shellActivityTimer 3 # shellActivityTimer 3
# minimum sliding window time, milli-second # minimum sliding window time, milli-second
# minSlidingTime 10 # minSlidingTime 10
# minimum time window, milli-second # minimum time window, milli-second
# minIntervalTime 10 # minIntervalTime 10
# maximum delay before launching a stream computation, milli-second # maximum delay before launching a stream computation, milli-second
# maxStreamCompDelay 20000 # maxStreamCompDelay 20000
# maximum delay before launching a stream computation for the first time, milli-second # maximum delay before launching a stream computation for the first time, milli-second
# maxFirstStreamCompDelay 10000 # maxFirstStreamCompDelay 10000
# retry delay when a stream computation fails, milli-second # retry delay when a stream computation fails, milli-second
# retryStreamCompDelay 10 # retryStreamCompDelay 10
# the delayed time for launching a stream computation, from 0.1(default, 10% of whole computing time window) to 0.9 # the delayed time for launching a stream computation, from 0.1(default, 10% of whole computing time window) to 0.9
# streamCompDelayRatio 0.1 # streamCompDelayRatio 0.1
# max number of vgroups per db, 0 means configured automatically # max number of vgroups per db, 0 means configured automatically
# maxVgroupsPerDb 0 # maxVgroupsPerDb 0
# max number of tables per vnode # max number of tables per vnode
# maxTablesPerVnode 1000000 # maxTablesPerVnode 1000000
# cache block size (Mbyte) # cache block size (Mbyte)
# cache 16 # cache 16
# number of cache blocks per vnode # number of cache blocks per vnode
# blocks 6 # blocks 6
# number of days per DB file # number of days per DB file
# days 10 # days 10
# number of days to keep DB file # number of days to keep DB file
# keep 3650 # keep 3650
# minimum rows of records in file block # minimum rows of records in file block
# minRows 100 # minRows 100
# maximum rows of records in file block # maximum rows of records in file block
# maxRows 4096 # maxRows 4096
# the number of acknowledgments required for successful data writing # the number of acknowledgments required for successful data writing
# quorum 1 # quorum 1
# enable/disable compression # enable/disable compression
# comp 2 # comp 2
# write ahead log (WAL) level, 0: no wal; 1: write wal, but no fysnc; 2: write wal, and call fsync # write ahead log (WAL) level, 0: no wal; 1: write wal, but no fysnc; 2: write wal, and call fsync
# walLevel 1 # walLevel 1
# if walLevel is set to 2, the cycle of fsync being executed, if set to 0, fsync is called right away # if walLevel is set to 2, the cycle of fsync being executed, if set to 0, fsync is called right away
# fsync 3000 # fsync 3000
# number of replications, for cluster only # number of replications, for cluster only
# replica 1 # replica 1
# the compressed rpc message, option: # the compressed rpc message, option:
# -1 (no compression) # -1 (no compression)
# 0 (all message compressed), # 0 (all message compressed),
# > 0 (rpc message body which larger than this value will be compressed) # > 0 (rpc message body which larger than this value will be compressed)
# compressMsgSize -1 # compressMsgSize -1
# query retrieved column data compression option: # query retrieved column data compression option:
# -1 (no compression) # -1 (no compression)
# 0 (all retrieved column data compressed), # 0 (all retrieved column data compressed),
# > 0 (any retrieved column size greater than this value all data will be compressed.) # > 0 (any retrieved column size greater than this value all data will be compressed.)
# compressColData -1 # compressColData -1
# max length of an SQL # max length of an SQL
# maxSQLLength 65480 # maxSQLLength 65480
# max length of WildCards # max length of WildCards
# maxWildCardsLength 100 # maxWildCardsLength 100
# the maximum number of records allowed for super table time sorting # the maximum number of records allowed for super table time sorting
# maxNumOfOrderedRes 100000 # maxNumOfOrderedRes 100000
# system time zone # system time zone
# timezone Asia/Shanghai (CST, +0800) # timezone Asia/Shanghai (CST, +0800)
# system time zone (for windows 10) # system time zone (for windows 10)
# timezone UTC-8 # timezone UTC-8
# system locale # system locale
# locale en_US.UTF-8 # locale en_US.UTF-8
# default system charset # default system charset
# charset UTF-8 # charset UTF-8
# max number of connections allowed in dnode # max number of connections allowed in dnode
# maxShellConns 5000 # maxShellConns 5000
# max number of connections allowed in client # max number of connections allowed in client
# maxConnections 5000 # maxConnections 5000
# stop writing logs when the disk size of the log folder is less than this value # stop writing logs when the disk size of the log folder is less than this value
# minimalLogDirGB 1.0 # minimalLogDirGB 1.0
# stop writing temporary files when the disk size of the tmp folder is less than this value # stop writing temporary files when the disk size of the tmp folder is less than this value
# minimalTmpDirGB 1.0 # minimalTmpDirGB 1.0
# if disk free space is less than this value, taosd service exit directly within startup process # if disk free space is less than this value, taosd service exit directly within startup process
# minimalDataDirGB 2.0 # minimalDataDirGB 2.0
# One mnode is equal to the number of vnode consumed # One mnode is equal to the number of vnode consumed
# mnodeEqualVnodeNum 4 # mnodeEqualVnodeNum 4
# enbale/disable http service # enbale/disable http service
# http 1 # http 1
# enable/disable system monitor # enable/disable system monitor
# monitor 1 # monitor 1
# enable/disable recording the SQL statements via restful interface # enable/disable recording the SQL statements via restful interface
# httpEnableRecordSql 0 # httpEnableRecordSql 0
# number of threads used to process http requests # number of threads used to process http requests
# httpMaxThreads 2 # httpMaxThreads 2
# maximum number of rows returned by the restful interface # maximum number of rows returned by the restful interface
# restfulRowLimit 10240 # restfulRowLimit 10240
# database name must be specified in restful interface if the following parameter is set, off by default # database name must be specified in restful interface if the following parameter is set, off by default
# httpDbNameMandatory 1 # httpDbNameMandatory 1
# http keep alive, default is 30 seconds # http keep alive, default is 30 seconds
# httpKeepAlive 30000 # httpKeepAlive 30000
# The following parameter is used to limit the maximum number of lines in log files. # The following parameter is used to limit the maximum number of lines in log files.
# max number of lines per log filters # max number of lines per log filters
# numOfLogLines 10000000 # numOfLogLines 10000000
# enable/disable async log # enable/disable async log
# asyncLog 1 # asyncLog 1
# time of keeping log files, days # time of keeping log files, days
# logKeepDays 0 # logKeepDays 0
# The following parameters are used for debug purpose only. # The following parameters are used for debug purpose only.
# debugFlag 8 bits mask: FILE-SCREEN-UNUSED-HeartBeat-DUMP-TRACE_WARN-ERROR # debugFlag 8 bits mask: FILE-SCREEN-UNUSED-HeartBeat-DUMP-TRACE_WARN-ERROR
# 131: output warning and error # 131: output warning and error
# 135: output debug, warning and error # 135: output debug, warning and error
# 143: output trace, debug, warning and error to log # 143: output trace, debug, warning and error to log
# 199: output debug, warning and error to both screen and file # 199: output debug, warning and error to both screen and file
# 207: output trace, 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 # debug flag for all log type, take effect when non-zero value
# debugFlag 0 # debugFlag 0
# debug flag for meta management messages # debug flag for meta management messages
# mDebugFlag 135 # mDebugFlag 135
# debug flag for dnode messages # debug flag for dnode messages
# dDebugFlag 135 # dDebugFlag 135
# debug flag for sync module # debug flag for sync module
# sDebugFlag 135 # sDebugFlag 135
# debug flag for WAL # debug flag for WAL
# wDebugFlag 135 # wDebugFlag 135
# debug flag for SDB # debug flag for SDB
# sdbDebugFlag 135 # sdbDebugFlag 135
# debug flag for RPC # debug flag for RPC
# rpcDebugFlag 131 # rpcDebugFlag 131
# debug flag for TAOS TIMER # debug flag for TAOS TIMER
# tmrDebugFlag 131 # tmrDebugFlag 131
# debug flag for TDengine client # debug flag for TDengine client
# cDebugFlag 131 # cDebugFlag 131
# debug flag for JNI # debug flag for JNI
# jniDebugFlag 131 # jniDebugFlag 131
# debug flag for storage # debug flag for storage
# uDebugFlag 131 # uDebugFlag 131
# debug flag for http server # debug flag for http server
# httpDebugFlag 131 # httpDebugFlag 131
# debug flag for monitor # debug flag for monitor
# monDebugFlag 131 # monDebugFlag 131
# debug flag for query # debug flag for query
# qDebugFlag 131 # qDebugFlag 131
# debug flag for vnode # debug flag for vnode
# vDebugFlag 131 # vDebugFlag 131
# debug flag for TSDB # debug flag for TSDB
# tsdbDebugFlag 131 # tsdbDebugFlag 131
# debug flag for continue query # debug flag for continue query
# cqDebugFlag 131 # cqDebugFlag 131
# enable/disable recording the SQL in taos client # enable/disable recording the SQL in taos client
# enableRecordSql 0 # enableRecordSql 0
# generate core file when service crash # generate core file when service crash
# enableCoreFile 1 # enableCoreFile 1
# maximum display width of binary and nchar fields in the shell. The parts exceeding this limit will be hidden # maximum display width of binary and nchar fields in the shell. The parts exceeding this limit will be hidden
# maxBinaryDisplayWidth 30 # maxBinaryDisplayWidth 30
# enable/disable stream (continuous query) # enable/disable stream (continuous query)
# stream 1 # stream 1
# in retrieve blocking model, only in 50% query threads will be used in query processing in dnode # in retrieve blocking model, only in 50% query threads will be used in query processing in dnode
# retrieveBlockingModel 0 # retrieveBlockingModel 0
# the maximum allowed query buffer size in MB during query processing for each data node # the maximum allowed query buffer size in MB during query processing for each data node
# -1 no limit (default) # -1 no limit (default)
# 0 no query allowed, queries are disabled # 0 no query allowed, queries are disabled
# queryBufferSize -1 # queryBufferSize -1
# percent of redundant data in tsdb meta will compact meta data,0 means donot compact # percent of redundant data in tsdb meta will compact meta data,0 means donot compact
# tsdbMetaCompactRatio 0 # tsdbMetaCompactRatio 0
# default string type used for storing JSON String, options can be binary/nchar, default is nchar # default string type used for storing JSON String, options can be binary/nchar, default is nchar
# defaultJSONStrType nchar # defaultJSONStrType nchar
# force TCP transmission # force TCP transmission
# rpcForceTcp 0 # rpcForceTcp 0
# unit MB. Flush vnode wal file if walSize > walFlushSize and walSize > cache*0.5*blocks # unit MB. Flush vnode wal file if walSize > walFlushSize and walSize > cache*0.5*blocks
# walFlushSize 1024 # walFlushSize 1024
# unit Hour. Latency of data migration # unit Hour. Latency of data migration
# keepTimeOffset 0 # keepTimeOffset 0
[Unit] [Unit]
Description=TDengine server service Description=TDengine server service
After=network-online.target After=network-online.target
Wants=network-online.target Wants=network-online.target
[Service] [Service]
Type=simple Type=simple
ExecStart=/usr/bin/taosd ExecStart=/usr/bin/taosd
ExecStartPre=/usr/local/taos/bin/startPre.sh ExecStartPre=/usr/local/taos/bin/startPre.sh
TimeoutStopSec=1000000s TimeoutStopSec=1000000s
LimitNOFILE=infinity LimitNOFILE=infinity
LimitNPROC=infinity LimitNPROC=infinity
LimitCORE=infinity LimitCORE=infinity
TimeoutStartSec=0 TimeoutStartSec=0
StandardOutput=null StandardOutput=null
Restart=always Restart=always
StartLimitBurst=3 StartLimitBurst=3
StartLimitInterval=60s StartLimitInterval=60s
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
[Unit] [Unit]
Description=TDengine arbitrator service Description=TDengine arbitrator service
After=network-online.target After=network-online.target
Wants=network-online.target Wants=network-online.target
[Service] [Service]
Type=simple Type=simple
ExecStart=/usr/bin/tarbitrator ExecStart=/usr/bin/tarbitrator
TimeoutStopSec=1000000s TimeoutStopSec=1000000s
LimitNOFILE=infinity LimitNOFILE=infinity
LimitNPROC=infinity LimitNPROC=infinity
LimitCORE=infinity LimitCORE=infinity
TimeoutStartSec=0 TimeoutStartSec=0
StandardOutput=null StandardOutput=null
Restart=always Restart=always
StartLimitBurst=3 StartLimitBurst=3
StartLimitInterval=60s StartLimitInterval=60s
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
#!/bin/bash #!/bin/bash
# #
# This file is used to install database on linux systems. The operating system # This file is used to install database on linux systems. The operating system
# is required to use systemd to manage services at boot # is required to use systemd to manage services at boot
set -e set -e
#set -x #set -x
verMode=edge verMode=edge
pagMode=full pagMode=full
iplist="" iplist=""
serverFqdn="" serverFqdn=""
# -----------------------Variables definition--------------------- # -----------------------Variables definition---------------------
script_dir="../release" script_dir="../release"
# Dynamic directory # Dynamic directory
data_dir="/var/lib/taos" data_dir="/var/lib/taos"
log_dir="/var/log/taos" log_dir="/var/log/taos"
data_link_dir="/usr/local/taos/data" data_link_dir="/usr/local/taos/data"
log_link_dir="/usr/local/taos/log" log_link_dir="/usr/local/taos/log"
cfg_install_dir="/etc/taos" cfg_install_dir="/etc/taos"
bin_link_dir="/usr/bin" bin_link_dir="/usr/bin"
lib_link_dir="/usr/lib" lib_link_dir="/usr/lib"
lib64_link_dir="/usr/lib64" lib64_link_dir="/usr/lib64"
inc_link_dir="/usr/include" inc_link_dir="/usr/include"
#install main path #install main path
install_main_dir="/usr/local/taos" install_main_dir="/usr/local/taos"
# old bin dir # old bin dir
sbin_dir="/usr/local/taos/bin" sbin_dir="/usr/local/taos/bin"
temp_version="" temp_version=""
fin_result="" fin_result=""
service_config_dir="/etc/systemd/system" service_config_dir="/etc/systemd/system"
nginx_port=6060 nginx_port=6060
nginx_dir="/usr/local/nginxd" nginx_dir="/usr/local/nginxd"
# Color setting # Color setting
RED='\033[0;31m' RED='\033[0;31m'
GREEN='\033[1;32m' GREEN='\033[1;32m'
GREEN_DARK='\033[0;32m' GREEN_DARK='\033[0;32m'
GREEN_UNDERLINE='\033[4;32m' GREEN_UNDERLINE='\033[4;32m'
NC='\033[0m' NC='\033[0m'
csudo="" csudo=""
if command -v sudo > /dev/null; then if command -v sudo > /dev/null; then
csudo="sudo " csudo="sudo "
fi fi
# ============================= get input parameters ================================================= # ============================= get input parameters =================================================
# install.sh -v [server | client] -e [yes | no] -i [systemd | service | ...] # install.sh -v [server | client] -e [yes | no] -i [systemd | service | ...]
# set parameters by default value # set parameters by default value
interactiveFqdn=yes # [yes | no] interactiveFqdn=yes # [yes | no]
verType=server # [server | client] verType=server # [server | client]
initType=systemd # [systemd | service | ...] initType=systemd # [systemd | service | ...]
while getopts "hv:d:" arg while getopts "hv:d:" arg
do do
case $arg in case $arg in
d) d)
#echo "interactiveFqdn=$OPTARG" #echo "interactiveFqdn=$OPTARG"
script_dir=$( echo $OPTARG ) script_dir=$( echo $OPTARG )
;; ;;
h) h)
echo "Usage: `basename $0` -d scripy_path" echo "Usage: `basename $0` -d scripy_path"
exit 0 exit 0
;; ;;
?) #unknow option ?) #unknow option
echo "unkonw argument" echo "unkonw argument"
exit 1 exit 1
;; ;;
esac esac
done done
#echo "verType=${verType} interactiveFqdn=${interactiveFqdn}" #echo "verType=${verType} interactiveFqdn=${interactiveFqdn}"
function kill_process() { function kill_process() {
pid=$(ps -ef | grep "$1" | grep -v "grep" | awk '{print $2}') pid=$(ps -ef | grep "$1" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then if [ -n "$pid" ]; then
${csudo}kill -9 $pid || : ${csudo}kill -9 $pid || :
fi fi
} }
function check_file() { function check_file() {
#check file whether exists #check file whether exists
if [ ! -e $1/$2 ];then if [ ! -e $1/$2 ];then
echo -e "$1/$2 \033[31mnot exists\033[0m!quit" echo -e "$1/$2 \033[31mnot exists\033[0m!quit"
fin_result=$fin_result"\033[31m$temp_version\033[0m test failed!\n" fin_result=$fin_result"\033[31m$temp_version\033[0m test failed!\n"
echo -e $fin_result echo -e $fin_result
exit 8 exit 8
fi fi
} }
function get_package_name() { function get_package_name() {
var=$1 var=$1
if [[ $1 =~ 'aarch' ]];then if [[ $1 =~ 'aarch' ]];then
echo ${var::-21} echo ${var::-21}
else else
echo ${var::-17} echo ${var::-17}
fi fi
} }
function check_link() { function check_link() {
#check Link whether exists or broken #check Link whether exists or broken
if [ -L $1 ] ; then if [ -L $1 ] ; then
if [ ! -e $1 ] ; then if [ ! -e $1 ] ; then
echo -e "$1 \033[31Broken link\033[0m" echo -e "$1 \033[31Broken link\033[0m"
fin_result=$fin_result"\033[31m$temp_version\033[0m test failed!\n" fin_result=$fin_result"\033[31m$temp_version\033[0m test failed!\n"
echo -e $fin_result echo -e $fin_result
exit 8 exit 8
fi fi
else else
echo -e "$1 \033[31mnot exists\033[0m!quit" echo -e "$1 \033[31mnot exists\033[0m!quit"
fin_result=$fin_result"\033[31m$temp_version\033[0m test failed!\n" fin_result=$fin_result"\033[31m$temp_version\033[0m test failed!\n"
echo -e $fin_result echo -e $fin_result
exit 8 exit 8
fi fi
} }
function check_main_path() { function check_main_path() {
#check install main dir and all sub dir #check install main dir and all sub dir
main_dir=("" "cfg" "bin" "connector" "driver" "examples" "include" "init.d") main_dir=("" "cfg" "bin" "connector" "driver" "examples" "include" "init.d")
for i in "${main_dir[@]}";do for i in "${main_dir[@]}";do
check_file ${install_main_dir} $i check_file ${install_main_dir} $i
done done
if [ "$verMode" == "cluster" ]; then if [ "$verMode" == "cluster" ]; then
nginx_main_dir=("admin" "conf" "html" "sbin" "logs") nginx_main_dir=("admin" "conf" "html" "sbin" "logs")
for i in "${nginx_main_dir[@]}";do for i in "${nginx_main_dir[@]}";do
check_file ${nginx_dir} $i check_file ${nginx_dir} $i
done done
fi fi
echo -e "Check main path:\033[32mOK\033[0m!" echo -e "Check main path:\033[32mOK\033[0m!"
} }
function check_bin_path() { function check_bin_path() {
# check install bin dir and all sub dir # check install bin dir and all sub dir
bin_dir=("taos" "taosd" "taosadapter" "taosdemo" "remove.sh" "tarbitrator" "set_core.sh") bin_dir=("taos" "taosd" "taosadapter" "taosdemo" "remove.sh" "tarbitrator" "set_core.sh")
for i in "${bin_dir[@]}";do for i in "${bin_dir[@]}";do
check_file ${sbin_dir} $i check_file ${sbin_dir} $i
done done
lbin_dir=("taos" "taosd" "taosadapter" "taosdemo" "rmtaos" "tarbitrator" "set_core") lbin_dir=("taos" "taosd" "taosadapter" "taosdemo" "rmtaos" "tarbitrator" "set_core")
for i in "${lbin_dir[@]}";do for i in "${lbin_dir[@]}";do
check_link ${bin_link_dir}/$i check_link ${bin_link_dir}/$i
done done
if [ "$verMode" == "cluster" ]; then if [ "$verMode" == "cluster" ]; then
check_file ${nginx_dir}/sbin nginx check_file ${nginx_dir}/sbin nginx
fi fi
echo -e "Check bin path:\033[32mOK\033[0m!" echo -e "Check bin path:\033[32mOK\033[0m!"
} }
function check_lib_path() { function check_lib_path() {
# check all links # check all links
check_link ${lib_link_dir}/libtaos.so check_link ${lib_link_dir}/libtaos.so
check_link ${lib_link_dir}/libtaos.so.1 check_link ${lib_link_dir}/libtaos.so.1
if [[ -d ${lib64_link_dir} ]]; then if [[ -d ${lib64_link_dir} ]]; then
check_link ${lib64_link_dir}/libtaos.so check_link ${lib64_link_dir}/libtaos.so
check_link ${lib64_link_dir}/libtaos.so.1 check_link ${lib64_link_dir}/libtaos.so.1
fi fi
echo -e "Check lib path:\033[32mOK\033[0m!" echo -e "Check lib path:\033[32mOK\033[0m!"
} }
function check_header_path() { function check_header_path() {
# check all header # check all header
header_dir=("taos.h" "taosdef.h" "taoserror.h") header_dir=("taos.h" "taosdef.h" "taoserror.h")
for i in "${header_dir[@]}";do for i in "${header_dir[@]}";do
check_link ${inc_link_dir}/$i check_link ${inc_link_dir}/$i
done done
echo -e "Check bin path:\033[32mOK\033[0m!" echo -e "Check bin path:\033[32mOK\033[0m!"
} }
function check_taosadapter_config_dir() { function check_taosadapter_config_dir() {
# check all config # check all config
check_file ${cfg_install_dir} taosadapter.toml check_file ${cfg_install_dir} taosadapter.toml
check_file ${cfg_install_dir} taosadapter.service check_file ${cfg_install_dir} taosadapter.service
check_file ${install_main_dir}/cfg taosadapter.toml.org check_file ${install_main_dir}/cfg taosadapter.toml.org
echo -e "Check conf path:\033[32mOK\033[0m!" echo -e "Check conf path:\033[32mOK\033[0m!"
} }
function check_config_dir() { function check_config_dir() {
# check all config # check all config
check_file ${cfg_install_dir} taos.cfg check_file ${cfg_install_dir} taos.cfg
check_file ${install_main_dir}/cfg taos.cfg.org check_file ${install_main_dir}/cfg taos.cfg.org
echo -e "Check conf path:\033[32mOK\033[0m!" echo -e "Check conf path:\033[32mOK\033[0m!"
} }
function check_log_path() { function check_log_path() {
# check log path # check log path
check_file ${log_dir} check_file ${log_dir}
echo -e "Check log path:\033[32mOK\033[0m!" echo -e "Check log path:\033[32mOK\033[0m!"
} }
function check_data_path() { function check_data_path() {
# check data path # check data path
check_file ${data_dir} check_file ${data_dir}
echo -e "Check data path:\033[32mOK\033[0m!" echo -e "Check data path:\033[32mOK\033[0m!"
} }
function install_TDengine() { function install_TDengine() {
cd ${script_dir} cd ${script_dir}
tar zxf $1 tar zxf $1
temp_version=$(get_package_name $1) temp_version=$(get_package_name $1)
cd $(get_package_name $1) cd $(get_package_name $1)
echo -e "\033[32muninstall TDengine && install TDengine...\033[0m" echo -e "\033[32muninstall TDengine && install TDengine...\033[0m"
rmtaos >/dev/null 2>&1 || echo 'taosd not installed' && echo -e '\n\n' |./install.sh >/dev/null 2>&1 rmtaos >/dev/null 2>&1 || echo 'taosd not installed' && echo -e '\n\n' |./install.sh >/dev/null 2>&1
echo -e "\033[32mTDengine has been installed!\033[0m" echo -e "\033[32mTDengine has been installed!\033[0m"
echo -e "\033[32mTDengine is starting...\033[0m" echo -e "\033[32mTDengine is starting...\033[0m"
kill_process taos && systemctl start taosd && sleep 10 kill_process taos && systemctl start taosd && sleep 10
} }
function test_TDengine() { function test_TDengine() {
check_main_path check_main_path
check_bin_path check_bin_path
check_lib_path check_lib_path
check_header_path check_header_path
check_config_dir check_config_dir
check_taosadapter_config_dir check_taosadapter_config_dir
check_log_path check_log_path
check_data_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 ||:` result=`taos -s 'create database test ;create table test.tt(ts timestamp ,i int);insert into test.tt values(now,11);select * from test.tt' 2>&1 ||:`
if [[ $result =~ "Unable to establish" ]];then if [[ $result =~ "Unable to establish" ]];then
echo -e "\033[31mTDengine connect failed\033[0m" echo -e "\033[31mTDengine connect failed\033[0m"
fin_result=$fin_result"\033[31m$temp_version\033[0m test failed!\n" fin_result=$fin_result"\033[31m$temp_version\033[0m test failed!\n"
echo -e $fin_result echo -e $fin_result
exit 8 exit 8
fi fi
echo -e "Check TDengine connect:\033[32mOK\033[0m!" echo -e "Check TDengine connect:\033[32mOK\033[0m!"
fin_result=$fin_result"\033[32m$temp_version\033[0m test OK!\n" fin_result=$fin_result"\033[32m$temp_version\033[0m test OK!\n"
} }
# ## ==============================Main program starts from here============================ # ## ==============================Main program starts from here============================
TD_package_name=`ls ${script_dir}/*server*gz |awk -F '/' '{print $NF}' ` TD_package_name=`ls ${script_dir}/*server*gz |awk -F '/' '{print $NF}' `
temp=`pwd` temp=`pwd`
for i in $TD_package_name;do for i in $TD_package_name;do
if [[ $i =~ 'enterprise' ]];then if [[ $i =~ 'enterprise' ]];then
verMode="cluster" verMode="cluster"
else else
verMode="" verMode=""
fi fi
cd $temp cd $temp
install_TDengine $i install_TDengine $i
test_TDengine test_TDengine
done done
echo "============================================================" echo "============================================================"
echo -e $fin_result echo -e $fin_result
Package: tdengine Package: tdengine
Version: 1.0.0 Version: 1.0.0
Section: utils Section: utils
Priority: optional Priority: optional
#Essential: no #Essential: no
#Depends: no #Depends: no
#Suggests: no #Suggests: no
Architecture: amd64 Architecture: amd64
Installed-Size: 66666 Installed-Size: 66666
Maintainer: support@taosdata.com Maintainer: support@taosdata.com
Provides: taosdata Provides: taosdata
Homepage: http://taosdata.com Homepage: http://taosdata.com
Description: Big Data Platform Designed and Optimized for IoT. Description: Big Data Platform Designed and Optimized for IoT.
#!/bin/bash #!/bin/bash
#set -x #set -x
#path=`pwd` #path=`pwd`
insmetaPath="/usr/local/taos/script" insmetaPath="/usr/local/taos/script"
csudo="" csudo=""
if command -v sudo > /dev/null; then if command -v sudo > /dev/null; then
csudo="sudo " csudo="sudo "
fi fi
${csudo}chmod -R 744 ${insmetaPath} ${csudo}chmod -R 744 ${insmetaPath}
cd ${insmetaPath} cd ${insmetaPath}
${csudo}./post.sh ${csudo}./post.sh
#!/bin/bash #!/bin/bash
csudo="" csudo=""
if command -v sudo > /dev/null; then if command -v sudo > /dev/null; then
csudo="sudo " csudo="sudo "
fi fi
# Stop the service if running # Stop the service if running
if pidof taosd &> /dev/null; then if pidof taosd &> /dev/null; then
if pidof systemd &> /dev/null; then if pidof systemd &> /dev/null; then
${csudo}systemctl stop taosd || : ${csudo}systemctl stop taosd || :
elif $(which service &> /dev/null); then elif $(which service &> /dev/null); then
${csudo}service taosd stop || : ${csudo}service taosd stop || :
else else
pid=$(ps -ef | grep "taosd" | grep -v "grep" | awk '{print $2}') pid=$(ps -ef | grep "taosd" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then if [ -n "$pid" ]; then
${csudo}kill -9 $pid || : ${csudo}kill -9 $pid || :
fi fi
fi fi
echo "Stop taosd service success!" echo "Stop taosd service success!"
sleep 1 sleep 1
fi fi
# if taos.cfg already softlink, remove it # if taos.cfg already softlink, remove it
cfg_install_dir="/etc/taos" cfg_install_dir="/etc/taos"
install_main_dir="/usr/local/taos" install_main_dir="/usr/local/taos"
if [ -f "${install_main_dir}/taos.cfg" ]; then if [ -f "${install_main_dir}/taos.cfg" ]; then
${csudo}rm -f ${install_main_dir}/cfg/taos.cfg || : ${csudo}rm -f ${install_main_dir}/cfg/taos.cfg || :
fi fi
if [ -f "${install_main_dir}/taosadapter.toml" ]; then if [ -f "${install_main_dir}/taosadapter.toml" ]; then
${csudo}rm -f ${install_main_dir}/cfg/taosadapter.toml || : ${csudo}rm -f ${install_main_dir}/cfg/taosadapter.toml || :
fi fi
if [ -f "${install_main_dir}/taosadapter.service" ]; then if [ -f "${install_main_dir}/taosadapter.service" ]; then
${csudo}rm -f ${install_main_dir}/cfg/taosadapter.service || : ${csudo}rm -f ${install_main_dir}/cfg/taosadapter.service || :
fi fi
# there can not libtaos.so*, otherwise ln -s error # there can not libtaos.so*, otherwise ln -s error
${csudo}rm -f ${install_main_dir}/driver/libtaos* || : ${csudo}rm -f ${install_main_dir}/driver/libtaos* || :
#!/bin/bash #!/bin/bash
insmetaPath="/usr/local/taos/script" insmetaPath="/usr/local/taos/script"
csudo="" csudo=""
if command -v sudo > /dev/null; then if command -v sudo > /dev/null; then
csudo="sudo " csudo="sudo "
fi fi
${csudo}chmod -R 744 ${insmetaPath} || : ${csudo}chmod -R 744 ${insmetaPath} || :
#cd ${insmetaPath} #cd ${insmetaPath}
#${csudo}./preun.sh #${csudo}./preun.sh
if [ -f ${insmetaPath}/preun.sh ]; then if [ -f ${insmetaPath}/preun.sh ]; then
cd ${insmetaPath} cd ${insmetaPath}
${csudo}./preun.sh ${csudo}./preun.sh
else else
bin_link_dir="/usr/bin" bin_link_dir="/usr/bin"
lib_link_dir="/usr/lib" lib_link_dir="/usr/lib"
inc_link_dir="/usr/include" inc_link_dir="/usr/include"
data_link_dir="/usr/local/taos/data" data_link_dir="/usr/local/taos/data"
log_link_dir="/usr/local/taos/log" log_link_dir="/usr/local/taos/log"
cfg_link_dir="/usr/local/taos/cfg" cfg_link_dir="/usr/local/taos/cfg"
# Remove all links # Remove all links
${csudo}rm -f ${bin_link_dir}/taos || : ${csudo}rm -f ${bin_link_dir}/taos || :
${csudo}rm -f ${bin_link_dir}/taosd || : ${csudo}rm -f ${bin_link_dir}/taosd || :
${csudo}rm -f ${bin_link_dir}/taosadapter || : ${csudo}rm -f ${bin_link_dir}/taosadapter || :
${csudo}rm -f ${bin_link_dir}/taosdemo || : ${csudo}rm -f ${bin_link_dir}/taosdemo || :
${csudo}rm -f ${cfg_link_dir}/* || : ${csudo}rm -f ${cfg_link_dir}/* || :
${csudo}rm -f ${inc_link_dir}/taos.h || : ${csudo}rm -f ${inc_link_dir}/taos.h || :
${csudo}rm -f ${lib_link_dir}/libtaos.* || : ${csudo}rm -f ${lib_link_dir}/libtaos.* || :
${csudo}rm -f ${log_link_dir} || : ${csudo}rm -f ${log_link_dir} || :
${csudo}rm -f ${data_link_dir} || : ${csudo}rm -f ${data_link_dir} || :
pid=$(ps -ef | grep "taosd" | grep -v "grep" | awk '{print $2}') pid=$(ps -ef | grep "taosd" | grep -v "grep" | awk '{print $2}')
if [ -n "$pid" ]; then if [ -n "$pid" ]; then
${csudo}kill -9 $pid || : ${csudo}kill -9 $pid || :
fi fi
fi fi
#!/bin/bash #!/bin/bash
# #
# Generate deb package for ubuntu # Generate deb package for ubuntu
set -e set -e
# set -x # set -x
#curr_dir=$(pwd) #curr_dir=$(pwd)
compile_dir=$1 compile_dir=$1
output_dir=$2 output_dir=$2
tdengine_ver=$3 tdengine_ver=$3
cpuType=$4 cpuType=$4
osType=$5 osType=$5
verMode=$6 verMode=$6
verType=$7 verType=$7
script_dir="$(dirname $(readlink -f $0))" script_dir="$(dirname $(readlink -f $0))"
top_dir="$(readlink -f ${script_dir}/../..)" top_dir="$(readlink -f ${script_dir}/../..)"
pkg_dir="${top_dir}/debworkroom" pkg_dir="${top_dir}/debworkroom"
#echo "curr_dir: ${curr_dir}" #echo "curr_dir: ${curr_dir}"
#echo "top_dir: ${top_dir}" #echo "top_dir: ${top_dir}"
#echo "script_dir: ${script_dir}" #echo "script_dir: ${script_dir}"
echo "compile_dir: ${compile_dir}" echo "compile_dir: ${compile_dir}"
echo "pkg_dir: ${pkg_dir}" echo "pkg_dir: ${pkg_dir}"
if [ -d ${pkg_dir} ]; then if [ -d ${pkg_dir} ]; then
rm -rf ${pkg_dir} rm -rf ${pkg_dir}
fi fi
mkdir -p ${pkg_dir} mkdir -p ${pkg_dir}
cd ${pkg_dir} cd ${pkg_dir}
libfile="libtaos.so.${tdengine_ver}" libfile="libtaos.so.${tdengine_ver}"
# create install dir # create install dir
install_home_path="/usr/local/taos" install_home_path="/usr/local/taos"
mkdir -p ${pkg_dir}${install_home_path} mkdir -p ${pkg_dir}${install_home_path}
mkdir -p ${pkg_dir}${install_home_path}/bin mkdir -p ${pkg_dir}${install_home_path}/bin
mkdir -p ${pkg_dir}${install_home_path}/cfg mkdir -p ${pkg_dir}${install_home_path}/cfg
#mkdir -p ${pkg_dir}${install_home_path}/connector #mkdir -p ${pkg_dir}${install_home_path}/connector
mkdir -p ${pkg_dir}${install_home_path}/driver mkdir -p ${pkg_dir}${install_home_path}/driver
mkdir -p ${pkg_dir}${install_home_path}/examples mkdir -p ${pkg_dir}${install_home_path}/examples
mkdir -p ${pkg_dir}${install_home_path}/include mkdir -p ${pkg_dir}${install_home_path}/include
#mkdir -p ${pkg_dir}${install_home_path}/init.d #mkdir -p ${pkg_dir}${install_home_path}/init.d
mkdir -p ${pkg_dir}${install_home_path}/script mkdir -p ${pkg_dir}${install_home_path}/script
cp ${compile_dir}/../packaging/cfg/taos.cfg ${pkg_dir}${install_home_path}/cfg cp ${compile_dir}/../packaging/cfg/taos.cfg ${pkg_dir}${install_home_path}/cfg
if [ -f "${compile_dir}/test/cfg/taosadapter.toml" ]; then if [ -f "${compile_dir}/test/cfg/taosadapter.toml" ]; then
cp ${compile_dir}/test/cfg/taosadapter.toml ${pkg_dir}${install_home_path}/cfg || : cp ${compile_dir}/test/cfg/taosadapter.toml ${pkg_dir}${install_home_path}/cfg || :
fi fi
if [ -f "${compile_dir}/test/cfg/taosadapter.service" ]; then if [ -f "${compile_dir}/test/cfg/taosadapter.service" ]; then
cp ${compile_dir}/test/cfg/taosadapter.service ${pkg_dir}${install_home_path}/cfg || : cp ${compile_dir}/test/cfg/taosadapter.service ${pkg_dir}${install_home_path}/cfg || :
fi fi
#cp ${compile_dir}/../packaging/deb/taosd ${pkg_dir}${install_home_path}/init.d #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/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/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/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/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}/../packaging/tools/taosd-dump-cfg.gdb ${pkg_dir}${install_home_path}/bin
cp ${compile_dir}/build/bin/taosd ${pkg_dir}${install_home_path}/bin cp ${compile_dir}/build/bin/taosd ${pkg_dir}${install_home_path}/bin
#cp ${compile_dir}/build/bin/taosBenchmark ${pkg_dir}${install_home_path}/bin #cp ${compile_dir}/build/bin/taosBenchmark ${pkg_dir}${install_home_path}/bin
if [ -f "${compile_dir}/build/bin/taosadapter" ]; then if [ -f "${compile_dir}/build/bin/taosadapter" ]; then
cp ${compile_dir}/build/bin/taosadapter ${pkg_dir}${install_home_path}/bin ||: cp ${compile_dir}/build/bin/taosadapter ${pkg_dir}${install_home_path}/bin ||:
fi fi
cp ${compile_dir}/build/bin/taos ${pkg_dir}${install_home_path}/bin 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}/build/lib/${libfile} ${pkg_dir}${install_home_path}/driver
cp ${compile_dir}/../src/inc/taos.h ${pkg_dir}${install_home_path}/include cp ${compile_dir}/../include/client/taos.h ${pkg_dir}${install_home_path}/include
cp ${compile_dir}/../src/inc/taosdef.h ${pkg_dir}${install_home_path}/include cp ${compile_dir}/../include/common/taosdef.h ${pkg_dir}${install_home_path}/include
cp ${compile_dir}/../src/inc/taoserror.h ${pkg_dir}${install_home_path}/include cp ${compile_dir}/../include/util/taoserror.h ${pkg_dir}${install_home_path}/include
cp -r ${top_dir}/examples/* ${pkg_dir}${install_home_path}/examples cp -r ${top_dir}/examples/* ${pkg_dir}${install_home_path}/examples
#cp -r ${top_dir}/src/connector/python ${pkg_dir}${install_home_path}/connector #cp -r ${top_dir}/src/connector/python ${pkg_dir}${install_home_path}/connector
#cp -r ${top_dir}/src/connector/go ${pkg_dir}${install_home_path}/connector #cp -r ${top_dir}/src/connector/go ${pkg_dir}${install_home_path}/connector
#cp -r ${top_dir}/src/connector/nodejs ${pkg_dir}${install_home_path}/connector #cp -r ${top_dir}/src/connector/nodejs ${pkg_dir}${install_home_path}/connector
#cp ${compile_dir}/build/lib/taos-jdbcdriver*.* ${pkg_dir}${install_home_path}/connector ||: #cp ${compile_dir}/build/lib/taos-jdbcdriver*.* ${pkg_dir}${install_home_path}/connector ||:
install_user_local_path="/usr/local" install_user_local_path="/usr/local"
if [ -f ${compile_dir}/build/bin/jemalloc-config ]; then if [ -f ${compile_dir}/build/bin/jemalloc-config ]; then
mkdir -p ${pkg_dir}${install_user_local_path}/{bin,lib,lib/pkgconfig,include/jemalloc,share/doc/jemalloc,share/man/man3} mkdir -p ${pkg_dir}${install_user_local_path}/{bin,lib,lib/pkgconfig,include/jemalloc,share/doc/jemalloc,share/man/man3}
cp ${compile_dir}/build/bin/jemalloc-config ${pkg_dir}${install_user_local_path}/bin/ cp ${compile_dir}/build/bin/jemalloc-config ${pkg_dir}${install_user_local_path}/bin/
if [ -f ${compile_dir}/build/bin/jemalloc.sh ]; then if [ -f ${compile_dir}/build/bin/jemalloc.sh ]; then
cp ${compile_dir}/build/bin/jemalloc.sh ${pkg_dir}${install_user_local_path}/bin/ cp ${compile_dir}/build/bin/jemalloc.sh ${pkg_dir}${install_user_local_path}/bin/
fi fi
if [ -f ${compile_dir}/build/bin/jeprof ]; then if [ -f ${compile_dir}/build/bin/jeprof ]; then
cp ${compile_dir}/build/bin/jeprof ${pkg_dir}${install_user_local_path}/bin/ cp ${compile_dir}/build/bin/jeprof ${pkg_dir}${install_user_local_path}/bin/
fi fi
if [ -f ${compile_dir}/build/include/jemalloc/jemalloc.h ]; then if [ -f ${compile_dir}/build/include/jemalloc/jemalloc.h ]; then
cp ${compile_dir}/build/include/jemalloc/jemalloc.h ${pkg_dir}${install_user_local_path}/include/jemalloc/ cp ${compile_dir}/build/include/jemalloc/jemalloc.h ${pkg_dir}${install_user_local_path}/include/jemalloc/
fi fi
if [ -f ${compile_dir}/build/lib/libjemalloc.so.2 ]; then if [ -f ${compile_dir}/build/lib/libjemalloc.so.2 ]; then
cp ${compile_dir}/build/lib/libjemalloc.so.2 ${pkg_dir}${install_user_local_path}/lib/ cp ${compile_dir}/build/lib/libjemalloc.so.2 ${pkg_dir}${install_user_local_path}/lib/
ln -sf libjemalloc.so.2 ${pkg_dir}${install_user_local_path}/lib/libjemalloc.so ln -sf libjemalloc.so.2 ${pkg_dir}${install_user_local_path}/lib/libjemalloc.so
fi fi
if [ -f ${compile_dir}/build/lib/libjemalloc.a ]; then if [ -f ${compile_dir}/build/lib/libjemalloc.a ]; then
cp ${compile_dir}/build/lib/libjemalloc.a ${pkg_dir}${install_user_local_path}/lib/ cp ${compile_dir}/build/lib/libjemalloc.a ${pkg_dir}${install_user_local_path}/lib/
fi fi
if [ -f ${compile_dir}/build/lib/libjemalloc_pic.a ]; then if [ -f ${compile_dir}/build/lib/libjemalloc_pic.a ]; then
cp ${compile_dir}/build/lib/libjemalloc_pic.a ${pkg_dir}${install_user_local_path}/lib/ cp ${compile_dir}/build/lib/libjemalloc_pic.a ${pkg_dir}${install_user_local_path}/lib/
fi fi
if [ -f ${compile_dir}/build/lib/pkgconfig/jemalloc.pc ]; then if [ -f ${compile_dir}/build/lib/pkgconfig/jemalloc.pc ]; then
cp ${compile_dir}/build/lib/pkgconfig/jemalloc.pc ${pkg_dir}${install_user_local_path}/lib/pkgconfig/ cp ${compile_dir}/build/lib/pkgconfig/jemalloc.pc ${pkg_dir}${install_user_local_path}/lib/pkgconfig/
fi fi
if [ -f ${compile_dir}/build/share/doc/jemalloc/jemalloc.html ]; then if [ -f ${compile_dir}/build/share/doc/jemalloc/jemalloc.html ]; then
cp ${compile_dir}/build/share/doc/jemalloc/jemalloc.html ${pkg_dir}${install_user_local_path}/share/doc/jemalloc/ cp ${compile_dir}/build/share/doc/jemalloc/jemalloc.html ${pkg_dir}${install_user_local_path}/share/doc/jemalloc/
fi fi
if [ -f ${compile_dir}/build/share/man/man3/jemalloc.3 ]; then if [ -f ${compile_dir}/build/share/man/man3/jemalloc.3 ]; then
cp ${compile_dir}/build/share/man/man3/jemalloc.3 ${pkg_dir}${install_user_local_path}/share/man/man3/ cp ${compile_dir}/build/share/man/man3/jemalloc.3 ${pkg_dir}${install_user_local_path}/share/man/man3/
fi fi
fi fi
cp -r ${compile_dir}/../packaging/deb/DEBIAN ${pkg_dir}/ cp -r ${compile_dir}/../packaging/deb/DEBIAN ${pkg_dir}/
chmod 755 ${pkg_dir}/DEBIAN/* chmod 755 ${pkg_dir}/DEBIAN/*
# modify version of control # modify version of control
debver="Version: "$tdengine_ver debver="Version: "$tdengine_ver
sed -i "2c$debver" ${pkg_dir}/DEBIAN/control sed -i "2c$debver" ${pkg_dir}/DEBIAN/control
#get taos version, then set deb name #get taos version, then set deb name
if [ "$verMode" == "cluster" ]; then if [ "$verMode" == "cluster" ]; then
debname="TDengine-server-"${tdengine_ver}-${osType}-${cpuType} debname="TDengine-server-"${tdengine_ver}-${osType}-${cpuType}
elif [ "$verMode" == "edge" ]; then elif [ "$verMode" == "edge" ]; then
debname="TDengine-server"-${tdengine_ver}-${osType}-${cpuType} debname="TDengine-server"-${tdengine_ver}-${osType}-${cpuType}
else else
echo "unknow verMode, nor cluster or edge" echo "unknow verMode, nor cluster or edge"
exit 1 exit 1
fi fi
if [ "$verType" == "beta" ]; then if [ "$verType" == "beta" ]; then
debname="TDengine-server-"${tdengine_ver}-${verType}-${osType}-${cpuType}".deb" debname="TDengine-server-"${tdengine_ver}-${verType}-${osType}-${cpuType}".deb"
elif [ "$verType" == "stable" ]; then elif [ "$verType" == "stable" ]; then
debname=${debname}".deb" debname=${debname}".deb"
else else
echo "unknow verType, nor stabel or beta" echo "unknow verType, nor stabel or beta"
exit 1 exit 1
fi fi
# make deb package # make deb package
dpkg -b ${pkg_dir} $debname dpkg -b ${pkg_dir} $debname
echo "make deb package success!" echo "make deb package success!"
cp ${pkg_dir}/*.deb ${output_dir} cp ${pkg_dir}/*.deb ${output_dir}
# clean temp dir # clean temp dir
rm -rf ${pkg_dir} rm -rf ${pkg_dir}
#!/bin/bash #!/bin/bash
# #
# Modified from original source: Elastic Search # Modified from original source: Elastic Search
# https://github.com/elasticsearch/elasticsearch # https://github.com/elasticsearch/elasticsearch
# Thank you to the Elastic Search authors # Thank you to the Elastic Search authors
# #
# chkconfig: 2345 99 01 # chkconfig: 2345 99 01
# #
### BEGIN INIT INFO ### BEGIN INIT INFO
# Provides: TDengine # Provides: TDengine
# Required-Start: $local_fs $network $syslog # Required-Start: $local_fs $network $syslog
# Required-Stop: $local_fs $network $syslog # Required-Stop: $local_fs $network $syslog
# Default-Start: 2 3 4 5 # Default-Start: 2 3 4 5
# Default-Stop: 0 1 6 # Default-Stop: 0 1 6
# Short-Description: Starts TDengine taosd # Short-Description: Starts TDengine taosd
# Description: Starts TDengine taosd, a time-series database engine # Description: Starts TDengine taosd, a time-series database engine
### END INIT INFO ### END INIT INFO
set -e set -e
PATH="/bin:/usr/bin:/sbin:/usr/sbin" PATH="/bin:/usr/bin:/sbin:/usr/sbin"
NAME="TDengine" NAME="TDengine"
USER="root" USER="root"
GROUP="root" GROUP="root"
DAEMON="/usr/local/taos/bin/taosd" DAEMON="/usr/local/taos/bin/taosd"
DAEMON_OPTS="" DAEMON_OPTS=""
HTTPD_NAME="taosadapter" HTTPD_NAME="taosadapter"
DAEMON_HTTPD_NAME=$HTTPD_NAME DAEMON_HTTPD_NAME=$HTTPD_NAME
DAEMON_HTTPD="/usr/local/taos/bin/$HTTPD_NAME" DAEMON_HTTPD="/usr/local/taos/bin/$HTTPD_NAME"
PID_FILE="/var/run/$NAME.pid" PID_FILE="/var/run/$NAME.pid"
APPARGS="" APPARGS=""
# Maximum number of open files # Maximum number of open files
MAX_OPEN_FILES=65535 MAX_OPEN_FILES=65535
. /lib/lsb/init-functions . /lib/lsb/init-functions
case "$1" in case "$1" in
start) start)
log_action_begin_msg "Starting TDengine..." log_action_begin_msg "Starting TDengine..."
$DAEMON_HTTPD & $DAEMON_HTTPD &
if start-stop-daemon --test --start --chuid "$USER:$GROUP" --background --make-pidfile --pidfile "$PID_FILE" --exec "$DAEMON" -- $APPARGS &> /dev/null; then 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" touch "$PID_FILE" && chown "$USER":"$GROUP" "$PID_FILE"
if [ -n "$MAX_OPEN_FILES" ]; then if [ -n "$MAX_OPEN_FILES" ]; then
ulimit -n $MAX_OPEN_FILES ulimit -n $MAX_OPEN_FILES
fi fi
start-stop-daemon --start --chuid "$USER:$GROUP" --background --make-pidfile --pidfile "$PID_FILE" --exec "$DAEMON" -- $APPARGS start-stop-daemon --start --chuid "$USER:$GROUP" --background --make-pidfile --pidfile "$PID_FILE" --exec "$DAEMON" -- $APPARGS
log_end_msg $? log_end_msg $?
fi fi
;; ;;
stop) stop)
log_action_begin_msg "Stopping TDengine..." log_action_begin_msg "Stopping TDengine..."
pkill -9 $DAEMON_HTTPD_NAME pkill -9 $DAEMON_HTTPD_NAME
set +e set +e
if [ -f "$PID_FILE" ]; then if [ -f "$PID_FILE" ]; then
start-stop-daemon --stop --pidfile "$PID_FILE" --user "$USER" --retry=TERM/120/KILL/5 > /dev/null start-stop-daemon --stop --pidfile "$PID_FILE" --user "$USER" --retry=TERM/120/KILL/5 > /dev/null
if [ $? -eq 1 ]; then if [ $? -eq 1 ]; then
log_action_cont_msg "TSD is not running but pid file exists, cleaning up" log_action_cont_msg "TSD is not running but pid file exists, cleaning up"
elif [ $? -eq 3 ]; then elif [ $? -eq 3 ]; then
PID="`cat $PID_FILE`" PID="`cat $PID_FILE`"
log_failure_msg "Failed to stop TDengine (pid $PID)" log_failure_msg "Failed to stop TDengine (pid $PID)"
exit 1 exit 1
fi fi
rm -f "$PID_FILE" rm -f "$PID_FILE"
else else
log_action_cont_msg "TDengine was not running" log_action_cont_msg "TDengine was not running"
fi fi
log_action_end_msg 0 log_action_end_msg 0
set -e set -e
;; ;;
restart|force-reload) restart|force-reload)
if [ -f "$PID_FILE" ]; then if [ -f "$PID_FILE" ]; then
$0 stop $0 stop
sleep 1 sleep 1
fi fi
$0 start $0 start
;; ;;
status) status)
status_of_proc -p "$PID_FILE" "$DAEMON" "$NAME" status_of_proc -p "$PID_FILE" "$DAEMON" "$NAME"
;; ;;
*) *)
exit 1 exit 1
;; ;;
esac esac
exit 0 exit 0
#!/bin/bash #!/bin/bash
# #
# Modified from original source: Elastic Search # Modified from original source: Elastic Search
# https://github.com/elasticsearch/elasticsearch # https://github.com/elasticsearch/elasticsearch
# Thank you to the Elastic Search authors # Thank you to the Elastic Search authors
# #
# chkconfig: 2345 99 01 # chkconfig: 2345 99 01
# #
### BEGIN INIT INFO ### BEGIN INIT INFO
# Provides: taoscluster # Provides: taoscluster
# Required-Start: $local_fs $network $syslog # Required-Start: $local_fs $network $syslog
# Required-Stop: $local_fs $network $syslog # Required-Stop: $local_fs $network $syslog
# Default-Start: 2 3 4 5 # Default-Start: 2 3 4 5
# Default-Stop: 0 1 6 # Default-Stop: 0 1 6
# Short-Description: Starts taoscluster tarbitrator # Short-Description: Starts taoscluster tarbitrator
# Description: Starts taoscluster tarbitrator, a arbitrator # Description: Starts taoscluster tarbitrator, a arbitrator
### END INIT INFO ### END INIT INFO
set -e set -e
PATH="/bin:/usr/bin:/sbin:/usr/sbin" PATH="/bin:/usr/bin:/sbin:/usr/sbin"
NAME="taoscluster" NAME="taoscluster"
USER="root" USER="root"
GROUP="root" GROUP="root"
DAEMON="/usr/local/taos/bin/tarbitrator" DAEMON="/usr/local/taos/bin/tarbitrator"
DAEMON_OPTS="" DAEMON_OPTS=""
PID_FILE="/var/run/$NAME.pid" PID_FILE="/var/run/$NAME.pid"
APPARGS="" APPARGS=""
# Maximum number of open files # Maximum number of open files
MAX_OPEN_FILES=65535 MAX_OPEN_FILES=65535
. /lib/lsb/init-functions . /lib/lsb/init-functions
case "$1" in case "$1" in
start) start)
log_action_begin_msg "Starting tarbitrator..." log_action_begin_msg "Starting tarbitrator..."
if start-stop-daemon --test --start --chuid "$USER:$GROUP" --background --make-pidfile --pidfile "$PID_FILE" --exec "$DAEMON" -- $APPARGS &> /dev/null; then 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" touch "$PID_FILE" && chown "$USER":"$GROUP" "$PID_FILE"
if [ -n "$MAX_OPEN_FILES" ]; then if [ -n "$MAX_OPEN_FILES" ]; then
ulimit -n $MAX_OPEN_FILES ulimit -n $MAX_OPEN_FILES
fi fi
start-stop-daemon --start --chuid "$USER:$GROUP" --background --make-pidfile --pidfile "$PID_FILE" --exec "$DAEMON" -- $APPARGS start-stop-daemon --start --chuid "$USER:$GROUP" --background --make-pidfile --pidfile "$PID_FILE" --exec "$DAEMON" -- $APPARGS
log_end_msg $? log_end_msg $?
fi fi
;; ;;
stop) stop)
log_action_begin_msg "Stopping tarbitrator..." log_action_begin_msg "Stopping tarbitrator..."
set +e set +e
if [ -f "$PID_FILE" ]; then if [ -f "$PID_FILE" ]; then
start-stop-daemon --stop --pidfile "$PID_FILE" --user "$USER" --retry=TERM/120/KILL/5 > /dev/null start-stop-daemon --stop --pidfile "$PID_FILE" --user "$USER" --retry=TERM/120/KILL/5 > /dev/null
if [ $? -eq 1 ]; then if [ $? -eq 1 ]; then
log_action_cont_msg "TSD is not running but pid file exists, cleaning up" log_action_cont_msg "TSD is not running but pid file exists, cleaning up"
elif [ $? -eq 3 ]; then elif [ $? -eq 3 ]; then
PID="`cat $PID_FILE`" PID="`cat $PID_FILE`"
log_failure_msg "Failed to stop tarbitrator (pid $PID)" log_failure_msg "Failed to stop tarbitrator (pid $PID)"
exit 1 exit 1
fi fi
rm -f "$PID_FILE" rm -f "$PID_FILE"
else else
log_action_cont_msg "tarbitrator was not running" log_action_cont_msg "tarbitrator was not running"
fi fi
log_action_end_msg 0 log_action_end_msg 0
set -e set -e
;; ;;
restart|force-reload) restart|force-reload)
if [ -f "$PID_FILE" ]; then if [ -f "$PID_FILE" ]; then
$0 stop $0 stop
sleep 1 sleep 1
fi fi
$0 start $0 start
;; ;;
status) status)
status_of_proc -p "$PID_FILE" "$DAEMON" "$NAME" status_of_proc -p "$PID_FILE" "$DAEMON" "$NAME"
;; ;;
*) *)
exit 1 exit 1
;; ;;
esac esac
exit 0 exit 0
FROM ubuntu:18.04 FROM ubuntu:18.04
WORKDIR /root WORKDIR /root
ARG pkgFile ARG pkgFile
ARG dirName ARG dirName
ARG cpuType ARG cpuType
RUN echo ${pkgFile} && echo ${dirName} RUN echo ${pkgFile} && echo ${dirName}
COPY ${pkgFile} /root/ COPY ${pkgFile} /root/
RUN tar -zxf ${pkgFile} RUN tar -zxf ${pkgFile}
WORKDIR /root/ WORKDIR /root/
RUN cd /root/${dirName}/ && /bin/bash install.sh -e no && cd /root RUN cd /root/${dirName}/ && /bin/bash install.sh -e no && cd /root
RUN rm /root/${pkgFile} RUN rm /root/${pkgFile}
RUN rm -rf /root/${dirName} RUN rm -rf /root/${dirName}
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get clean && apt-get update && apt-get install -y locales tzdata netcat && locale-gen en_US.UTF-8 RUN apt-get clean && apt-get update && apt-get install -y locales tzdata netcat && locale-gen en_US.UTF-8
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib" \ ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib" \
LC_CTYPE=en_US.UTF-8 \ LC_CTYPE=en_US.UTF-8 \
LANG=en_US.UTF-8 \ LANG=en_US.UTF-8 \
LC_ALL=en_US.UTF-8 LC_ALL=en_US.UTF-8
COPY ./bin/* /usr/bin/ COPY ./bin/* /usr/bin/
ENV TINI_VERSION v0.19.0 ENV TINI_VERSION v0.19.0
RUN bash -c 'echo -e "Downloading tini-${cpuType} ..."' RUN bash -c 'echo -e "Downloading tini-${cpuType} ..."'
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${cpuType} /tini ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${cpuType} /tini
RUN chmod +x /tini RUN chmod +x /tini
ENTRYPOINT ["/tini", "--", "/usr/bin/entrypoint.sh"] ENTRYPOINT ["/tini", "--", "/usr/bin/entrypoint.sh"]
CMD ["taosd"] CMD ["taosd"]
VOLUME [ "/var/lib/taos", "/var/log/taos", "/corefile" ] VOLUME [ "/var/lib/taos", "/var/log/taos", "/corefile" ]
此差异已折叠。
#!/bin/sh #!/bin/sh
set -e set -e
# for TZ awareness # for TZ awareness
if [ "$TZ" != "" ]; then if [ "$TZ" != "" ]; then
ln -sf /usr/share/zoneinfo/$TZ /etc/localtime ln -sf /usr/share/zoneinfo/$TZ /etc/localtime
echo $TZ >/etc/timezone echo $TZ >/etc/timezone
fi fi
# option to disable taosadapter, default is no # option to disable taosadapter, default is no
DISABLE_ADAPTER=${TAOS_DISABLE_ADAPTER:-0} DISABLE_ADAPTER=${TAOS_DISABLE_ADAPTER:-0}
unset TAOS_DISABLE_ADAPTER unset TAOS_DISABLE_ADAPTER
# to get mnodeEpSet from data dir # to get mnodeEpSet from data dir
DATA_DIR=${TAOS_DATA_DIR:-/var/lib/taos} DATA_DIR=${TAOS_DATA_DIR:-/var/lib/taos}
# append env to custom taos.cfg # append env to custom taos.cfg
CFG_DIR=/tmp/taos CFG_DIR=/tmp/taos
CFG_FILE=$CFG_DIR/taos.cfg CFG_FILE=$CFG_DIR/taos.cfg
mkdir -p $CFG_DIR >/dev/null 2>&1 mkdir -p $CFG_DIR >/dev/null 2>&1
[ -f /etc/taos/taos.cfg ] && cat /etc/taos/taos.cfg | grep -E -v "^#|^\s*$" >$CFG_FILE [ -f /etc/taos/taos.cfg ] && cat /etc/taos/taos.cfg | grep -E -v "^#|^\s*$" >$CFG_FILE
env-to-cfg >>$CFG_FILE env-to-cfg >>$CFG_FILE
FQDN=$(cat $CFG_FILE | grep -E -v "^#|^$" | grep fqdn | tail -n1 | sed -E 's/.*fqdn\s+//') FQDN=$(cat $CFG_FILE | grep -E -v "^#|^$" | grep fqdn | tail -n1 | sed -E 's/.*fqdn\s+//')
# ensure the fqdn is resolved as localhost # ensure the fqdn is resolved as localhost
grep "$FQDN" /etc/hosts >/dev/null || echo "127.0.0.1 $FQDN" >>/etc/hosts grep "$FQDN" /etc/hosts >/dev/null || echo "127.0.0.1 $FQDN" >>/etc/hosts
# parse first ep host and port # parse first ep host and port
FIRST_EP_HOST=${TAOS_FIRST_EP%:*} FIRST_EP_HOST=${TAOS_FIRST_EP%:*}
FIRST_EP_PORT=${TAOS_FIRST_EP#*:} FIRST_EP_PORT=${TAOS_FIRST_EP#*:}
# in case of custom server port # in case of custom server port
SERVER_PORT=$(cat $CFG_FILE | grep -E -v "^#|^$" | grep serverPort | tail -n1 | sed -E 's/.*serverPort\s+//') SERVER_PORT=$(cat $CFG_FILE | grep -E -v "^#|^$" | grep serverPort | tail -n1 | sed -E 's/.*serverPort\s+//')
SERVER_PORT=${SERVER_PORT:-6030} SERVER_PORT=${SERVER_PORT:-6030}
# for other binaries like interpreters # for other binaries like interpreters
if echo $1 | grep -E "taosd$" - >/dev/null; then if echo $1 | grep -E "taosd$" - >/dev/null; then
true # will run taosd true # will run taosd
else else
cp -f $CFG_FILE /etc/taos/taos.cfg || true cp -f $CFG_FILE /etc/taos/taos.cfg || true
$@ $@
exit $? exit $?
fi fi
set +e set +e
ulimit -c unlimited ulimit -c unlimited
# set core files pattern, maybe failed # set core files pattern, maybe failed
sysctl -w kernel.core_pattern=/corefile/core-$FQDN-%e-%p >/dev/null >&1 sysctl -w kernel.core_pattern=/corefile/core-$FQDN-%e-%p >/dev/null >&1
set -e set -e
if [ "$DISABLE_ADAPTER" = "0" ]; then if [ "$DISABLE_ADAPTER" = "0" ]; then
which taosadapter >/dev/null && taosadapter & which taosadapter >/dev/null && taosadapter &
# wait for 6041 port ready # wait for 6041 port ready
for _ in $(seq 1 20); do for _ in $(seq 1 20); do
nc -z localhost 6041 && break nc -z localhost 6041 && break
sleep 0.5 sleep 0.5
done done
fi fi
# if has mnode ep set or the host is first ep or not for cluster, just start. # if has mnode ep set or the host is first ep or not for cluster, just start.
if [ -f "$DATA_DIR/dnode/mnodeEpSet.json" ] || if [ -f "$DATA_DIR/dnode/mnodeEpSet.json" ] ||
[ "$TAOS_FQDN" = "$FIRST_EP_HOST" ]; then [ "$TAOS_FQDN" = "$FIRST_EP_HOST" ]; then
$@ -c $CFG_DIR $@ -c $CFG_DIR
# others will first wait the first ep ready. # others will first wait the first ep ready.
else else
if [ "$TAOS_FIRST_EP" = "" ]; then if [ "$TAOS_FIRST_EP" = "" ]; then
echo "run TDengine with single node." echo "run TDengine with single node."
$@ -c $CFG_DIR $@ -c $CFG_DIR
exit $? exit $?
fi fi
while true; do while true; do
es=0 es=0
taos -h $FIRST_EP_HOST -P $FIRST_EP_PORT -n startup >/dev/null || es=$? taos -h $FIRST_EP_HOST -P $FIRST_EP_PORT -n startup >/dev/null || es=$?
if [ "$es" -eq 0 ]; then if [ "$es" -eq 0 ]; then
taos -h $FIRST_EP_HOST -P $FIRST_EP_PORT -s "create dnode \"$FQDN:$SERVER_PORT\";" taos -h $FIRST_EP_HOST -P $FIRST_EP_PORT -s "create dnode \"$FQDN:$SERVER_PORT\";"
break break
fi fi
sleep 1s sleep 1s
done done
$@ -c $CFG_DIR $@ -c $CFG_DIR
fi fi
#!/bin/sh #!/bin/sh
set -e set -e
self=$0 self=$0
snake_to_camel_case() { snake_to_camel_case() {
echo $1 | awk -F _ '{printf "%s", $1; for(i=2; i<=NF; i++) printf "%s", toupper(substr($i,1,1)) substr($i,2); print"";}' echo $1 | awk -F _ '{printf "%s", $1; for(i=2; i<=NF; i++) printf "%s", toupper(substr($i,1,1)) substr($i,2); print"";}'
} }
if echo $1 | grep -E "^$" - >/dev/null; then if echo $1 | grep -E "^$" - >/dev/null; then
export |grep -E 'TAOS_.*' -o| sed 's/TAOS_//' |tr A-Z a-z | awk -F"=" '{print "name=$(""'$self' " $1"); echo $name "$2}' |sh export |grep -E 'TAOS_.*' -o| sed 's/TAOS_//' |tr A-Z a-z | awk -F"=" '{print "name=$(""'$self' " $1"); echo $name "$2}' |sh
else else
snake_to_camel_case $1 snake_to_camel_case $1
fi fi
version: "3" version: "3"
networks: networks:
inter: inter:
api: api:
services: services:
arbitrator: arbitrator:
image: tdengine/tdengine:$VERSION image: tdengine/tdengine:$VERSION
command: tarbitrator command: tarbitrator
networks: networks:
- inter - inter
td-1: td-1:
image: tdengine/tdengine:$VERSION image: tdengine/tdengine:$VERSION
networks: networks:
- inter - inter
environment: environment:
TAOS_FQDN: "td-1" TAOS_FQDN: "td-1"
TAOS_FIRST_EP: "td-1" TAOS_FIRST_EP: "td-1"
TAOS_NUM_OF_MNODES: "2" TAOS_NUM_OF_MNODES: "2"
TAOS_REPLICA: "2" TAOS_REPLICA: "2"
TAOS_ARBITRATOR: arbitrator:6042 TAOS_ARBITRATOR: arbitrator:6042
volumes: volumes:
- taosdata-td1:/var/lib/taos/ - taosdata-td1:/var/lib/taos/
- taoslog-td1:/var/log/taos/ - taoslog-td1:/var/log/taos/
td-2: td-2:
image: tdengine/tdengine:$VERSION image: tdengine/tdengine:$VERSION
networks: networks:
- inter - inter
environment: environment:
TAOS_FQDN: "td-2" TAOS_FQDN: "td-2"
TAOS_FIRST_EP: "td-1" TAOS_FIRST_EP: "td-1"
TAOS_NUM_OF_MNODES: "2" TAOS_NUM_OF_MNODES: "2"
TAOS_REPLICA: "2" TAOS_REPLICA: "2"
TAOS_ARBITRATOR: arbitrator:6042 TAOS_ARBITRATOR: arbitrator:6042
volumes: volumes:
- taosdata-td2:/var/lib/taos/ - taosdata-td2:/var/lib/taos/
- taoslog-td2:/var/log/taos/ - taoslog-td2:/var/log/taos/
adapter: adapter:
image: tdengine/tdengine:$VERSION image: tdengine/tdengine:$VERSION
command: taosadapter command: taosadapter
networks: networks:
- inter - inter
environment: environment:
TAOS_FIRST_EP: "td-1" TAOS_FIRST_EP: "td-1"
TOAS_SECOND_EP: "td-2" TOAS_SECOND_EP: "td-2"
deploy: deploy:
replicas: 4 replicas: 4
update_config: update_config:
parallelism: 4 parallelism: 4
nginx: nginx:
image: nginx image: nginx
depends_on: depends_on:
- adapter - adapter
networks: networks:
- inter - inter
- api - api
ports: ports:
- 6041:6041 - 6041:6041
- 6044:6044/udp - 6044:6044/udp
command: [ command: [
"sh", "sh",
"-c", "-c",
"while true; "while true;
do curl -s http://adapter:6041/-/ping >/dev/null && break; do curl -s http://adapter:6041/-/ping >/dev/null && break;
done; done;
printf 'server{listen 6041;location /{proxy_pass http://adapter:6041;}}' printf 'server{listen 6041;location /{proxy_pass http://adapter:6041;}}'
> /etc/nginx/conf.d/rest.conf; > /etc/nginx/conf.d/rest.conf;
printf 'stream{server{listen 6044 udp;proxy_pass adapter:6044;}}' printf 'stream{server{listen 6044 udp;proxy_pass adapter:6044;}}'
>> /etc/nginx/nginx.conf;cat /etc/nginx/nginx.conf; >> /etc/nginx/nginx.conf;cat /etc/nginx/nginx.conf;
nginx -g 'daemon off;'", nginx -g 'daemon off;'",
] ]
volumes: volumes:
taosdata-td1: taosdata-td1:
taoslog-td1: taoslog-td1:
taosdata-td2: taosdata-td2:
taoslog-td2: taoslog-td2:
#!/bin/bash #!/bin/bash
set -e set -e
#set -x #set -x
# dockerbuild.sh # dockerbuild.sh
# -n [version number] # -n [version number]
# -p [xxxx] # -p [xxxx]
# -V [stable | beta] # -V [stable | beta]
# set parameters by default value # set parameters by default value
version="" version=""
passWord="" passWord=""
verType="" verType=""
while getopts "hn:p:V:" arg while getopts "hn:p:V:" arg
do do
case $arg in case $arg in
n) n)
#echo "version=$OPTARG" #echo "version=$OPTARG"
version=$(echo $OPTARG) version=$(echo $OPTARG)
;; ;;
p) p)
#echo "passWord=$OPTARG" #echo "passWord=$OPTARG"
passWord=$(echo $OPTARG) passWord=$(echo $OPTARG)
;; ;;
V) V)
#echo "verType=$OPTARG" #echo "verType=$OPTARG"
verType=$(echo $OPTARG) verType=$(echo $OPTARG)
;; ;;
h) h)
echo "Usage: `basename $0` -n [version number] " echo "Usage: `basename $0` -n [version number] "
echo " -p [password for docker hub] " echo " -p [password for docker hub] "
exit 0 exit 0
;; ;;
?) #unknow option ?) #unknow option
echo "unkonw argument" echo "unkonw argument"
exit 1 exit 1
;; ;;
esac esac
done done
echo "version=${version}" echo "version=${version}"
#docker manifest rm tdengine/tdengine #docker manifest rm tdengine/tdengine
#docker manifest rm tdengine/tdengine:${version} #docker manifest rm tdengine/tdengine:${version}
if [ "$verType" == "beta" ]; then if [ "$verType" == "beta" ]; then
docker manifest create -a tdengine/tdengine-beta:${version} tdengine/tdengine-amd64-beta:${version} tdengine/tdengine-aarch64-beta:${version} tdengine/tdengine-aarch32-beta:${version} docker manifest create -a tdengine/tdengine-beta:${version} tdengine/tdengine-amd64-beta:${version} tdengine/tdengine-aarch64-beta:${version} tdengine/tdengine-aarch32-beta:${version}
docker manifest create -a tdengine/tdengine-beta:latest tdengine/tdengine-amd64-beta:latest tdengine/tdengine-aarch64-beta:latest tdengine/tdengine-aarch32-beta:latest docker manifest create -a tdengine/tdengine-beta:latest tdengine/tdengine-amd64-beta:latest tdengine/tdengine-aarch64-beta:latest tdengine/tdengine-aarch32-beta:latest
docker manifest rm tdengine/tdengine-beta:${version} docker manifest rm tdengine/tdengine-beta:${version}
docker manifest rm tdengine/tdengine-beta:latest docker manifest rm tdengine/tdengine-beta:latest
docker manifest create -a tdengine/tdengine-beta:${version} tdengine/tdengine-amd64-beta:${version} tdengine/tdengine-aarch64-beta:${version} tdengine/tdengine-aarch32-beta:${version} docker manifest create -a tdengine/tdengine-beta:${version} tdengine/tdengine-amd64-beta:${version} tdengine/tdengine-aarch64-beta:${version} tdengine/tdengine-aarch32-beta:${version}
docker manifest create -a tdengine/tdengine-beta:latest tdengine/tdengine-amd64-beta:latest tdengine/tdengine-aarch64-beta:latest tdengine/tdengine-aarch32-beta:latest docker manifest create -a tdengine/tdengine-beta:latest tdengine/tdengine-amd64-beta:latest tdengine/tdengine-aarch64-beta:latest tdengine/tdengine-aarch32-beta:latest
docker manifest inspect tdengine/tdengine:latest docker manifest inspect tdengine/tdengine:latest
docker manifest inspect tdengine/tdengine:${version} docker manifest inspect tdengine/tdengine:${version}
docker login -u tdengine -p ${passWord} #replace the docker registry username and password docker login -u tdengine -p ${passWord} #replace the docker registry username and password
docker manifest push tdengine/tdengine-beta:${version} docker manifest push tdengine/tdengine-beta:${version}
docker manifest push tdengine/tdengine-beta:latest docker manifest push tdengine/tdengine-beta:latest
elif [ "$verType" == "stable" ]; then elif [ "$verType" == "stable" ]; then
docker manifest create -a tdengine/tdengine:${version} tdengine/tdengine-amd64:${version} tdengine/tdengine-aarch64:${version} tdengine/tdengine-aarch32:${version} docker manifest create -a tdengine/tdengine:${version} tdengine/tdengine-amd64:${version} tdengine/tdengine-aarch64:${version} tdengine/tdengine-aarch32:${version}
docker manifest create -a tdengine/tdengine:latest tdengine/tdengine-amd64:latest tdengine/tdengine-aarch64:latest tdengine/tdengine-aarch32:latest docker manifest create -a tdengine/tdengine:latest tdengine/tdengine-amd64:latest tdengine/tdengine-aarch64:latest tdengine/tdengine-aarch32:latest
docker manifest rm tdengine/tdengine:latest docker manifest rm tdengine/tdengine:latest
docker manifest rm tdengine/tdengine:${version} docker manifest rm tdengine/tdengine:${version}
docker manifest create -a tdengine/tdengine:${version} tdengine/tdengine-amd64:${version} tdengine/tdengine-aarch64:${version} tdengine/tdengine-aarch32:${version} docker manifest create -a tdengine/tdengine:${version} tdengine/tdengine-amd64:${version} tdengine/tdengine-aarch64:${version} tdengine/tdengine-aarch32:${version}
docker manifest create -a tdengine/tdengine:latest tdengine/tdengine-amd64:latest tdengine/tdengine-aarch64:latest tdengine/tdengine-aarch32:latest docker manifest create -a tdengine/tdengine:latest tdengine/tdengine-amd64:latest tdengine/tdengine-aarch64:latest tdengine/tdengine-aarch32:latest
docker manifest inspect tdengine/tdengine:latest docker manifest inspect tdengine/tdengine:latest
docker manifest inspect tdengine/tdengine:${version} docker manifest inspect tdengine/tdengine:${version}
docker login -u tdengine -p ${passWord} #replace the docker registry username and password docker login -u tdengine -p ${passWord} #replace the docker registry username and password
docker manifest push tdengine/tdengine:${version} docker manifest push tdengine/tdengine:${version}
docker manifest push tdengine/tdengine:latest docker manifest push tdengine/tdengine:latest
else else
echo "unknow verType, nor stabel or beta" echo "unknow verType, nor stabel or beta"
exit 1 exit 1
fi fi
# docker manifest create -a tdengine/${dockername}:${version} tdengine/tdengine-amd64:${version} tdengine/tdengine-aarch64:${version} tdengine/tdengine-aarch32:${version} # docker manifest create -a tdengine/${dockername}:${version} tdengine/tdengine-amd64:${version} tdengine/tdengine-aarch64:${version} tdengine/tdengine-aarch32:${version}
# docker manifest create -a tdengine/${dockername}:latest tdengine/tdengine-amd64:latest tdengine/tdengine-aarch64:latest tdengine/tdengine-aarch32:latest # docker manifest create -a tdengine/${dockername}:latest tdengine/tdengine-amd64:latest tdengine/tdengine-aarch64:latest tdengine/tdengine-aarch32:latest
# docker login -u tdengine -p ${passWord} #replace the docker registry username and password # docker login -u tdengine -p ${passWord} #replace the docker registry username and password
# docker manifest push tdengine/tdengine:latest # docker manifest push tdengine/tdengine:latest
# # how set latest version ??? # # how set latest version ???
#!/bin/bash #!/bin/bash
# #
set -e set -e
#set -x #set -x
# dockerbuild.sh # dockerbuild.sh
# -c [aarch32 | aarch64 | amd64 | x86 | mips64 ...] # -c [aarch32 | aarch64 | amd64 | x86 | mips64 ...]
# -n [version number] # -n [version number]
# -p [password for docker hub] # -p [password for docker hub]
# -V [stable | beta] # -V [stable | beta]
# -f [pkg file] # -f [pkg file]
# set parameters by default value # set parameters by default value
cpuType="" cpuType=""
cpuTypeAlias="" cpuTypeAlias=""
version="" version=""
passWord="" passWord=""
pkgFile="" pkgFile=""
verType="stable" verType="stable"
dockerLatest="n" dockerLatest="n"
while getopts "hc:n:p:f:V:a:b:" arg while getopts "hc:n:p:f:V:a:b:" arg
do do
case $arg in case $arg in
c) c)
#echo "cpuType=$OPTARG" #echo "cpuType=$OPTARG"
cpuType=$(echo $OPTARG) cpuType=$(echo $OPTARG)
;; ;;
n) n)
#echo "version=$OPTARG" #echo "version=$OPTARG"
version=$(echo $OPTARG) version=$(echo $OPTARG)
;; ;;
p) p)
#echo "passWord=$OPTARG" #echo "passWord=$OPTARG"
passWord=$(echo $OPTARG) passWord=$(echo $OPTARG)
;; ;;
f) f)
#echo "pkgFile=$OPTARG" #echo "pkgFile=$OPTARG"
pkgFile=$(echo $OPTARG) pkgFile=$(echo $OPTARG)
;; ;;
b) b)
#echo "branchName=$OPTARG" #echo "branchName=$OPTARG"
branchName=$(echo $OPTARG) branchName=$(echo $OPTARG)
;; ;;
V) V)
#echo "verType=$OPTARG" #echo "verType=$OPTARG"
verType=$(echo $OPTARG) verType=$(echo $OPTARG)
;; ;;
a) a)
#echo "dockerLatest=$OPTARG" #echo "dockerLatest=$OPTARG"
dockerLatest=$(echo $OPTARG) dockerLatest=$(echo $OPTARG)
;; ;;
h) h)
echo "Usage: `basename $0` -c [aarch32 | aarch64 | amd64 | x86 | mips64 ...] " echo "Usage: `basename $0` -c [aarch32 | aarch64 | amd64 | x86 | mips64 ...] "
echo " -n [version number] " echo " -n [version number] "
echo " -p [password for docker hub] " echo " -p [password for docker hub] "
echo " -V [stable | beta] " echo " -V [stable | beta] "
echo " -f [pkg file] " echo " -f [pkg file] "
echo " -a [y | n ] " echo " -a [y | n ] "
exit 0 exit 0
;; ;;
?) #unknow option ?) #unknow option
echo "unkonw argument" echo "unkonw argument"
exit 1 exit 1
;; ;;
esac esac
done done
# Check_verison() # Check_verison()
# { # {
# } # }
if [ "$verType" == "beta" ]; then if [ "$verType" == "beta" ]; then
dockername=${cpuType}-${verType} dockername=${cpuType}-${verType}
dirName=${pkgFile%-beta*} dirName=${pkgFile%-beta*}
elif [ "$verType" == "stable" ]; then elif [ "$verType" == "stable" ]; then
dockername=${cpuType} dockername=${cpuType}
dirName=${pkgFile%-Linux*} dirName=${pkgFile%-Linux*}
else else
echo "unknow verType, nor stabel or beta" echo "unknow verType, nor stabel or beta"
exit 1 exit 1
fi fi
echo "cpuType=${cpuType} version=${version} pkgFile=${pkgFile} verType=${verType} " echo "cpuType=${cpuType} version=${version} pkgFile=${pkgFile} verType=${verType} "
echo "$(pwd)" echo "$(pwd)"
echo "====NOTES: ${pkgFile} must be in the same directory as dockerbuild.sh====" echo "====NOTES: ${pkgFile} must be in the same directory as dockerbuild.sh===="
scriptDir=$(dirname $(readlink -f $0)) scriptDir=$(dirname $(readlink -f $0))
comunityArchiveDir=/nas/TDengine/v$version/community # community version’package directory comunityArchiveDir=/nas/TDengine/v$version/community # community version’package directory
communityDir=${scriptDir}/../../../community communityDir=${scriptDir}/../../../community
DockerfilePath=${communityDir}/packaging/docker/ DockerfilePath=${communityDir}/packaging/docker/
Dockerfile=${communityDir}/packaging/docker/Dockerfile Dockerfile=${communityDir}/packaging/docker/Dockerfile
cd ${scriptDir} cd ${scriptDir}
cp -f ${comunityArchiveDir}/${pkgFile} . cp -f ${comunityArchiveDir}/${pkgFile} .
echo "dirName=${dirName}" echo "dirName=${dirName}"
if [[ "${cpuType}" == "x64" ]] || [[ "${cpuType}" == "amd64" ]]; then if [[ "${cpuType}" == "x64" ]] || [[ "${cpuType}" == "amd64" ]]; then
cpuTypeAlias="amd64" cpuTypeAlias="amd64"
elif [[ "${cpuType}" == "aarch64" ]]; then elif [[ "${cpuType}" == "aarch64" ]]; then
cpuTypeAlias="arm64" cpuTypeAlias="arm64"
elif [[ "${cpuType}" == "aarch32" ]]; then elif [[ "${cpuType}" == "aarch32" ]]; then
cpuTypeAlias="armhf" cpuTypeAlias="armhf"
else else
echo "Unknown cpuType: ${cpuType}" echo "Unknown cpuType: ${cpuType}"
exit 1 exit 1
fi fi
docker build --rm -f "${Dockerfile}" --network=host -t tdengine/tdengine-${dockername}:${version} "." --build-arg pkgFile=${pkgFile} --build-arg dirName=${dirName} --build-arg cpuType=${cpuTypeAlias} docker build --rm -f "${Dockerfile}" --network=host -t tdengine/tdengine-${dockername}:${version} "." --build-arg pkgFile=${pkgFile} --build-arg dirName=${dirName} --build-arg cpuType=${cpuTypeAlias}
docker login -u tdengine -p ${passWord} #replace the docker registry username and password docker login -u tdengine -p ${passWord} #replace the docker registry username and password
docker push tdengine/tdengine-${dockername}:${version} docker push tdengine/tdengine-${dockername}:${version}
if [ -n "$(docker ps -aq)" ] ;then if [ -n "$(docker ps -aq)" ] ;then
echo "delete docker process" echo "delete docker process"
docker stop $(docker ps -aq) docker stop $(docker ps -aq)
docker rm $(docker ps -aq) docker rm $(docker ps -aq)
fi fi
if [ -n "$(pidof taosd)" ] ;then if [ -n "$(pidof taosd)" ] ;then
echo "kill taosd " echo "kill taosd "
kill -9 $(pidof taosd) kill -9 $(pidof taosd)
fi fi
if [ -n "$(pidof power)" ] ;then if [ -n "$(pidof power)" ] ;then
echo "kill power " echo "kill power "
kill -9 $(pidof power) kill -9 $(pidof power)
fi fi
echo ">>>>>>>>>>>>> check whether tdengine/tdengine-${dockername}:${version} has been published" echo ">>>>>>>>>>>>> check whether tdengine/tdengine-${dockername}:${version} has been published"
docker run -d --name doctest -p 6030-6049:6030-6049 -p 6030-6049:6030-6049/udp tdengine/tdengine-${dockername}:${version} docker run -d --name doctest -p 6030-6049:6030-6049 -p 6030-6049:6030-6049/udp tdengine/tdengine-${dockername}:${version}
sleep 2 sleep 2
curl -u root:taosdata -d 'show variables;' 127.0.0.1:6041/rest/sql > temp1.data curl -u root:taosdata -d 'show variables;' 127.0.0.1:6041/rest/sql > temp1.data
data_version=$( cat temp1.data |jq .data| jq '.[]' |grep "version" -A 2 -B 1 | jq ".[1]") data_version=$( cat temp1.data |jq .data| jq '.[]' |grep "version" -A 2 -B 1 | jq ".[1]")
echo "${data_version}" echo "${data_version}"
if [ "${data_version}" == "\"${version}\"" ] ; then if [ "${data_version}" == "\"${version}\"" ] ; then
echo "docker version is right " echo "docker version is right "
else else
echo "docker version is wrong " echo "docker version is wrong "
exit 1 exit 1
fi fi
rm -rf temp1.data rm -rf temp1.data
# set this version to latest version # set this version to latest version
if [ ${dockerLatest} == 'y' ] ;then if [ ${dockerLatest} == 'y' ] ;then
docker tag tdengine/tdengine-${dockername}:${version} tdengine/tdengine-${dockername}:latest docker tag tdengine/tdengine-${dockername}:${version} tdengine/tdengine-${dockername}:latest
docker push tdengine/tdengine-${dockername}:latest docker push tdengine/tdengine-${dockername}:latest
echo ">>>>>>>>>>>>> check whether tdengine/tdengine-${dockername}:latest has been published correctly" echo ">>>>>>>>>>>>> check whether tdengine/tdengine-${dockername}:latest has been published correctly"
docker run -d --name doctestla -p 7030-7049:6030-6049 -p 7030-7049:6030-6049/udp tdengine/tdengine-${dockername}:latest docker run -d --name doctestla -p 7030-7049:6030-6049 -p 7030-7049:6030-6049/udp tdengine/tdengine-${dockername}:latest
sleep 2 sleep 2
curl -u root:taosdata -d 'show variables;' 127.0.0.1:7041/rest/sql > temp2.data curl -u root:taosdata -d 'show variables;' 127.0.0.1:7041/rest/sql > temp2.data
version_latest=` cat temp2.data |jq .data| jq '.[]' |grep "version" -A 2 -B 1 | jq ".[1]" ` version_latest=` cat temp2.data |jq .data| jq '.[]' |grep "version" -A 2 -B 1 | jq ".[1]" `
echo "${version_latest}" echo "${version_latest}"
if [ "${version_latest}" == "\"${version}\"" ] ; then if [ "${version_latest}" == "\"${version}\"" ] ; then
echo "docker version is right " echo "docker version is right "
else else
echo "docker version is wrong " echo "docker version is wrong "
exit 1 exit 1
fi fi
fi fi
rm -rf temp2.data rm -rf temp2.data
if [ -n "$(docker ps -aq)" ] ;then if [ -n "$(docker ps -aq)" ] ;then
echo "delte docker process" echo "delte docker process"
docker stop $(docker ps -aq) docker stop $(docker ps -aq)
docker rm $(docker ps -aq) docker rm $(docker ps -aq)
fi fi
cd ${scriptDir} cd ${scriptDir}
rm -f ${pkgFile} rm -f ${pkgFile}
#!/bin/bash #!/bin/bash
# #
set -e set -e
#set -x #set -x
# dockerbuild.sh # dockerbuild.sh
# -c [aarch32 | aarch64 | amd64 | x86 | mips64 ...] # -c [aarch32 | aarch64 | amd64 | x86 | mips64 ...]
# -n [version number] # -n [version number]
# -p [password for docker hub] # -p [password for docker hub]
# set parameters by default value # set parameters by default value
cpuType=aarch64 cpuType=aarch64
verNumber="" verNumber=""
passWord="" passWord=""
while getopts "hc:n:p:f:" arg while getopts "hc:n:p:f:" arg
do do
case $arg in case $arg in
c) c)
#echo "cpuType=$OPTARG" #echo "cpuType=$OPTARG"
cpuType=$(echo $OPTARG) cpuType=$(echo $OPTARG)
;; ;;
n) n)
#echo "verNumber=$OPTARG" #echo "verNumber=$OPTARG"
verNumber=$(echo $OPTARG) verNumber=$(echo $OPTARG)
;; ;;
p) p)
#echo "passWord=$OPTARG" #echo "passWord=$OPTARG"
passWord=$(echo $OPTARG) passWord=$(echo $OPTARG)
;; ;;
h) h)
echo "Usage: `basename $0` -c [aarch32 | aarch64 | amd64 | x86 | mips64 ...] " echo "Usage: `basename $0` -c [aarch32 | aarch64 | amd64 | x86 | mips64 ...] "
echo " -n [version number] " echo " -n [version number] "
echo " -p [password for docker hub] " echo " -p [password for docker hub] "
exit 0 exit 0
;; ;;
?) #unknow option ?) #unknow option
echo "unkonw argument" echo "unkonw argument"
exit 1 exit 1
;; ;;
esac esac
done done
pkgFile=TDengine-server-${verNumber}-Linux-${cpuType}.tar.gz pkgFile=TDengine-server-${verNumber}-Linux-${cpuType}.tar.gz
echo "cpuType=${cpuType} verNumber=${verNumber} pkgFile=${pkgFile} " echo "cpuType=${cpuType} verNumber=${verNumber} pkgFile=${pkgFile} "
scriptDir=`pwd` scriptDir=`pwd`
pkgDir=$scriptDir/../../release/ pkgDir=$scriptDir/../../release/
cp -f ${pkgDir}/${pkgFile} . cp -f ${pkgDir}/${pkgFile} .
./dockerbuild.sh -c ${cpuType} -f ${pkgFile} -n ${verNumber} -p ${passWord} ./dockerbuild.sh -c ${cpuType} -f ${pkgFile} -n ${verNumber} -p ${passWord}
rm -f ${pkgFile} rm -f ${pkgFile}
@echo off @echo off
set internal_dir=%~dp0\..\..\ set internal_dir=%~dp0\..\..\
set community_dir=%~dp0\.. set community_dir=%~dp0\..
cd %community_dir% cd %community_dir%
git checkout -- . git checkout -- .
cd %community_dir%\packaging cd %community_dir%\packaging
:: %1 name %2 version :: %1 name %2 version
if !%1==! GOTO USAGE if !%1==! GOTO USAGE
if !%2==! GOTO USAGE if !%2==! GOTO USAGE
if %1 == taos GOTO TAOS if %1 == taos GOTO TAOS
if %1 == power GOTO POWER if %1 == power GOTO POWER
if %1 == tq GOTO TQ if %1 == tq GOTO TQ
if %1 == pro GOTO PRO if %1 == pro GOTO PRO
if %1 == kh GOTO KH if %1 == kh GOTO KH
if %1 == jh GOTO JH if %1 == jh GOTO JH
GOTO USAGE GOTO USAGE
:TAOS :TAOS
goto RELEASE goto RELEASE
:POWER :POWER
call sed_power.bat %community_dir% call sed_power.bat %community_dir%
goto RELEASE goto RELEASE
:TQ :TQ
call sed_tq.bat %community_dir% call sed_tq.bat %community_dir%
goto RELEASE goto RELEASE
:PRO :PRO
call sed_pro.bat %community_dir% call sed_pro.bat %community_dir%
goto RELEASE goto RELEASE
:KH :KH
call sed_kh.bat %community_dir% call sed_kh.bat %community_dir%
goto RELEASE goto RELEASE
:JH :JH
call sed_jh.bat %community_dir% call sed_jh.bat %community_dir%
goto RELEASE goto RELEASE
:RELEASE :RELEASE
echo release windows-client-64 for %1, version: %2 echo release windows-client-64 for %1, version: %2
if not exist %internal_dir%\debug\ver-%2-64bit-%1 ( if not exist %internal_dir%\debug\ver-%2-64bit-%1 (
md %internal_dir%\debug\ver-%2-64bit-%1 md %internal_dir%\debug\ver-%2-64bit-%1
) else ( ) else (
rd /S /Q %internal_dir%\debug\ver-%2-64bit-%1 rd /S /Q %internal_dir%\debug\ver-%2-64bit-%1
md %internal_dir%\debug\ver-%2-64bit-%1 md %internal_dir%\debug\ver-%2-64bit-%1
) )
cd %internal_dir%\debug\ver-%2-64bit-%1 cd %internal_dir%\debug\ver-%2-64bit-%1
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64 call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
cmake ../../ -G "NMake Makefiles" -DVERNUMBER=%2 -DCPUTYPE=x64 cmake ../../ -G "NMake Makefiles" -DVERNUMBER=%2 -DCPUTYPE=x64
set CL=/MP4 set CL=/MP4
nmake install nmake install
goto EXIT0 goto EXIT0
:USAGE :USAGE
echo Usage: release.bat $productName $version echo Usage: release.bat $productName $version
goto EXIT0 goto EXIT0
:EXIT0 :EXIT0
\ No newline at end of file
#!/bin/bash #!/bin/bash
# #
# Generate the tar.gz package for linux os # Generate the deb package for ubuntu, or rpm package for centos, or tar.gz package for other linux os
set -e set -e
#set -x #set -x
# release.sh -v [cluster | edge]
# -c [aarch32 | aarch64 | x64 | x86 | mips64 ...]
# -o [Linux | Kylin | Alpine | Raspberrypi | Darwin | Windows | Ningsi60 | Ningsi80 |...]
# -V [stable | beta]
# -l [full | lite]
# -s [static | dynamic]
# -d [taos | ...]
# -n [2.0.0.3]
# -m [2.0.0.0]
# -H [ false | true]
# set parameters by default value # set parameters by default value
version="3.0.0.0" verMode=edge # [cluster, edge]
verType=stable # [stable, beta]
cpuType=x64 # [aarch32 | aarch64 | x64 | x86 | mips64 ...]
osType=Linux # [Linux | Kylin | Alpine | Raspberrypi | Darwin | Windows | Ningsi60 | Ningsi80 |...]
pagMode=full # [full | lite]
soMode=dynamic # [static | dynamic]
dbName=taos # [taos | ...]
allocator=glibc # [glibc | jemalloc]
verNumber=""
verNumberComp="2.0.0.0"
httpdBuild=false
while getopts "hv:V:c:o:l:s:d:a:n:m:H:" arg; do
case $arg in
v)
#echo "verMode=$OPTARG"
verMode=$(echo $OPTARG)
;;
V)
#echo "verType=$OPTARG"
verType=$(echo $OPTARG)
;;
c)
#echo "cpuType=$OPTARG"
cpuType=$(echo $OPTARG)
;;
l)
#echo "pagMode=$OPTARG"
pagMode=$(echo $OPTARG)
;;
s)
#echo "soMode=$OPTARG"
soMode=$(echo $OPTARG)
;;
d)
#echo "dbName=$OPTARG"
dbName=$(echo $OPTARG)
;;
a)
#echo "allocator=$OPTARG"
allocator=$(echo $OPTARG)
;;
n)
#echo "verNumber=$OPTARG"
verNumber=$(echo $OPTARG)
;;
m)
#echo "verNumberComp=$OPTARG"
verNumberComp=$(echo $OPTARG)
;;
o)
#echo "osType=$OPTARG"
osType=$(echo $OPTARG)
;;
H)
#echo "httpdBuild=$OPTARG"
httpdBuild=$(echo $OPTARG)
;;
h)
echo "Usage: $(basename $0) -v [cluster | edge] "
echo " -c [aarch32 | aarch64 | x64 | x86 | mips64 ...] "
echo " -o [Linux | Kylin | Alpine | Raspberrypi | Darwin | Windows | Ningsi60 | Ningsi80 |...] "
echo " -V [stable | beta] "
echo " -l [full | lite] "
echo " -a [glibc | jemalloc] "
echo " -s [static | dynamic] "
echo " -d [taos | ...] "
echo " -n [version number] "
echo " -m [compatible version number] "
echo " -H [false | true] "
exit 0
;;
?) #unknow option
echo "unkonw argument"
exit 1
;;
esac
done
echo "verMode=${verMode} verType=${verType} cpuType=${cpuType} osType=${osType} pagMode=${pagMode} soMode=${soMode} dbName=${dbName} allocator=${allocator} verNumber=${verNumber} verNumberComp=${verNumberComp} httpdBuild=${httpdBuild}"
curr_dir=$(pwd) curr_dir=$(pwd)
script_dir="$(dirname $(readlink -f $0))" if [ "$osType" == "Darwin" ]; then
top_dir="$(readlink -f ${script_dir}/..)" script_dir=$(dirname $0)
cd ${script_dir}
script_dir="$(pwd)"
top_dir=${script_dir}/..
else
script_dir="$(dirname $(readlink -f $0))"
top_dir="$(readlink -f ${script_dir}/..)"
fi
csudo=""
if command -v sudo > /dev/null; then
csudo="sudo "
fi
function is_valid_version() {
[ -z $1 ] && return 1 || :
rx='^([0-9]+\.){3}(\*|[0-9]+)$'
if [[ $1 =~ $rx ]]; then
return 0
fi
return 1
}
function vercomp() {
if [[ $1 == $2 ]]; then
echo 0
exit 0
fi
local IFS=.
local i ver1=($1) ver2=($2)
# fill empty fields in ver1 with zeros
for ((i = ${#ver1[@]}; i < ${#ver2[@]}; i++)); do
ver1[i]=0
done
for ((i = 0; i < ${#ver1[@]}; i++)); do
if [[ -z ${ver2[i]} ]]; then
# fill empty fields in ver2 with zeros
ver2[i]=0
fi
if ((10#${ver1[i]} > 10#${ver2[i]})); then
echo 1
exit 0
fi
if ((10#${ver1[i]} < 10#${ver2[i]})); then
echo 2
exit 0
fi
done
echo 0
}
# 1. check version information
if ( (! is_valid_version $verNumber) || (! is_valid_version $verNumberComp) || [[ "$(vercomp $verNumber $verNumberComp)" == '2' ]]); then
echo "please enter correct version"
exit 0
fi
echo "=======================new version number: ${verNumber}======================================" echo "=======================new version number: ${verNumber}, compatible version: ${verNumberComp}======================================"
build_time=$(date +"%F %R") build_time=$(date +"%F %R")
echo "script_dir: ${script_dir}" # get commint id from git
echo "top_dir: ${top_dir}" gitinfo=$(git rev-parse --verify HEAD)
cd ${top_dir} if [[ "$verMode" == "cluster" ]]; then
# git checkout -- . enterprise_dir="${top_dir}/../enterprise"
# git checkout 3.0 cd ${enterprise_dir}
# git pull || : gitinfoOfInternal=$(git rev-parse --verify HEAD)
else
gitinfoOfInternal=NULL
fi
echo "curr_dir: ${curr_dir}" cd "${curr_dir}"
# 2. cmake executable file # 2. cmake executable file
compile_dir="${top_dir}/debug" compile_dir="${top_dir}/debug"
# if [ -d ${compile_dir} ]; then if [ -d ${compile_dir} ]; then
# rm -rf ${compile_dir} ${csudo}rm -rf ${compile_dir}
# fi fi
mkdir -p ${compile_dir}
if [ "$osType" != "Darwin" ]; then
${csudo}mkdir -p ${compile_dir}
else
mkdir -p ${compile_dir}
fi
cd ${compile_dir} cd ${compile_dir}
echo "compile_dir: ${compile_dir}" if [[ "$allocator" == "jemalloc" ]]; then
allocator_macro="-DJEMALLOC_ENABLED=true"
else
allocator_macro=""
fi
if [[ "$dbName" != "taos" ]]; then
source ${enterprise_dir}/packaging/oem/sed_$dbName.sh
replace_community_$dbName
fi
if [[ "$httpdBuild" == "true" ]]; then
BUILD_HTTP=true
else
BUILD_HTTP=false
fi
cmake .. -DBUILD_TOOLS=true if [[ "$verMode" == "cluster" ]]; then
make -j32 BUILD_HTTP=internal
fi
release_dir="${top_dir}/release" if [[ "$pagMode" == "full" ]]; then
if [ -d ${release_dir} ]; then BUILD_TOOLS=true
rm -rf ${release_dir} else
BUILD_TOOLS=false
fi fi
mkdir -p ${release_dir} # check support cpu type
cd ${release_dir} if [[ "$cpuType" == "x64" ]] || [[ "$cpuType" == "aarch64" ]] || [[ "$cpuType" == "aarch32" ]] || [[ "$cpuType" == "mips64" ]]; then
if [ "$verMode" != "cluster" ]; then
# community-version compile
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} -DBUILD_TOOLS=${BUILD_TOOLS} ${allocator_macro}
else
if [[ "$dbName" != "taos" ]]; then
replace_enterprise_$dbName
fi
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} -DBUILD_TOOLS=${BUILD_TOOLS} ${allocator_macro}
fi
else
echo "input cpuType=${cpuType} error!!!"
exit 1
fi
install_dir="${release_dir}/TDengine-server-${version}" CORES=$(grep -c ^processor /proc/cpuinfo)
mkdir -p ${install_dir}
mkdir -p ${install_dir}/bin
mkdir -p ${install_dir}/lib
mkdir -p ${install_dir}/inc
install_files="${script_dir}/tools/install.sh" if [[ "$allocator" == "jemalloc" ]]; then
chmod a+x ${script_dir}/tools/install.sh || : # jemalloc need compile first, so disable parallel build
cp ${install_files} ${install_dir} make -j ${CORES} && ${csudo}make install
else
make -j ${CORES} && ${csudo}make install
fi
cd ${curr_dir}
header_files="${top_dir}/include/client/taos.h ${top_dir}/include/util/taoserror.h" # 3. Call the corresponding script for packaging
cp ${header_files} ${install_dir}/inc if [ "$osType" != "Darwin" ]; then
if [[ "$verMode" != "cluster" ]] && [[ "$pagMode" == "full" ]] && [[ "$cpuType" == "x64" ]] && [[ "$dbName" == "taos" ]]; then
bin_files="${compile_dir}/build/bin/taosd ${compile_dir}/build/bin/taos ${compile_dir}/build/bin/create_table ${compile_dir}/build/bin/tmq_sim ${script_dir}/tools/remove.sh ${compile_dir}/build/bin/taosBenchmark ${compile_dir}/build/bin/taosdump" ret='0'
cp -rf ${bin_files} ${install_dir}/bin && chmod a+x ${install_dir}/bin/* || : command -v dpkg >/dev/null 2>&1 || { ret='1'; }
if [ "$ret" -eq 0 ]; then
echo "====do deb package for the ubuntu system===="
output_dir="${top_dir}/debs"
if [ -d ${output_dir} ]; then
${csudo}rm -rf ${output_dir}
fi
${csudo}mkdir -p ${output_dir}
cd ${script_dir}/deb
${csudo}./makedeb.sh ${compile_dir} ${output_dir} ${verNumber} ${cpuType} ${osType} ${verMode} ${verType}
cp ${compile_dir}/build/lib/libtaos.so ${install_dir}/lib/ if [[ "$pagMode" == "full" ]]; then
cp ${compile_dir}/build/lib/libavro* ${install_dir}/lib/ > /dev/null || echo -e "failed to copy avro libraries" if [ -d ${top_dir}/tools/taos-tools/packaging/deb ]; then
cp -rf ${compile_dir}/build/lib/pkgconfig ${install_dir}/lib/ > /dev/null || echo -e "failed to copy pkgconfig directory" cd ${top_dir}/tools/taos-tools/packaging/deb
[ -z "$taos_tools_ver" ] && taos_tools_ver="0.1.0"
taos_tools_ver=$(git describe --tags | sed -e 's/ver-//g' | awk -F '-' '{print $1}')
${csudo}./make-taos-tools-deb.sh ${top_dir} \
${compile_dir} ${output_dir} ${taos_tools_ver} ${cpuType} ${osType} ${verMode} ${verType}
fi
fi
else
echo "==========dpkg command not exist, so not release deb package!!!"
fi
ret='0'
command -v rpmbuild >/dev/null 2>&1 || { ret='1'; }
if [ "$ret" -eq 0 ]; then
echo "====do rpm package for the centos system===="
output_dir="${top_dir}/rpms"
if [ -d ${output_dir} ]; then
${csudo}rm -rf ${output_dir}
fi
${csudo}mkdir -p ${output_dir}
cd ${script_dir}/rpm
${csudo}./makerpm.sh ${compile_dir} ${output_dir} ${verNumber} ${cpuType} ${osType} ${verMode} ${verType}
#cp ${compile_dir}/source/dnode/mnode/impl/libmnode.so ${install_dir}/lib/ if [[ "$pagMode" == "full" ]]; then
#cp ${compile_dir}/source/dnode/qnode/libqnode.so ${install_dir}/lib/ if [ -d ${top_dir}/tools/taos-tools/packaging/rpm ]; then
#cp ${compile_dir}/source/dnode/snode/libsnode.so ${install_dir}/lib/ cd ${top_dir}/tools/taos-tools/packaging/rpm
#cp ${compile_dir}/source/dnode/bnode/libbnode.so ${install_dir}/lib/ [ -z "$taos_tools_ver" ] && taos_tools_ver="0.1.0"
#cp ${compile_dir}/source/libs/wal/libwal.so ${install_dir}/lib/
#cp ${compile_dir}/source/libs/scheduler/libscheduler.so ${install_dir}/lib/
#cp ${compile_dir}/source/libs/planner/libplanner.so ${install_dir}/lib/
#cp ${compile_dir}/source/libs/parser/libparser.so ${install_dir}/lib/
#cp ${compile_dir}/source/libs/qcom/libqcom.so ${install_dir}/lib/
#cp ${compile_dir}/source/libs/transport/libtransport.so ${install_dir}/lib/
#cp ${compile_dir}/source/libs/function/libfunction.so ${install_dir}/lib/
#cp ${compile_dir}/source/common/libcommon.so ${install_dir}/lib/
#cp ${compile_dir}/source/os/libos.so ${install_dir}/lib/
#cp ${compile_dir}/source/dnode/mnode/sdb/libsdb.so ${install_dir}/lib/
#cp ${compile_dir}/source/libs/catalog/libcatalog.so ${install_dir}/lib/
pkg_name=${install_dir}-Linux-x64 taos_tools_ver=$(git describe --tags | sed -e 's/ver-//g' | awk -F '-' '{print $1}' | sed -e 's/-/_/g')
${csudo}./make-taos-tools-rpm.sh ${top_dir} \
${compile_dir} ${output_dir} ${taos_tools_ver} ${cpuType} ${osType} ${verMode} ${verType}
fi
fi
else
echo "==========rpmbuild command not exist, so not release rpm package!!!"
fi
fi
tar -zcv -f "$(basename ${pkg_name}).tar.gz" $(basename ${install_dir}) --remove-files || : echo "====do tar.gz package for all systems===="
cd ${script_dir}/tools
${csudo}./makepkg.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode} ${verNumberComp} ${dbName}
${csudo}./makeclient.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode} ${dbName}
# ${csudo}./makearbi.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode}
else
# only make client for Darwin
cd ${script_dir}/tools
./makeclient.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode} ${dbName}
fi
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
文件模式从 100644 更改为 100755
此差异已折叠。
此差异已折叠。
此差异已折叠。
#!/bin/bash #!/bin/bash
[[ -x /usr/bin/taosadapter ]] && /usr/bin/taosadapter & [[ -x /usr/bin/taosadapter ]] && /usr/bin/taosadapter &
taosd taosd
此差异已折叠。
文件模式从 100644 更改为 100755
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册