Closed warthur1214 closed 3 years ago
想问下 那个端口 - "9555:9555" 是干啥用的?
@jackwang-wangcb 我没关注,是按官方部署文档下载的yaml。 https://github.com/nacos-group/nacos-docker.git
返回码403,说明打开了鉴权但是没有输入用户名密码,所以鉴权失败导致了注册失败。 或者是用户名密码错误
可以试着debug一下,getSecurityHeader 方法,看下里面的用户名密码是不是正确的
可以试着debug一下,getSecurityHeader 方法,看下里面的用户名密码是不是正确的
@KomachiSion 在 rpcClient.request(request) 之前鉴权token是存在的, 我用nacos-client 1.4.1客户端是可以正常注册。debug信息如下:
我复现不出来这个问题。 我试了下 发起请求前request里是有token的,返回后可能被grpcCLient回收了,但是确实是可以注册的
然后我故意把密码改错, 得到了403的返回。 我认为应该还是设置有问题吧。
或者你提供下你的赋权等信息。
@KomachiSion 没法复现,确实不好定位问题来源。 主要是我配置信息都不变,把nacos-client版本改成1.4.1可以正常注册 我的bootstrap.yaml文件如下:
spring:
application:
name: spring-cloud-nacos-demo
main:
allow-bean-definition-overriding: true
cloud:
nacos:
username: nacos
password: nacos
discovery:
server-addr: localhost:8848
group: DEFAULT_GROUP
config:
server-addr: ${spring.cloud.nacos.discovery.server-addr}
file-extension: yaml
namespace: ${spring.cloud.nacos.discovery.namespace}
extension-configs:
- refresh: true
dataId: redis.yaml
- refresh: true
dataId: jdbc.yaml
- refresh: true
dataId: logback.yaml
- refresh: true
dataId: mybatis.yaml
group: ${spring.cloud.nacos.discovery.group}
调试信息截图:
@KomachiSion 我用的是自建账号密码,当我改成nacos账号后可以注册了。 可能是我的账号权限问题,奇怪的是在客户端1.4.1上没有遇到这个问题。 我再研究下,感谢你抽时间帮我排查问题。
nacos-client 1.4.1可以正常注册。
相关组件版本: spring-cloud-starter-alibaba-nacos-discovery: 2.2.5.RELEASE spring-cloud-starter-alibaba-nacos-config: 2.2.5.RELEASE spring-cloud-starter-dubbo: 2.2.5.RELEASE nacos-client: 2.0.0
部署环境:docker-compose yaml
dubbo 配置如下:
Exception:
debug info:
when
request header accessToken was gone。
已解决此问题: 我的nacos自建账号没有分配public命名空间权限,在nacos-client 1.4.1上可以正常使用。 升级nacos-client2.0后无法注册,分配public命名空间权限后,已可以正常注册。