最近在学习NACOS,心血来潮在虚拟机上部了一台,然后问题来了
首先在访问虚拟机ip http://192.168.2.130:8848/nacos/index.html 可以看到网页,然后在项目中配置
spring.cloud.nacos.discovery.server-addr = 192.168.2.130:8848 以为大功告成,启动,报错。。
ERROR 16160 --- [ main] c.a.n.c.config.http.ServerHttpAgent : [NACOS SocketTimeoutException httpGet] currentServerAddr:http://localhost:8848
去访问localhost了,查了下大概理解是因为nacos的server-addr要配置的是外网ip,虚拟机和本地的外网ip是一致的
curl -L tool.lu/ip 可查看,所以nacos就去查找localhost。