我本地启动的nacos服务发现不了

来源:5-1 搭建 SpringBoot Admin 监控服务器

慕粉17858696554

2022-06-19

2022-06-19 11:32:09.259 INFO 17534 — [ main] c.i.ecommerce.NacosClientApplication : No active profile set, falling back to default profiles: default
2022-06-19 11:32:09.576 WARN 17534 — [ main] o.s.boot.actuate.endpoint.EndpointId : Endpoint ID ‘nacos-discovery’ contains invalid characters, please migrate to a valid format.
2022-06-19 11:32:09.713 WARN 17534 — [ main] o.s.boot.actuate.endpoint.EndpointId : Endpoint ID ‘service-registry’ contains invalid characters, please migrate to a valid format.
2022-06-19 11:32:09.786 INFO 17534 — [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=6afdf35b-be50-362a-8583-f4b51fd07e11
2022-06-19 11:32:09.897 WARN 17534 — [ main] c.n.c.sources.URLConfigurationSource : No URLs will be polled as dynamic configuration sources.
2022-06-19 11:32:09.897 INFO 17534 — [ main] c.n.c.sources.URLConfigurationSource : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2022-06-19 11:32:09.900 WARN 17534 — [ main] c.n.c.sources.URLConfigurationSource : No URLs will be polled as dynamic configuration sources.
2022-06-19 11:32:09.900 INFO 17534 — [ main] c.n.c.sources.URLConfigurationSource : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2022-06-19 11:32:09.911 INFO 17534 — [ main] o.s.s.c.ThreadPoolTaskScheduler : Initializing ExecutorService 'Nacos-Watch-Task-Scheduler’
2022-06-19 11:32:10.495 INFO 17534 — [ main] c.i.ecommerce.NacosClientApplication : Started NacosClientApplication in 1.789 seconds (JVM running for 2.434)
也没报错
server:
port: 8080

spring:
application:
name: e-commer-client # 应用名称也是构成 Nacos 配置管理 dataId 字段的一部分 (当 config.prefix 为空时)
cloud:
nacos:
# 服务注册发现
discovery:

enabled: true # 如果不想使用 Nacos 进行服务注册和发现, 设置为 false 即可

    server-addr: http://192.168.0.104:8848
    # server-addr: 127.0.0.1:8848,127.0.0.1:8849,127.0.0.1:8850 # Nacos 服务器地址
    namespace: 2e9e782b-c4fc-4ffe-8201-769abf74aa4f
    配置文件这么写的
写回答

1回答

张勤一

2022-06-19

换成 127.0.0.1;另外,不要用虚拟机

1
0

Spring Cloud / Alibaba 微服务架构实战

从架构设计到开发实践,手把手实现

1210 学习 · 674 问题

查看课程