未验证 提交 a8b53c24 编写于 作者: sangshuduo's avatar sangshuduo 提交者: GitHub

[TD-10863]<fix>: blm3 service on centos7 (#8565)

上级 4b8fffcf
...@@ -179,7 +179,8 @@ function check_header_path() { ...@@ -179,7 +179,8 @@ function check_header_path() {
function check_blm3_config_dir() { function check_blm3_config_dir() {
# check all config # check all config
check_file ${cfg_install_dir} blm3.toml check_file ${cfg_install_dir} blm.toml
check_file ${cfg_install_dir} blm3.service
check_file ${install_main_dir}/cfg blm.toml.org check_file ${install_main_dir}/cfg blm.toml.org
echo -e "Check conf path:\033[32mOK\033[0m!" echo -e "Check conf path:\033[32mOK\033[0m!"
} }
......
...@@ -32,5 +32,9 @@ if [ -f "${install_main_dir}/blm.toml" ]; then ...@@ -32,5 +32,9 @@ if [ -f "${install_main_dir}/blm.toml" ]; then
${csudo} rm -f ${install_main_dir}/cfg/blm.toml || : ${csudo} rm -f ${install_main_dir}/cfg/blm.toml || :
fi fi
if [ -f "${install_main_dir}/blm3.service" ]; then
${csudo} rm -f ${install_main_dir}/cfg/blm3.service || :
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* || :
...@@ -47,6 +47,9 @@ cp ${compile_dir}/../packaging/cfg/taos.cfg ${pkg_dir}${install_home_pat ...@@ -47,6 +47,9 @@ cp ${compile_dir}/../packaging/cfg/taos.cfg ${pkg_dir}${install_home_pat
if [ -f "${compile_dir}/test/cfg/blm.toml" ]; then if [ -f "${compile_dir}/test/cfg/blm.toml" ]; then
cp ${compile_dir}/test/cfg/blm.toml ${pkg_dir}${install_home_path}/cfg cp ${compile_dir}/test/cfg/blm.toml ${pkg_dir}${install_home_path}/cfg
fi fi
if [ -f "${compile_dir}/test/cfg/blm3.service" ]; then
cp ${compile_dir}/test/cfg/blm3.service ${pkg_dir}${install_home_path}/cfg ||:
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
......
...@@ -57,6 +57,9 @@ cp %{_compiledir}/../packaging/cfg/taos.cfg %{buildroot}%{homepath}/cfg ...@@ -57,6 +57,9 @@ cp %{_compiledir}/../packaging/cfg/taos.cfg %{buildroot}%{homepath}/cfg
if [ -f %{_compiledir}/test/cfg/blm.toml ]; then if [ -f %{_compiledir}/test/cfg/blm.toml ]; then
cp %{_compiledir}/test/cfg/blm.toml %{buildroot}%{homepath}/cfg cp %{_compiledir}/test/cfg/blm.toml %{buildroot}%{homepath}/cfg
fi fi
if [ -f %{_compiledir}/test/cfg/blm3.service ]; then
cp %{_compiledir}/test/cfg/blm3.service %{buildroot}%{homepath}/cfg
fi
cp %{_compiledir}/../packaging/rpm/taosd %{buildroot}%{homepath}/init.d cp %{_compiledir}/../packaging/rpm/taosd %{buildroot}%{homepath}/init.d
cp %{_compiledir}/../packaging/tools/post.sh %{buildroot}%{homepath}/script cp %{_compiledir}/../packaging/tools/post.sh %{buildroot}%{homepath}/script
cp %{_compiledir}/../packaging/tools/preun.sh %{buildroot}%{homepath}/script cp %{_compiledir}/../packaging/tools/preun.sh %{buildroot}%{homepath}/script
...@@ -153,16 +156,21 @@ if pidof taosd &> /dev/null; then ...@@ -153,16 +156,21 @@ if pidof taosd &> /dev/null; then
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 exist, remove it
if [ -f %{cfg_install_dir}/taos.cfg ]; then if [ -f %{cfg_install_dir}/taos.cfg ]; then
${csudo} rm -f %{homepath}/cfg/taos.cfg || : ${csudo} rm -f %{homepath}/cfg/taos.cfg || :
fi fi
# if blm.toml already softlink, remove it # if blm.toml already exist, remove it
if [ -f %{cfg_install_dir}/blm.toml ]; then if [ -f %{cfg_install_dir}/blm.toml ]; then
${csudo} rm -f %{homepath}/cfg/blm.toml || : ${csudo} rm -f %{homepath}/cfg/blm.toml || :
fi fi
# if blm3.service already softlink, remove it
if [ -f %{cfg_install_dir}/blm3.service ]; then
${csudo} rm -f %{homepath}/cfg/blm3.service || :
fi
# there can not libtaos.so*, otherwise ln -s error # there can not libtaos.so*, otherwise ln -s error
${csudo} rm -f %{homepath}/driver/libtaos* || : ${csudo} rm -f %{homepath}/driver/libtaos* || :
......
...@@ -679,8 +679,8 @@ function install_service_on_systemd() { ...@@ -679,8 +679,8 @@ function install_service_on_systemd() {
taosd_service_config="${service_config_dir}/taosd.service" taosd_service_config="${service_config_dir}/taosd.service"
${csudo} bash -c "echo '[Unit]' >> ${taosd_service_config}" ${csudo} bash -c "echo '[Unit]' >> ${taosd_service_config}"
${csudo} bash -c "echo 'Description=TDengine server service' >> ${taosd_service_config}" ${csudo} bash -c "echo 'Description=TDengine server service' >> ${taosd_service_config}"
${csudo} bash -c "echo 'After=network-online.target' >> ${taosd_service_config}" ${csudo} bash -c "echo 'After=network-online.target blm3.service' >> ${taosd_service_config}"
${csudo} bash -c "echo 'Wants=network-online.target' >> ${taosd_service_config}" ${csudo} bash -c "echo 'Wants=network-online.target blm3.service' >> ${taosd_service_config}"
${csudo} bash -c "echo >> ${taosd_service_config}" ${csudo} bash -c "echo >> ${taosd_service_config}"
${csudo} bash -c "echo '[Service]' >> ${taosd_service_config}" ${csudo} bash -c "echo '[Service]' >> ${taosd_service_config}"
${csudo} bash -c "echo 'Type=simple' >> ${taosd_service_config}" ${csudo} bash -c "echo 'Type=simple' >> ${taosd_service_config}"
...@@ -756,6 +756,11 @@ function install_service_on_systemd() { ...@@ -756,6 +756,11 @@ function install_service_on_systemd() {
fi fi
} }
function install_blm3_service() {
[ -f ${script_dir}/cfg/blm3.service ] &&\
${csudo} cp ${script_dir}/cfg/blm3.service ${service_config_dir}/
}
function install_service() { function install_service() {
if ((${service_mod}==0)); then if ((${service_mod}==0)); then
install_service_on_systemd install_service_on_systemd
...@@ -878,6 +883,7 @@ function update_TDengine() { ...@@ -878,6 +883,7 @@ function update_TDengine() {
if [ -z $1 ]; then if [ -z $1 ]; then
install_bin install_bin
install_service install_service
install_blm3_service
install_config install_config
install_blm3_config install_blm3_config
...@@ -959,6 +965,7 @@ function install_TDengine() { ...@@ -959,6 +965,7 @@ function install_TDengine() {
# For installing new # For installing new
install_bin install_bin
install_service install_service
install_blm3_service
openresty_work=false openresty_work=false
if [ "$verMode" == "cluster" ]; then if [ "$verMode" == "cluster" ]; then
......
...@@ -503,8 +503,8 @@ function install_service_on_systemd() { ...@@ -503,8 +503,8 @@ function install_service_on_systemd() {
${csudo} bash -c "echo '[Unit]' >> ${taosd_service_config}" ${csudo} bash -c "echo '[Unit]' >> ${taosd_service_config}"
${csudo} bash -c "echo 'Description=TDengine server service' >> ${taosd_service_config}" ${csudo} bash -c "echo 'Description=TDengine server service' >> ${taosd_service_config}"
${csudo} bash -c "echo 'After=network-online.target' >> ${taosd_service_config}" ${csudo} bash -c "echo 'After=network-online.target blm3.service' >> ${taosd_service_config}"
${csudo} bash -c "echo 'Wants=network-online.target' >> ${taosd_service_config}" ${csudo} bash -c "echo 'Wants=network-online.target blm3.service' >> ${taosd_service_config}"
${csudo} bash -c "echo >> ${taosd_service_config}" ${csudo} bash -c "echo >> ${taosd_service_config}"
${csudo} bash -c "echo '[Service]' >> ${taosd_service_config}" ${csudo} bash -c "echo '[Service]' >> ${taosd_service_config}"
${csudo} bash -c "echo 'Type=simple' >> ${taosd_service_config}" ${csudo} bash -c "echo 'Type=simple' >> ${taosd_service_config}"
...@@ -525,6 +525,11 @@ function install_service_on_systemd() { ...@@ -525,6 +525,11 @@ function install_service_on_systemd() {
${csudo} systemctl enable taosd ${csudo} systemctl enable taosd
} }
function install_blm3_service() {
[ -f ${script_dir}/cfg/blm3.service ] &&\
${csudo} cp ${script_dir}/cfg/blm3.service ${service_config_dir}/
}
function install_service() { function install_service() {
if ((${service_mod}==0)); then if ((${service_mod}==0)); then
install_service_on_systemd install_service_on_systemd
...@@ -566,6 +571,7 @@ function update_TDengine() { ...@@ -566,6 +571,7 @@ function update_TDengine() {
if [ "$osType" != "Darwin" ]; then if [ "$osType" != "Darwin" ]; then
install_service install_service
install_blm3_service
fi fi
install_config install_config
...@@ -620,6 +626,7 @@ function install_TDengine() { ...@@ -620,6 +626,7 @@ function install_TDengine() {
if [ "$osType" != "Darwin" ]; then if [ "$osType" != "Darwin" ]; then
install_service install_service
install_blm3_service
fi fi
install_config install_config
......
...@@ -444,8 +444,8 @@ function install_service_on_systemd() { ...@@ -444,8 +444,8 @@ function install_service_on_systemd() {
${csudo} bash -c "echo '[Unit]' >> ${taosd_service_config}" ${csudo} bash -c "echo '[Unit]' >> ${taosd_service_config}"
${csudo} bash -c "echo 'Description=TDengine server service' >> ${taosd_service_config}" ${csudo} bash -c "echo 'Description=TDengine server service' >> ${taosd_service_config}"
${csudo} bash -c "echo 'After=network-online.target' >> ${taosd_service_config}" ${csudo} bash -c "echo 'After=network-online.target blm3.service' >> ${taosd_service_config}"
${csudo} bash -c "echo 'Wants=network-online.target' >> ${taosd_service_config}" ${csudo} bash -c "echo 'Wants=network-online.target blm3.service' >> ${taosd_service_config}"
${csudo} bash -c "echo >> ${taosd_service_config}" ${csudo} bash -c "echo >> ${taosd_service_config}"
${csudo} bash -c "echo '[Service]' >> ${taosd_service_config}" ${csudo} bash -c "echo '[Service]' >> ${taosd_service_config}"
${csudo} bash -c "echo 'Type=simple' >> ${taosd_service_config}" ${csudo} bash -c "echo 'Type=simple' >> ${taosd_service_config}"
...@@ -466,6 +466,11 @@ function install_service_on_systemd() { ...@@ -466,6 +466,11 @@ function install_service_on_systemd() {
${csudo} systemctl enable taosd ${csudo} systemctl enable taosd
} }
function install_blm3_service() {
[ -f ${script_dir}/cfg/blm3.service ] &&\
${csudo} cp ${script_dir}/cfg/blm3.service ${service_config_dir}/
}
function install_service() { function install_service() {
if ((${service_mod}==0)); then if ((${service_mod}==0)); then
install_service_on_systemd install_service_on_systemd
...@@ -497,6 +502,7 @@ function install_TDengine() { ...@@ -497,6 +502,7 @@ function install_TDengine() {
install_avro_lib install_avro_lib
install_bin install_bin
install_service install_service
install_blm3_service
install_config install_config
install_blm3_config install_blm3_config
......
...@@ -58,6 +58,12 @@ function kill_taosd() { ...@@ -58,6 +58,12 @@ function kill_taosd() {
} }
function clean_service_on_systemd() { function clean_service_on_systemd() {
blm3_service_config="${service_config_dir}/blm3.service"
if systemctl is-active --quiet blm3; then
echo "blm3 is running, stopping it..."
${csudo} systemctl stop blm3 &> /dev/null || echo &> /dev/null
fi
taosd_service_config="${service_config_dir}/${taos_service_name}.service" taosd_service_config="${service_config_dir}/${taos_service_name}.service"
if systemctl is-active --quiet ${taos_service_name}; then if systemctl is-active --quiet ${taos_service_name}; then
...@@ -67,6 +73,9 @@ function clean_service_on_systemd() { ...@@ -67,6 +73,9 @@ function clean_service_on_systemd() {
${csudo} systemctl disable ${taos_service_name} &> /dev/null || echo &> /dev/null ${csudo} systemctl disable ${taos_service_name} &> /dev/null || echo &> /dev/null
${csudo} rm -f ${taosd_service_config} ${csudo} rm -f ${taosd_service_config}
[ -f ${blm3_service_config} ] && ${csudo} rm -f ${blm3_service_config}
} }
function clean_service_on_sysvinit() { function clean_service_on_sysvinit() {
......
...@@ -111,12 +111,14 @@ function clean_log() { ...@@ -111,12 +111,14 @@ function clean_log() {
function clean_service_on_systemd() { function clean_service_on_systemd() {
taosd_service_config="${service_config_dir}/${taos_service_name}.service" taosd_service_config="${service_config_dir}/${taos_service_name}.service"
blm3_service_config="${service_config_dir}/blm3.service"
if systemctl is-active --quiet ${taos_service_name}; then if systemctl is-active --quiet ${taos_service_name}; then
echo "TDengine taosd is running, stopping it..." echo "TDengine taosd is running, stopping it..."
${csudo} systemctl stop ${taos_service_name} &> /dev/null || echo &> /dev/null ${csudo} systemctl stop ${taos_service_name} &> /dev/null || echo &> /dev/null
fi fi
${csudo} systemctl disable ${taos_service_name} &> /dev/null || echo &> /dev/null ${csudo} systemctl disable ${taos_service_name} &> /dev/null || echo &> /dev/null
${csudo} rm -f ${taosd_service_config} ${csudo} rm -f ${taosd_service_config}
[ -f ${blm3_service_config} ] && ${sudo} rm -f ${blm3_service_config}
tarbitratord_service_config="${service_config_dir}/${tarbitrator_service_name}.service" tarbitratord_service_config="${service_config_dir}/${tarbitrator_service_name}.service"
if systemctl is-active --quiet ${tarbitrator_service_name}; then if systemctl is-active --quiet ${tarbitrator_service_name}; then
......
...@@ -48,4 +48,3 @@ if [ ${coreFlag} = "unlimited" ];then ...@@ -48,4 +48,3 @@ if [ ${coreFlag} = "unlimited" ];then
fi fi
fi fi
/usr/bin/blm3 &
...@@ -45,6 +45,7 @@ ELSE () ...@@ -45,6 +45,7 @@ ELSE ()
COMMAND cmake -E copy blm3 ${CMAKE_BINARY_DIR}/build/bin COMMAND cmake -E copy blm3 ${CMAKE_BINARY_DIR}/build/bin
COMMAND cmake -E make_directory ${CMAKE_BINARY_DIR}/test/cfg/ COMMAND cmake -E make_directory ${CMAKE_BINARY_DIR}/test/cfg/
COMMAND cmake -E copy ./example/config/blm.toml ${CMAKE_BINARY_DIR}/test/cfg/ COMMAND cmake -E copy ./example/config/blm.toml ${CMAKE_BINARY_DIR}/test/cfg/
COMMAND cmake -E copy ./blm3.service ${CMAKE_BINARY_DIR}/test/cfg/
) )
ENDIF () ENDIF ()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册