文章来源于网络收集而来,版权归原创者所有,如有侵权请及时联系!
6.4 Nacos 集成 Sentinel 配置
Sentinel 的配置规则都是存储到内存中,并没有持久化,因此需要提供一个持久化的解决方案。通过和 Nacos 整合可以将 Sentinel 配置规则推送到 Nacos 上进行存储。具体步骤如下:
(1)在应用中添加依赖包 sentinel-datasource-nacos,具体代码如下:
<dependency> <groupId>com.alibaba.csp</groupId> <artifactId>sentinel-datasource-nacos</artifactId> </dependency>
(2)在配置文件中添加 Nacos 属性配置,具体代码如下:
spring: cloud: sentinel: datasource: flow: nacos: server-addr: 127.0.0.1:8848 dataId: test-flow-rules groupId: test rule-type: flow degrade: nacos: server-addr: 127.0.0.1:8848 dataId: test-degrade-rules groupId: test rule-type: degrade system: nacos: server-addr: 127.0.0.1:8848 dataId: test-system-rules groupId: test rule-type: system authority: nacos: server-addr: 127.0.0.1:8848 dataId: test-authority-rules groupId: test rule-type: authority param-flow: nacos: server-addr: 127.0.0.1:8848 dataId: test-param-flow-rules groupId: test rule-type: param-flow
完成以上配置后,重新启动 Nacos 管理后台即可看到配置的 Sentinel 规则数据信息。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论