[Spring-Cloud-Alibaba] Sentinel 规则持久化 (3)

com.alibaba.csp.sentinel.dashboard.controller.v2.FlowControllerV2中

@Autowired // @Qualifier("flowRuleDefaultProvider") @Qualifier("flowRuleNacosProvider") private DynamicRuleProvider<List<FlowRuleEntity>> ruleProvider; @Autowired // @Qualifier("flowRuleDefaultPublisher") @Qualifier("flowRuleNacosPublisher") private DynamicRulePublisher<List<FlowRuleEntity>> rulePublisher;

打开 /Sentinel-1.6.2/sentinel-dashboard/src/main/webapp/resources/app/scripts/directives/sidebar/sidebar.html文件,修改代码:

<!--<li ui-sref-active="active">--> <!--<a ui-sref="dashboard.flow({app: entry.app})">--> <!--<i></i>&nbsp;&nbsp;流控规则 V1</a>--> <!--</li>--> --- 改为 <li ui-sref-active="active"> <a ui-sref="dashboard.flow({app: entry.app})"> <i></i>&nbsp;&nbsp;NACOS 流控规则 V1</a> </li>

Dashboard中要修改的代码已经好了。

重新启动 Sentinel-dashboard mvn clean package -DskipTests

测试效果

Sentinel 添加流控规则:

[Spring-Cloud-Alibaba] Sentinel 规则持久化

Nacos 查看同步的配置:

[Spring-Cloud-Alibaba] Sentinel 规则持久化

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wsxxyf.html