版本:Sentinel1.7.1 官方github地址:github.com/alibaba/Sen…
1、修改sentinel-dashboard项目中的pom文件
<dependency>
<groupId>com.alibaba.csp</groupId>
<artifactId>sentinel-datasource-nacos</artifactId>
<scope>test</scope>
</dependency>
去掉<scope>test</scope>
2、调整test中的java类到项目
展开test->java->com.alibaba.csp.sentinel.dashboard->rule->nacos
复制NacosConfig到src->java->com.alibaba.csp.sentinel.dashboard->config
复制其余3个文件到src->java->com.alibaba.csp.sentinel.dashboard->rule
3、修改主题类中的controller
src->java->com.alibaba.csp.sentinel.dashboard->controller->v2->FlowControllerV2
@Qualifier("flowRuleDefaultProvider") 改为 @Qualifier("flowRuleNacosProvider")
@Qualifier("flowRuleDefaultPublisher") 改为 @Qualifier("flowRuleNacosPublisher")
4、修改前端html
注释掉
<li ui-sref-active="active" ng-if="!entry.isGateway">
<a ui-sref="dashboard.flowV1({app: entry.app})">
<i class="glyphicon glyphicon-filter"></i> 流控规则</a>
</li>
解除
<li ui-sref-active="active" ng-if="entry.appType==0">
<a ui-sref="dashboard.flow({app: entry.app})">
<i class="glyphicon glyphicon-filter"></i> 流控规则 V1</a>
</li>
将描述 流控规则 V1 改为 流控规则 V2
5、打包
通过maven命令mvn clean package -Dmaven.test.skip=true打包,在target找到该jar包
6、启动sentinel服务
java -Dserver.port=8333 -Dcsp.sentinel.api.port=8719 -Dsentinel.dashboard.auth.username=admin -Dsentinel.dashboard.auth.password=123456 -Dcsp.sentinel.dashboard.server=localhost:8333 -Dproject.name=sentinel-dashboard -jar sentinel-dashboard.jar