在华为云上搭建了Nacos2.3.0之后,本地一直无法连到Nacos,报错信息截取部分如下:
2023-09-06 20:45:48.275 WARN 2476 --- [ restartedMain] c.e.AnnotationNacosPropertySourceBuilder :
There is no content for NacosPropertySource from dataId[testDataID] ,
groupId[DEFAULT_GROUP] , properties[{accessKey=${nacos.access-key:}, clusterName=${nacos.cluster-name:},
configLongPollTimeout=${nacos.configLongPollTimeout:}, configRetryTime=${nacos.configRetryTime:},
contextPath=${nacos.context-path:}, enableRemoteSyncConfig=${nacos.enableRemoteSyncConfig:}, encode=${nacos.encode:UTF-8},
endpoint=${nacos.endpoint:}, maxRetry=${nacos.maxRetry:}, namespace=${nacos.namespace:}, password=${nacos.password:}, secretKey=${nacos.secret-key:},
serverAddr=${nacos.server-addr:}, username=${nacos.username:}}].
***************************
APPLICATION FAILED TO START
***************************
Description:
server error: such as timeout. Request nacos server failed:
Action:
please check server status
网上大部分说是版本问题,随即换了各种版本,还是一样的问题…直到找到了这个文章:
https://blog.csdn.net/weixin_43154932/article/details/130496175
才知道还要开两个端口号:
在华为云上把9848、9849开了端口开了后,可以正常连接。如果是部署在云上的Nacos出了同样的问题可以看看是不是端口号没开,需要开三个端口:8848、9848、9849
参考连接:
1.https://blog.csdn.net/weixin_43154932/article/details/130496175
2.https://nacos.io/zh-cn/docs/v2/upgrading/2.0.0-compatibility.html