将nacos从本地切换到远程服务器上时报错:客户端端未连接,Client not connected
报错信息:
09:34:38.438 [com.alibaba.nacos.client.Worker] ERROR com.alibaba.nacos.common.remote.client - Send request fail, request = ConfigBatchListenRequest{headers={charset=UTF-8, Client-AppName=unknown, Client-RequestToken=65c0fbf47282ae0a7b85178dcf076771, Client-RequestTS=1684114478337, exConfigInfo=true}, requestId='null'}, retryTimes = 0, errorMessage = Client not connected, current status:STARTING09:34:38.462 [com.alibaba.nacos.client.remote.worker] ERROR com.alibaba.nacos.common.remote.client.grpc.GrpcClient - Server check fail, please check server localhost ,port 9848 is available , error =java.util.concurrent.ExecutionException: com.alibaba.nacos.shaded.io.grpc.StatusRuntimeException: UNAVAILABLE: io exception09:34:38.539 [com.alibaba.nacos.client.Worker] ERROR com.alibaba.nacos.common.remote.client - Send request fail, request = ConfigBatchListenRequest{headers={charset=UTF-8, Client-AppName=unknown, Client-RequestToken=65c0fbf47282ae0a7b85178dcf076771, Client-RequestTS=1684114478337, exConfigInfo=true}, requestId='null'}, retryTimes = 1, errorMessage = Client not connected, current status:STARTING09:34:38.640 [com.alibaba.nacos.client.Worker] ERROR com.alibaba.nacos.common.remote.client - Send request fail, request = ConfigBatchListenRequest{headers={charset=UTF-8, Client-AppName=unknown, Client-RequestToken=65c0fbf47282ae0a7b85178dcf076771, Client-RequestTS=1684114478337, exConfigInfo=true}, requestId='null'}, retryTimes = 2, errorMessage = Client not connected, current status:STARTING09:34:38.640 [com.alibaba.nacos.client.Worker] ERROR com.alibaba.nacos.client.config.impl.ClientWorker - Async listen config change error com.alibaba.nacos.api.exception.NacosException: Client not connected, current status:STARTINGat com.alibaba.nacos.common.remote.client.RpcClient.request(RpcClient.java:651) ~[nacos-client-2.1.0.jar:?]at com.alibaba.nacos.client.config.impl.ClientWorker$ConfigRpcTransportClient.requestProxy(ClientWorker.java:1005) ~[nacos-client-2.1.0.jar:?]at com.alibaba.nacos.client.config.impl.ClientWorker$ConfigRpcTransportClient.requestProxy(ClientWorker.java:986) ~[nacos-client-2.1.0.jar:?]at com.alibaba.nacos.client.config.impl.ClientWorker$ConfigRpcTransportClient.executeConfigListen(ClientWorker.java:777) ~[nacos-client-2.1.0.jar:?]at com.alibaba.nacos.client.config.impl.ClientWorker$ConfigRpcTransportClient.lambda$startInternal$2(ClientWorker.java:695) ~[nacos-client-2.1.0.jar:?]at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_201]at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_201]at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [?:1.8.0_201]at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [?:1.8.0_201]at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_201]at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_201]at java.lang.Thread.run(Thread.java:748) [?:1.8.0_201]
找到了其中比较关键的一句:ERROR com.alibaba.nacos.common.remote.client.grpc.GrpcClient - Server check fail, please check server localhost
,port 9848 is available , error =java.util.concurrent.ExecutionException: com.alibaba.nacos.shaded.io.grpc.StatusRuntimeException: UNAVAILABLE: io exception
大意是:请检查”服务器localhost 端口9848 ,这个服务器不可用“
本地nacos并没有启动,所以这样提示没有问题,但是问题在于为什么会提示服务器是localhost本地,而不是远程服务器,因为有关nacos的配置全都是配置的远程服务器的地址、端口等。
解决:
-
检查项目配置是否改掉了配置:没有改成远程的nacos的配置。结果发现配置没有问题,因为整个配置的更改都是直接使用Eclipse的替换的。
-
但是替换有个问题是:只能替换已有的文本,对应默认的配置是没法替换的。
-
比如,当前这个问题,就是因为spring.cloud.nacos.config的配置信息中没有配置nacos的配置地址spring.cloud.nacos.config.server-addr(采用的默认的本地地址端口localhost:8848),
只配置了nacos的服务发现的地址,spring.cloud.nacos.discovery.server-addr=47.109.90.76:8848。 -
所以,一定要显示同时配置出Nacos的服务注册/发现以及配置的地址,
如下:
spring.application.name=your-application-namespring.cloud.nacos.discovery.server-addr=ip:portspring.cloud.nacos.discovery.enabled=truespring.cloud.nacos.username=nacosspring.cloud.nacos.password=your-passwordspring.cloud.nacos.config.server-addr=ip:portspring.cloud.nacos.config.group=your-group-namespring.cloud.nacos.config.file-extension=propertiesspring.cloud.nacos.config.refresh-enabled=true
来源地址:https://blog.csdn.net/qq_29025955/article/details/130685971
免责声明:
① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。
② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341