1.手动启动
nohup java -Dserver.port=9001 -Dcsp.sentinel.dashboard.server=localhost:9001 -Dproject.name=sentinel-dashboard -jar sentinel-dashboard-1.8.6.jar &
默认端口:9001
默认账号:sentinel
默认密码:sentinel
2.开机自启动
注意:如果java jdk没有安装到默认目录,启动会报错:nohup: 无法运行命令“java“: 没有那个文件或目录
解决:启动命令需要完整路径
nohup /opt/jdk1.8.0_133/bin/java ...
1.进入init.d目录
cd /etc/init.d
2.创建服务文件
vim sentinel
3.编写脚本
#!/bin/bash
#chkconfig: 2345 63 37
#description: sentinel service
#processname: sentinel-1.8.6
SENTINEL_HOME=/opt/sentinel/sentinel-dashboard-1.8.6.jar
LOG_DIR=/opt/sentinel/logs
LOG_FILE=$LOG_DIR/sentinel-dashboard.log
LOG_OPTS=$LOG_DIR/sentinel_temp.log
case $1 in
start)
nohup java -Xms256M -Xmx512M -XX:PermSize=128M -XX:MaxPermSize=256M -Dcsp.sentinel.log.dir=$LOG_DIR -Dlogging.file=$LOG_FILE -Dserver.port=9001 -Dcsp.sentinel.dashboard.server=localhost:9001 -Dproject.name=Sentinel Dashboard -jar $SENTINEL_HOME >$LOG_OPTS 2>&1 &
echo "sentinel is started"
;;
stop)
kill -9 `ps -ef | grep ${SENTINEL_HOME} | grep -v grep | awk '{print $2}'`
echo "sentinel is stopped"
;;
restart)
kill -9 `ps -ef | grep ${SENTINEL_HOME} | grep -v grep | awk '{print $2}'`
echo "sentinel is stopped"
sleep 1
nohup java -Xms256M -Xmx512M -XX:PermSize=128M -XX:MaxPermSize=256M -Dcsp.sentinel.log.dir=$LOG_DIR -Dlogging.file=$LOG_FILE -Dserver.port=9001 -Dcsp.sentinel.dashboard.server=localhost:9001 -Dproject.name=Sentinel Dashboard -jar $SENTINEL_HOME >$LOG_OPTS 2>&1 &
echo "sentinel is started"
;;
*)
echo "start|stop|restart"
;;
esac
exit 0
4.修改文件权限:
chmod 777 sentinel
5.添加或删除服务
添加:
chkconfig --add sentinel
删除:
chkconfig --del sentinel
6.启动、停止或重启服务
启动:
service sentinel start
停止:
service sentinel stop
重启:
service sentinel restart
7.设置开启或关闭开机启动
开启:
chkconfig sentinel on
关闭:
chkconfig sentinel off
8.查看sentinel进程,验证是否已启动
ps -ef | grep sentinel
文章评论