alibaba / nacos

an easy-to-use dynamic service discovery, configuration and service management platform for building cloud native applications.
https://nacos.io
Apache License 2.0
30.29k stars 12.84k forks source link

nacos currentServerAddr http://localhost:8848, Connection refused: connect #2941

Closed lidongdongli closed 4 years ago

lidongdongli commented 4 years ago

问题一: 使用

com.alibaba.cloud
        <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
        <version>2.2.1.RELEASE</version>
    </dependency>

单独配置 服务端口 server: port: ${random.int[18000,18999]} spring: application: name: producter cloud: nacos: config: server-addr: 10.10.3.62:8858 discovery: server-addr: 10.10.3.62:8858

但是启动时出现连接8848端口异常,信息如下 16:03:46.975 [main] [] ERROR com.alibaba.nacos.client.config.http.ServerHttpAgent - [NACOS SocketTimeoutException httpGet] currentServerAddr:http://localhost:8848, err : connect timed out 16:03:48.978 [main] [] ERROR com.alibaba.nacos.client.config.http.ServerHttpAgent - [NACOS SocketTimeoutException httpGet] currentServerAddr:http://localhost:8848, err : connect timed out 16:03:48.978 [main] [] ERROR com.alibaba.nacos.client.config.http.ServerHttpAgent - no available server 16:03:48.978 [main] [] ERROR com.alibaba.nacos.client.config.impl.ClientWorker - [fixed-localhost_8848] [sub-server] get server config exception, dataId=producter, group=DEFAULT_GROUP, tenant= java.net.ConnectException: no available server

此服务提供者工程未配置任何8848端口,为什么去连8848? 另外服务在控制台中可以看到注册成功.

问题二: 消费者调用服务时,出现以下异常, 15:36:07.232 [com.alibaba.nacos.client.Worker.longPolling.fixed-localhost_8848] [] ERROR com.alibaba.nacos.client.config.http.ServerHttpAgent - [NACOS ConnectException httpPost] currentServerAddr: http://localhost:8848, err : Connection refused: connect 15:36:09.237 [com.alibaba.nacos.client.Worker.longPolling.fixed-localhost_8848] [] ERROR com.alibaba.nacos.client.config.http.ServerHttpAgent - [NACOS ConnectException httpPost] currentServerAddr: http://localhost:8848, err : Connection refused: connect 15:36:09.237 [com.alibaba.nacos.client.Worker.longPolling.fixed-localhost_8848] [] ERROR com.alibaba.nacos.client.config.impl.ClientWorker - [fixed-localhost_8848] [check-update] get changed dataId exception java.net.ConnectException: [NACOS HTTP-POST] The maximum number of tolerable server reconnection errors has been reached at com.alibaba.nacos.client.config.http.ServerHttpAgent.httpPost(ServerHttpAgent.java:170) ~[nacos-client-1.2.1.jar:?] at com.alibaba.nacos.client.config.http.MetricsHttpAgent.httpPost(MetricsHttpAgent.java:64) ~[nacos-client-1.2.1.jar:?] at com.alibaba.nacos.client.config.impl.ClientWorker.checkUpdateConfigStr(ClientWorker.java:386) ~[nacos-client-1.2.1.jar:?] at com.alibaba.nacos.client.config.impl.ClientWorker.checkUpdateDataIds(ClientWorker.java:354) ~[nacos-client-1.2.1.jar:?] at com.alibaba.nacos.client.config.impl.ClientWorker$LongPollingRunnable.run(ClientWorker.java:521) ~[nacos-client-1.2.1.jar:?] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_181] at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_181] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) ~[?:1.8.0_181] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) ~[?:1.8.0_181] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_181] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_181] at java.lang.Thread.run(Thread.java:748) [?:1.8.0_181] 15:36:09.237 [com.alibaba.nacos.client.Worker.longPolling.fixed-localhost_8848] [] ERROR com.alibaba.nacos.client.config.impl.ClientWorker - longPolling error : java.net.ConnectException: [NACOS HTTP-POST] The maximum number of tolerable server reconnection errors has been reached at com.alibaba.nacos.client.config.http.ServerHttpAgent.httpPost(ServerHttpAgent.java:170) ~[nacos-client-1.2.1.jar:?] at com.alibaba.nacos.client.config.http.MetricsHttpAgent.httpPost(MetricsHttpAgent.java:64) ~[nacos-client-1.2.1.jar:?] at com.alibaba.nacos.client.config.impl.ClientWorker.checkUpdateConfigStr(ClientWorker.java:386) ~[nacos-client-1.2.1.jar:?] at com.alibaba.nacos.client.config.impl.ClientWorker.checkUpdateDataIds(ClientWorker.java:354) ~[nacos-client-1.2.1.jar:?] at com.alibaba.nacos.client.config.impl.ClientWorker$LongPollingRunnable.run(ClientWorker.java:521) ~[nacos-client-1.2.1.jar:?] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_181] at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_181] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) ~[?:1.8.0_181] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) ~[?:1.8.0_181] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_181] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_181] at java.lang.Thread.run(Thread.java:748) [?:1.8.0_181]

怀疑与上面问题一异常原因相同. 服务调用正常返回数据.

都是单机环境 nacos server版本NACOS1.3.0-BETA 代码使用springcloud,

chuntaojun commented 4 years ago

Issue moved to alibaba/spring-cloud-alibaba #1504 via ZenHub