页面树结构
转至元数据结尾
转至元数据起始

(本文档仅供参考)

1、问题说明

     跨库联合查询设置systemctl方式开机自启

2、解决方案

 1、由于跨库服务不能直接通过systemctl方式设置开机自启,需要添加启动脚本unionserver.sh

 cd  SmartbiUnionServer/

#注意:unionserver.sh脚本一定要放在跨库联合查询部署目录下

vi unionserver.sh

#!/bin/bash
PRG="$0"
PRGDIR=`dirname "$PRG"`
cd $PRGDIR
Current_Dir=$(cd `dirname $0`; pwd)

case "$1" in
   'start')
      nohup sh ${Current_Dir}/run.sh > /dev/null 2>&1 &
      ;;
   'stop')
     kill -9 $(ps -ef | grep ""Dnode.id=ffffffff" | grep "log.properties" | awk '{print $2}')
     ;;
   'restart')
     kill -9 $(ps -ef | grep ""Dnode.id=ffffffff" | grep "log.properties" | awk '{print $2}')
     nohup sh ${Current_Dir}/run.sh > /dev/null 2>&1 &
     ;;
   *)
    echo "Usage: $0 {start|stop|restart} --config config-path"
    ;;
esac

并添加执行权限

chmod +x  SmartbiUnionServer/unionserver.sh


2、添加开机自启文件

vi  /usr/lib/systemd/system/smartbi-unionserver.service


[Unit]
Description=Smartbi Unionserver
After=syslog.target network.target remote-fs.target nss-lookup.target

[Service]
Type=forking     
#启动的用户,可以设置普通用户启动,但是要注意用户要有权限进行启动操作             
User=test
Group=test
#/home/test/SmartbiUnionServer替换成实际的跨库部署目录
ExecStart=/home/test/SmartbiUnionServer/unionserver.sh start &>/dev/null
ExecReload=/home/test/SmartbiUnionServer/unionserver.sh restart &>/dev/null
ExecStop=/home/test/SmartbiUnionServer/unionserver.sh stop &>/dev/null
PrivateTmp=true      

[Install]
WantedBy=multi-user.target


3、设置开机自启

systemctl enable smartbi-unionserver

systemctl start smartbi-unionserver   #启动

systemctl stop smartbi-unionserver    #停止

systemctl restart smartbi-unionserver #重启


4、内部测试验证,重启服务器后,查看跨库进程是否启动


设置完成


  • 无标签