Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lzh_me
TDengine
提交
d9d22393
TDengine
项目概览
lzh_me
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d9d22393
编写于
7月 28, 2020
作者:
H
Hui Li
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-1017]
上级
f14ccfe2
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
371 addition
and
59 deletion
+371
-59
packaging/deb/tarbitratord
packaging/deb/tarbitratord
+88
-0
packaging/rpm/tarbitratord
packaging/rpm/tarbitratord
+141
-0
packaging/tools/install.sh
packaging/tools/install.sh
+106
-53
packaging/tools/makepkg.sh
packaging/tools/makepkg.sh
+6
-2
packaging/tools/remove.sh
packaging/tools/remove.sh
+30
-4
未找到文件。
packaging/deb/tarbitratord
0 → 100644
浏览文件 @
d9d22393
#!/bin/bash
#
# Modified from original source: Elastic Search
# https://github.com/elasticsearch/elasticsearch
# Thank you to the Elastic Search authors
#
# chkconfig: 2345 99 01
#
### BEGIN INIT INFO
# Provides: TDEngine
# Required-Start: $local_fs $network $syslog
# Required-Stop: $local_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts TDEngine tarbitrator
# Description: Starts TDEngine tarbitrator, a arbitrator
### END INIT INFO
set
-e
PATH
=
"/bin:/usr/bin:/sbin:/usr/sbin"
NAME
=
"tarbitrator"
USER
=
"root"
GROUP
=
"root"
DAEMON
=
"/usr/local/taos/bin/tarbitrator"
DAEMON_OPTS
=
""
PID_FILE
=
"/var/run/
$NAME
.pid"
APPARGS
=
""
# Maximum number of open files
MAX_OPEN_FILES
=
65535
.
/lib/lsb/init-functions
case
"
$1
"
in
start
)
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
touch
"
$PID_FILE
"
&&
chown
"
$USER
"
:
"
$GROUP
"
"
$PID_FILE
"
if
[
-n
"
$MAX_OPEN_FILES
"
]
;
then
ulimit
-n
$MAX_OPEN_FILES
fi
start-stop-daemon
--start
--chuid
"
$USER
:
$GROUP
"
--background
--make-pidfile
--pidfile
"
$PID_FILE
"
--exec
"
$DAEMON
"
--
$APPARGS
log_end_msg
$?
fi
;;
stop
)
log_action_begin_msg
"Stopping tarbitrator..."
set
+e
if
[
-f
"
$PID_FILE
"
]
;
then
start-stop-daemon
--stop
--pidfile
"
$PID_FILE
"
--user
"
$USER
"
--retry
=
TERM/120/KILL/5
>
/dev/null
if
[
$?
-eq
1
]
;
then
log_action_cont_msg
"TSD is not running but pid file exists, cleaning up"
elif
[
$?
-eq
3
]
;
then
PID
=
"
`
cat
$PID_FILE
`
"
log_failure_msg
"Failed to stop tarbitrator (pid
$PID
)"
exit
1
fi
rm
-f
"
$PID_FILE
"
else
log_action_cont_msg
"tarbitrator was not running"
fi
log_action_end_msg 0
set
-e
;;
restart|force-reload
)
if
[
-f
"
$PID_FILE
"
]
;
then
$0
stop
sleep
1
fi
$0
start
;;
status
)
status_of_proc
-p
"
$PID_FILE
"
"
$DAEMON
"
"
$NAME
"
;;
*
)
exit
1
;;
esac
exit
0
packaging/rpm/tarbitratord
0 → 100644
浏览文件 @
d9d22393
#!/bin/bash
#
# tarbitratord This shell script takes care of starting and stopping tarbitrator.
#
# chkconfig: 2345 99 01
# description: tarbitrator is a arbitrator used in TDengine cluster.
#
#
### BEGIN INIT INFO
# Provides: TDEngine
# Required-Start: $network $local_fs $remote_fs
# Required-Stop: $network $local_fs $remote_fs
# Short-Description: start and stop taosd
# Description: tarbitrator is a arbitrator used in TDengine cluster.
### END INIT INFO
# Source init functions
.
/etc/init.d/functions
# Maximum number of open files
MAX_OPEN_FILES
=
65535
# Default program options
NAME
=
tarbitrator
PROG
=
/usr/local/taos/bin/tarbitrator
USER
=
root
GROUP
=
root
# Default directories
LOCK_DIR
=
/var/lock/subsys
PID_DIR
=
/var/run/
$NAME
# Set file names
LOCK_FILE
=
$LOCK_DIR
/
$NAME
PID_FILE
=
$PID_DIR
/
$NAME
.pid
[
-e
$PID_DIR
]
||
mkdir
-p
$PID_DIR
PROG_OPTS
=
""
start
()
{
echo
-n
"Starting
${
NAME
}
: "
# check identity
curid
=
"
`
id
-u
-n
`
"
if
[
"
$curid
"
!=
root
]
&&
[
"
$curid
"
!=
"
$USER
"
]
;
then
echo
"Must be run as root or
$USER
, but was run as
$curid
"
return
1
fi
# Sets the maximum number of open file descriptors allowed.
ulimit
-n
$MAX_OPEN_FILES
curulimit
=
"
`
ulimit
-n
`
"
if
[
"
$curulimit
"
-lt
$MAX_OPEN_FILES
]
;
then
echo
"'ulimit -n' must be greater than or equal to
$MAX_OPEN_FILES
, is
$curulimit
"
return
1
fi
if
[
"
`
id
-u
-n
`
"
==
root
]
;
then
# Changes the owner of the lock, and the pid files to allow
# non-root OpenTSDB daemons to run /usr/share/opentsdb/bin/opentsdb_restart.py.
touch
$LOCK_FILE
&&
chown
$USER
:
$GROUP
$LOCK_FILE
touch
$PID_FILE
&&
chown
$USER
:
$GROUP
$PID_FILE
daemon
--user
$USER
--pidfile
$PID_FILE
"
$PROG
$PROG_OPTS
&> /dev/null &"
else
# Don't have to change user.
daemon
--pidfile
$PID_FILE
"
$PROG
$PROG_OPTS
&> /dev/null &"
fi
retval
=
$?
sleep
2
echo
[
$retval
-eq
0
]
&&
(
findproc
>
$PID_FILE
&&
touch
$LOCK_FILE
)
return
$retval
}
stop
()
{
echo
-n
"Stopping
${
NAME
}
: "
killproc
-p
$PID_FILE
$NAME
retval
=
$?
echo
# Non-root users don't have enough permission to remove pid and lock files.
# So, the opentsdb_restart.py cannot get rid of the files, and the command
# "service opentsdb status" will complain about the existing pid file.
# Makes the pid file empty.
echo
>
$PID_FILE
[
$retval
-eq
0
]
&&
(
rm
-f
$PID_FILE
&&
rm
-f
$LOCK_FILE
)
return
$retval
}
restart
()
{
stop
start
}
reload
()
{
restart
}
force_reload
()
{
restart
}
rh_status
()
{
# run checks to determine if the service is running or use generic status
status
-p
$PID_FILE
-l
$LOCK_FILE
$NAME
}
rh_status_q
()
{
rh_status
>
/dev/null 2>&1
}
case
"
$1
"
in
start
)
rh_status_q
&&
exit
0
$1
;;
stop
)
rh_status_q
||
exit
0
$1
;;
restart
)
$1
;;
reload
)
rh_status_q
||
exit
7
$1
;;
force-reload
)
force_reload
;;
status
)
rh_status
;;
condrestart|try-restart
)
rh_status_q
||
exit
0
restart
;;
*
)
echo
"Usage:
$0
{start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
exit
2
esac
exit
$?
packaging/tools/install.sh
浏览文件 @
d9d22393
...
...
@@ -129,6 +129,7 @@ function install_bin() {
${
csudo
}
rm
-f
${
bin_link_dir
}
/taosdemo
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/taosdump
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/rmtaos
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/tarbitrator
||
:
${
csudo
}
cp
-r
${
script_dir
}
/bin/
*
${
install_main_dir
}
/bin
&&
${
csudo
}
chmod
0555
${
install_main_dir
}
/bin/
*
...
...
@@ -138,6 +139,7 @@ function install_bin() {
[
-x
${
install_main_dir
}
/bin/taosdump
]
&&
${
csudo
}
ln
-s
${
install_main_dir
}
/bin/taosdump
${
bin_link_dir
}
/taosdump
||
:
[
-x
${
install_main_dir
}
/bin/taosdemo
]
&&
${
csudo
}
ln
-s
${
install_main_dir
}
/bin/taosdemo
${
bin_link_dir
}
/taosdemo
||
:
[
-x
${
install_main_dir
}
/bin/remove.sh
]
&&
${
csudo
}
ln
-s
${
install_main_dir
}
/bin/remove.sh
${
bin_link_dir
}
/rmtaos
||
:
[
-x
${
install_main_dir
}
/bin/tarbitrator
]
&&
${
csudo
}
ln
-s
${
install_main_dir
}
/bin/tarbitrator
${
bin_link_dir
}
/tarbitrator
||
:
if
[
"
$verMode
"
==
"cluster"
]
;
then
${
csudo
}
cp
-r
${
script_dir
}
/nginxd/
*
${
nginx_dir
}
&&
${
csudo
}
chmod
0555
${
nginx_dir
}
/
*
...
...
@@ -190,43 +192,44 @@ function install_config() {
return
0
fi
IP_FORMAT
=
"(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)"
IP_PATTERN
=
"
\b
$IP_FORMAT
\.
$IP_FORMAT
\.
$IP_FORMAT
\.
$IP_FORMAT
\b
"
#FQDN_FORMAT="(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)"
#FQDN_FORMAT="(:[1-6][0-9][0-9][0-9][0-9]$)"
#PORT_FORMAT="(/[1-6][0-9][0-9][0-9][0-9]?/)"
#FQDN_PATTERN=":[0-9]{1,5}$"
# first full-qualified domain name (FQDN) for TDengine cluster system
echo
echo
-e
-n
"
${
GREEN
}
Enter the
IP address
of an existing TDengine cluster node to join
${
NC
}
OR
${
GREEN
}
leave it blank to build one
${
NC
}
:"
read
masterIp
echo
-e
-n
"
${
GREEN
}
Enter the
FQDN
of an existing TDengine cluster node to join
${
NC
}
OR
${
GREEN
}
leave it blank to build one
${
NC
}
:"
read
firstFqdn
while
true
;
do
if
[
!
-z
"
$masterIp
"
]
;
then
# check the format of the masterIp
if
[[
$masterIp
=
~
$IP_PATTERN
]]
;
then
# Write the first IP to configuration file
sudo sed
-i
-r
"s/#*
\s
*(masterIp
\s
*).*/
\1
$masterIp
/"
${
cfg_dir
}
/taos.cfg
# Get the second IP address
if
[
!
-z
"
$firstFqdn
"
]
;
then
# check the format of the firstFqdn
#if [[ $firstFqdn == $FQDN_PATTERN ]]; then
# Write the first FQDN to configuration file
${
csudo
}
sed
-i
-r
"s/#*
\s
*(first
\s
*).*/
\1
$firstFqdn
/"
${
cfg_install_dir
}
/taos.cfg
# Get the second FQDN
echo
echo
-e
-n
"
${
GREEN
}
Enter the
IP address
of another node in cluster
${
NC
}
OR
${
GREEN
}
leave it blank to skip
${
NC
}
: "
read
second
Ip
echo
-e
-n
"
${
GREEN
}
Enter the
FQDN
of another node in cluster
${
NC
}
OR
${
GREEN
}
leave it blank to skip
${
NC
}
: "
read
second
Fqdn
while
true
;
do
if
[
!
-z
"
$secondIp
"
]
;
then
if
[[
$secondIp
=
~
$IP_PATTERN
]]
;
then
# Write the second IP to configuration file
sudo sed
-i
-r
"s/#*
\s
*(secondIp
\s
*).*/
\1
$secondIp
/"
${
cfg_dir
}
/taos.cfg
if
[
!
-z
"
$secondFqdn
"
]
;
then
#if [[ $secondFqdn == $FQDN_PATTERN ]]; then
# Write the second FQDN to configuration file
${
csudo
}
sed
-i
-r
"s/#*
\s
*(second
\s
*).*/
\1
$secondFqdn
/"
${
cfg_install_dir
}
/taos.cfg
break
else
read
-p
"Please enter the correct IP address: "
secondIp
fi
#
else
# read -p "Please enter the correct FQDN: " secondFqdn
#
fi
else
break
fi
done
break
else
read
-p
"Please enter the correct IP address: "
masterIp
fi
#
else
# read -p "Please enter the correct FQDN: " firstFqdn
#
fi
else
break
fi
...
...
@@ -267,15 +270,23 @@ function clean_service_on_sysvinit() {
${
csudo
}
service taosd stop
||
:
fi
if
pidof tarbitrator &> /dev/null
;
then
${
csudo
}
service tarbitratord stop
||
:
fi
if
((
${
initd_mod
}
==
1
))
;
then
${
csudo
}
chkconfig
--del
taosd
||
:
${
csudo
}
chkconfig
--del
tarbitratord
||
:
elif
((
${
initd_mod
}
==
2
))
;
then
${
csudo
}
insserv
-r
taosd
||
:
${
csudo
}
insserv
-r
tarbitratord
||
:
elif
((
${
initd_mod
}
==
3
))
;
then
${
csudo
}
update-rc.d
-f
taosd remove
||
:
${
csudo
}
update-rc.d
-f
tarbitratord remove
||
:
fi
${
csudo
}
rm
-f
${
service_config_dir
}
/taosd
||
:
${
csudo
}
rm
-f
${
service_config_dir
}
/tarbitratord
||
:
if
$(
which init &> /dev/null
)
;
then
${
csudo
}
init q
||
:
...
...
@@ -292,9 +303,13 @@ function install_service_on_sysvinit() {
if
((
${
os_type
}
==
1
))
;
then
${
csudo
}
cp
-f
${
script_dir
}
/init.d/taosd.deb
${
install_main_dir
}
/init.d/taosd
${
csudo
}
cp
${
script_dir
}
/init.d/taosd.deb
${
service_config_dir
}
/taosd
&&
${
csudo
}
chmod
a+x
${
service_config_dir
}
/taosd
${
csudo
}
cp
-f
${
script_dir
}
/init.d/tarbitratord.deb
${
install_main_dir
}
/init.d/tarbitratord
${
csudo
}
cp
${
script_dir
}
/init.d/tarbitratord.deb
${
service_config_dir
}
/tarbitratord
&&
${
csudo
}
chmod
a+x
${
service_config_dir
}
/tarbitratord
elif
((
${
os_type
}
==
2
))
;
then
${
csudo
}
cp
-f
${
script_dir
}
/init.d/taosd.rpm
${
install_main_dir
}
/init.d/taosd
${
csudo
}
cp
${
script_dir
}
/init.d/taosd.rpm
${
service_config_dir
}
/taosd
&&
${
csudo
}
chmod
a+x
${
service_config_dir
}
/taosd
${
csudo
}
cp
-f
${
script_dir
}
/init.d/tarbitratord.rpm
${
install_main_dir
}
/init.d/tarbitratord
${
csudo
}
cp
${
script_dir
}
/init.d/tarbitratord.rpm
${
service_config_dir
}
/tarbitratord
&&
${
csudo
}
chmod
a+x
${
service_config_dir
}
/tarbitratord
fi
#restart_config_str="taos:2345:respawn:${service_config_dir}/taosd start"
...
...
@@ -303,11 +318,16 @@ function install_service_on_sysvinit() {
if
((
${
initd_mod
}
==
1
))
;
then
${
csudo
}
chkconfig
--add
taosd
||
:
${
csudo
}
chkconfig
--level
2345 taosd on
||
:
${
csudo
}
chkconfig
--add
tarbitratord
||
:
${
csudo
}
chkconfig
--level
2345 tarbitratord on
||
:
elif
((
${
initd_mod
}
==
2
))
;
then
${
csudo
}
insserv taosd
||
:
${
csudo
}
insserv
-d
taosd
||
:
${
csudo
}
insserv tarbitratord
||
:
${
csudo
}
insserv
-d
tarbitratord
||
:
elif
((
${
initd_mod
}
==
3
))
;
then
${
csudo
}
update-rc.d taosd defaults
||
:
${
csudo
}
update-rc.d tarbitratord defaults
||
:
fi
}
...
...
@@ -332,6 +352,15 @@ function clean_service_on_systemd() {
${
csudo
}
systemctl disable nginxd &> /dev/null
||
echo
&> /dev/null
${
csudo
}
rm
-f
${
nginx_service_config
}
tarbitratord_service_config
=
"
${
service_config_dir
}
/tarbitratord.service"
if
systemctl is-active
--quiet
tarbitratord
;
then
echo
"tarbitrator is running, stopping it..."
${
csudo
}
systemctl stop tarbitratord &> /dev/null
||
echo
&> /dev/null
fi
${
csudo
}
systemctl disable tarbitratord &> /dev/null
||
echo
&> /dev/null
${
csudo
}
rm
-f
${
tarbitratord_service_config
}
fi
}
...
...
@@ -364,6 +393,30 @@ function install_service_on_systemd() {
${
csudo
}
systemctl
enable
taosd
if
[
"
$verMode
"
==
"cluster"
]
;
then
tarbitratord_service_config
=
"
${
service_config_dir
}
/tarbitratord.service"
${
csudo
}
bash
-c
"echo '[Unit]' >>
${
tarbitratord_service_config
}
"
${
csudo
}
bash
-c
"echo 'Description=TDengine arbitrator service' >>
${
tarbitratord_service_config
}
"
${
csudo
}
bash
-c
"echo 'After=network-online.target' >>
${
tarbitratord_service_config
}
"
${
csudo
}
bash
-c
"echo 'Wants=network-online.target' >>
${
tarbitratord_service_config
}
"
${
csudo
}
bash
-c
"echo >>
${
tarbitratord_service_config
}
"
${
csudo
}
bash
-c
"echo '[Service]' >>
${
tarbitratord_service_config
}
"
${
csudo
}
bash
-c
"echo 'Type=simple' >>
${
tarbitratord_service_config
}
"
${
csudo
}
bash
-c
"echo 'ExecStart=/usr/bin/tarbitrator' >>
${
tarbitratord_service_config
}
"
${
csudo
}
bash
-c
"echo 'LimitNOFILE=infinity' >>
${
tarbitratord_service_config
}
"
${
csudo
}
bash
-c
"echo 'LimitNPROC=infinity' >>
${
tarbitratord_service_config
}
"
${
csudo
}
bash
-c
"echo 'LimitCORE=infinity' >>
${
tarbitratord_service_config
}
"
${
csudo
}
bash
-c
"echo 'TimeoutStartSec=0' >>
${
tarbitratord_service_config
}
"
${
csudo
}
bash
-c
"echo 'StandardOutput=null' >>
${
tarbitratord_service_config
}
"
${
csudo
}
bash
-c
"echo 'Restart=always' >>
${
tarbitratord_service_config
}
"
${
csudo
}
bash
-c
"echo 'StartLimitBurst=3' >>
${
tarbitratord_service_config
}
"
${
csudo
}
bash
-c
"echo 'StartLimitInterval=60s' >>
${
tarbitratord_service_config
}
"
${
csudo
}
bash
-c
"echo >>
${
tarbitratord_service_config
}
"
${
csudo
}
bash
-c
"echo '[Install]' >>
${
tarbitratord_service_config
}
"
${
csudo
}
bash
-c
"echo 'WantedBy=multi-user.target' >>
${
tarbitratord_service_config
}
"
${
csudo
}
systemctl
enable
tarbitratord
nginx_service_config
=
"
${
service_config_dir
}
/nginxd.service"
${
csudo
}
bash
-c
"echo '[Unit]' >>
${
nginx_service_config
}
"
${
csudo
}
bash
-c
"echo 'Description=Nginx For TDengine Service' >>
${
nginx_service_config
}
"
...
...
packaging/tools/makepkg.sh
浏览文件 @
d9d22393
...
...
@@ -36,7 +36,7 @@ if [ "$pagMode" == "lite" ]; then
strip
${
build_dir
}
/bin/taos
bin_files
=
"
${
build_dir
}
/bin/taosd
${
build_dir
}
/bin/taos
${
script_dir
}
/remove.sh"
else
bin_files
=
"
${
build_dir
}
/bin/taosd
${
build_dir
}
/bin/taos
${
build_dir
}
/bin/taosdemo
${
build_dir
}
/bin/taosdump
${
script_dir
}
/remove.sh"
bin_files
=
"
${
build_dir
}
/bin/taosd
${
build_dir
}
/bin/taos
${
build_dir
}
/bin/taosdemo
${
build_dir
}
/bin/taosdump
${
build_dir
}
/bin/tarbitrator
${
script_dir
}
/remove.sh"
fi
lib_files
=
"
${
build_dir
}
/lib/libtaos.so.
${
version
}
"
...
...
@@ -54,14 +54,18 @@ nginx_dir="${code_dir}/../../enterprise/src/plugins/web"
# temp use rpm's taosd. TODO: later modify according to os type
init_file_deb
=
${
script_dir
}
/../deb/taosd
init_file_rpm
=
${
script_dir
}
/../rpm/taosd
init_file_tarbitrator_deb
=
${
script_dir
}
/../deb/tarbitratord
init_file_tarbitrator_rpm
=
${
script_dir
}
/../rpm/tarbitratord
# make directories.
mkdir
-p
${
install_dir
}
mkdir
-p
${
install_dir
}
/inc
&&
cp
${
header_files
}
${
install_dir
}
/inc
mkdir
-p
${
install_dir
}
/cfg
&&
cp
${
cfg_dir
}
/taos.cfg
${
install_dir
}
/cfg/taos.cfg
mkdir
-p
${
install_dir
}
/bin
&&
cp
${
bin_files
}
${
install_dir
}
/bin
&&
chmod
a+x
${
install_dir
}
/bin/
*
mkdir
-p
${
install_dir
}
/bin
&&
cp
${
bin_files
}
${
install_dir
}
/bin
&&
chmod
a+x
${
install_dir
}
/bin/
*
||
:
mkdir
-p
${
install_dir
}
/init.d
&&
cp
${
init_file_deb
}
${
install_dir
}
/init.d/taosd.deb
mkdir
-p
${
install_dir
}
/init.d
&&
cp
${
init_file_rpm
}
${
install_dir
}
/init.d/taosd.rpm
mkdir
-p
${
install_dir
}
/init.d
&&
cp
${
init_file_tarbitrator_deb
}
${
install_dir
}
/init.d/tarbitratord.deb
||
:
mkdir
-p
${
install_dir
}
/init.d
&&
cp
${
init_file_tarbitrator_rpm
}
${
install_dir
}
/init.d/tarbitratord.rpm
||
:
if
[
"
$verMode
"
==
"cluster"
]
;
then
sed
's/verMode=edge/verMode=cluster/g'
${
install_dir
}
/bin/remove.sh
>>
remove_temp.sh
...
...
packaging/tools/remove.sh
浏览文件 @
d9d22393
...
...
@@ -26,6 +26,7 @@ v15_java_app_dir="/usr/local/lib/taos"
service_config_dir
=
"/etc/systemd/system"
taos_service_name
=
"taosd"
tarbitrator_service_name
=
"tarbitratord"
nginx_service_name
=
"nginxd"
csudo
=
""
if
command
-v
sudo
>
/dev/null
;
then
...
...
@@ -59,6 +60,12 @@ function kill_taosd() {
fi
}
function
kill_tarbitrator
()
{
pid
=
$(
ps
-ef
|
grep
"tarbitrator"
|
grep
-v
"grep"
|
awk
'{print $2}'
)
if
[
-n
"
$pid
"
]
;
then
${
csudo
}
kill
-9
$pid
||
:
fi
}
function
clean_bin
()
{
# Remove link
${
csudo
}
rm
-f
${
bin_link_dir
}
/taos
||
:
...
...
@@ -102,8 +109,17 @@ function clean_service_on_systemd() {
${
csudo
}
rm
-f
${
taosd_service_config
}
if
[
"
$verMode
"
==
"cluster"
]
;
then
nginx_service_config
=
"
${
service_config_dir
}
/
${
nginx
_service_name
}
.service"
tarbitratord_service_config
=
"
${
service_config_dir
}
/
${
tarbitrator
_service_name
}
.service"
if
systemctl is-active
--quiet
${
tarbitrator_service_name
}
;
then
echo
"TDengine tarbitrator is running, stopping it..."
${
csudo
}
systemctl stop
${
tarbitrator_service_name
}
&> /dev/null
||
echo
&> /dev/null
fi
${
csudo
}
systemctl disable
${
tarbitrator_service_name
}
&> /dev/null
||
echo
&> /dev/null
${
csudo
}
rm
-f
${
tarbitratord_service_config
}
nginx_service_config
=
"
${
service_config_dir
}
/
${
nginx_service_name
}
.service"
if
[
-d
${
bin_dir
}
/web
]
;
then
if
systemctl is-active
--quiet
${
nginx_service_name
}
;
then
echo
"Nginx for TDengine is running, stopping it..."
...
...
@@ -125,15 +141,24 @@ function clean_service_on_sysvinit() {
${
csudo
}
service taosd stop
||
:
fi
if
pidof tarbitrator &> /dev/null
;
then
echo
"TDengine tarbitrator is running, stopping it..."
${
csudo
}
service tarbitratord stop
||
:
fi
if
((
${
initd_mod
}
==
1
))
;
then
${
csudo
}
chkconfig
--del
taosd
||
:
${
csudo
}
chkconfig
--del
tarbitratord
||
:
elif
((
${
initd_mod
}
==
2
))
;
then
${
csudo
}
insserv
-r
taosd
||
:
${
csudo
}
insserv
-r
tarbitratord
||
:
elif
((
${
initd_mod
}
==
3
))
;
then
${
csudo
}
update-rc.d
-f
taosd remove
||
:
${
csudo
}
update-rc.d
-f
tarbitratord remove
||
:
fi
${
csudo
}
rm
-f
${
service_config_dir
}
/taosd
||
:
${
csudo
}
rm
-f
${
service_config_dir
}
/tarbitratord
||
:
if
$(
which init &> /dev/null
)
;
then
${
csudo
}
init q
||
:
...
...
@@ -148,6 +173,7 @@ function clean_service() {
else
# must manual stop taosd
kill_taosd
kill_tarbitrator
fi
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录