currentServerAddr:http://localhost:8848, err : connect timed out

场景复现:

一:原配置文件application.yml

bash 复制代码
spring:
  cloud:
    nacos:
      config:
        server-addr: ${cas-wict-nacos-url}
        namespace: ${cas-wict-nacos-namespace}
        shared-configs:
          - data-id: mysql.properties
            refresh: true
          - data-id: mysql.properties
            refresh: true
          - data-id: job.properties
            refresh: true
      discovery:
        server-addr: ${cas-wict-nacos-url}
        namespace: ${cas-wict-nacos-namespace}
        cluster-name: failover
        metadata:
          protocol: rest

一直报错:currentServerAddr:http://localhost:8848, err : connect timed out

原因:老版本nacos一直优先读本地的bootstrap.properties, 导致application.yml的nacos没能读取到

解决办法:

新增一个bootstrap.properties配置,里面方nacos的配置

相关推荐
一零贰肆3 天前
互联网大厂Java面试题:深入解析SpringCloud微服务架构中的服务注册与发现机制
java·微服务·nacos·面试题·springcloud
谢平康3 天前
nacos配置文件快速部署另一种方法
nacos
东阳马生架构6 天前
Nacos源码—9.Nacos升级gRPC分析四
nacos
东阳马生架构7 天前
Nacos源码—8.Nacos升级gRPC分析三
nacos
东阳马生架构9 天前
Nacos源码—7.Nacos升级gRPC分析四
nacos·注册中心·配置中心
东阳马生架构10 天前
Nacos源码—7.Nacos升级gRPC分析三
nacos·注册中心·配置中心
东阳马生架构10 天前
Nacos源码—7.Nacos升级gRPC分析二
nacos
东阳马生架构11 天前
Nacos源码—6.Nacos升级gRPC分析一
nacos
gxh199211 天前
springboot微服务连接nacos超时
linux·后端·微服务·nacos
东阳马生架构11 天前
Nacos源码—5.Nacos配置中心实现分析二
nacos·注册中心·配置中心