【问题描述】dubbo rpc 使用nacos2.0以上的版本后报错
2024-01-03T23:07:09.187+08:00 ERROR 77323 --- [t.remote.worker] c.a.n.c.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
at com.alibaba.nacos.shaded.com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:566) ~[nacos-client-2.2.1-RC.jar:na]
at com.alibaba.nacos.shaded.com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:445) ~[nacos-client-2.2.1-RC.jar:na]
at com.alibaba.nacos.common.remote.client.grpc.GrpcClient.serverCheck(GrpcClient.java:196) ~[nacos-client-2.2.1-RC.jar:na]
at com.alibaba.nacos.common.remote.client.grpc.GrpcClient.connectToServer(GrpcClient.java:307) ~[nacos-client-2.2.1-RC.jar:na]
at com.alibaba.nacos.common.remote.client.RpcClient.reconnect(RpcClient.java:498) ~[nacos-client-2.2.1-RC.jar:na]
at com.alibaba.nacos.common.remote.client.RpcClient.lambda$start$2(RpcClient.java:339) ~[nacos-client-2.2.1-RC.jar:na]
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[na:na]
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na]
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[na:na]
at java.base/java.lang.Thread.run(Thread.java:833) ~[na:na]
Caused by: com.alibaba.nacos.shaded.io.grpc.StatusRuntimeException: UNAVAILABLE: io exception
at com.alibaba.nacos.shaded.io.grpc.Status.asRuntimeException(Status.java:533) ~[nacos-client-2.2.1-RC.jar:na]
at com.alibaba.nacos.shaded.io.grpc.stub.ClientCalls$UnaryStreamToFuture.onClose(ClientCalls.java:515) ~[nacos-client-2.2.1-RC.jar:na]
【问题解决】
nacos 2.x 版本后需要多开放两个端口 查看启动nacos的时候是否有对应的端口映射
docker run --name nacos-standalone -e MODE=standalone -p 8848:8848 -p 9848:9848 -p 9849:8849-d nacos/nacos-server