Sentinel icon indicating copy to clipboard operation
Sentinel copied to clipboard

Sentinel规则持久化到Nacos配置中心报错

Open shining-stars-l opened this issue 1 year ago • 3 comments

版本

  • sentinel 1.8.6
  • nacos 2.24

发生的时机

在使用Sentinel的后台管理时候,将配置的限流规则,持久化到nacos时,报错

失败:com.alibaba.nacos.api.exception.NacosException, <html><body><h1>Whitelabel Error Page</h1><p>This application has no explicit mapping for /error, so you are seeing this as a fallback.</p><div id='created'>Wed Mar 20 17:35:49 CST 2024</div><div>There was an unexpected error (type=Forbidden, status=403).</div><div>user not found!</div></body></html>

发生的原因

我知道这是nacos的权限功能的问题,在普通SpringBoot服务连接nacos的依赖是:

<dependency>
            <groupId>com.alibaba.cloud</groupId>
            <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
        </dependency>

通过spring.cloud.nacos.usernamespring.cloud.nacos.password 配置项来连接nacos 但是sentinel没有这个配置,要怎么解决呢

shining-stars-l avatar Mar 20 '24 11:03 shining-stars-l

https://gitee.com/sirius19/sentinel-nacos 可以参考一下我改造的代码,dashboard把规则保存到nacos,以及规则反显

sirius19 avatar Mar 21 '24 01:03 sirius19

MARK

thetcc avatar Apr 11 '24 10:04 thetcc

sentinel-dashboard-push 参考

rowstop avatar May 06 '24 10:05 rowstop