一、Sentinel 概述
- 官方链接: https://github.com/alibaba/Sentinel/wiki/%E4%BB%8B%E7%BB%8D
二、Sentinel 环境配置
#上传资源jar包至Linux目录
/opt/module/alibaba/sentinel

#spring settings
spring.http.encoding.force=true
spring.http.encoding.charset=UTF-8
spring.http.encoding.enabled=true
#cookie name setting
server.servlet.session.cookie.name=sentinel_dashboard_cookie
#logging settings
logging.level.org.springframework.web=INFO
logging.file=${user.home}/logs/csp/sentinel-dashboard.log
logging.pattern.file= %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n
#logging.pattern.console= %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n
#auth settings
auth.filter.exclude-urls=/,/auth/login,/auth/logout,/registry/machine,/version
auth.filter.exclude-url-suffixes=htm,html,js,css,map,ico,ttf,woff,png
# If auth.enabled=false, Sentinel console disable login
auth.username=sentinel
auth.password=sentinel
# Inject the dashboard version. It's required to enable
# filtering in pom.xml for this resource file.
sentinel.dashboard.version=1.8.1
#切换目录
cd /etc/rc.d/init.d
#创建脚本
vim sentinel
#脚本内容
#!/bin/bash
#
# chkconfig: 2345 10 90
#
# description:auto_run
#程序名
RUN_NAME="sentinel-dashboard-1.8.1.jar"
#资源位置
JAVA_OPTS=/opt/module/alibaba/sentinel/sentinel-dashboard-1.8.1.jar
#日志位置
LOG_DIR=/opt/module/alibaba/sentinel/logs/csp
LOG_FILE=$LOG_DIR/sentinel-dashboard.log
LOG_OPTS=/opt/module/alibaba/sentinel/sentinel_temp.log
#开始方法
start() {
source /etc/profile; nohup java -Xms256M -Xmx512M -XX:PermSize=128M -XX:MaxPermSize=256M -Dcsp.sentinel.log.dir=$LOG_DIR -Dlogging.file=$LOG_FILE -Dserver.port=9100 -Dcsp.sentinel.dashboard.server=127.0.0.1:9100 -Dproject.name=Sentinel基本控制台 -jar $JAVA_OPTS >$LOG_OPTS 2>&1 &
echo "$RUN_NAME started success."
}
#结束方法
stop() {
echo "stopping $RUN_NAME ..."
kill -9 `ps -ef|grep $JAVA_OPTS|grep -v grep|grep -v stop|awk '{print $2}'`
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo "Userage: $0 {start|stop|restart}"
exit 1
esac

#刷新配置
systemctl daemon-reload
#授权为可执行文件
chmod +x sentinel
chmod +x /opt/module/alibaba/sentinel/sentinel-dashboard-1.8.1.jar
#添加至系统服务
chkconfig --add sentinel
#开机自启
chkconfig sentinel on
#查看服务列表
chkconfig --list

#启停
systemctl start|stop|restart sentinel
#查看进程
ps -ef|grep sentinel

#访问地址
http://您的IP:9100/
#账户密码
sentinel sentinel
