nacos报错:Nacos cluster is running with 1.X mode, can't accept gRPC request temporarily
nacos报错如下:
Caused by: com.alibaba.nacos.api.exception.NacosException: Request nacos server failed:
at com.alibaba.nacos.client.naming.remote.gprc.NamingGrpcClientProxy.requestToServer(NamingGrpcClientProxy.java:227)
at com.alibaba.nacos.client.naming.remote.gprc.NamingGrpcClientProxy.deregisterService(NamingGrpcClientProxy.java:127)
... 49 common frames omitted
Caused by: com.alibaba.nacos.api.exception.NacosException: Nacos cluster is running with 1.X mode, can't accept gRPC request temporarily. Please check the server status or close Double write to force open 2.0 mode. Detail https://nacos.io/en-us/docs/2.0.0-upgrading.html.
at com.alibaba.nacos.client.naming.remote.gprc.NamingGrpcClientProxy.requestToServer(NamingGrpcClientProxy.java:219)
解决方法:
关闭nacos双写。
在2.0.3版本默认开启双写,只要nacos集群其中一个节点挂掉,剩余节点如果不将这个节点从地址列表中移除,只要重启便会出现服务降级;另外在并发部署的情况下,也有可能出现服务降级。
关闭双写会关闭运行中服务降级的入口,所以2.x服务运行稳定后一定要关闭双写。
否则在一定的场景下可能出现服务降级导致部分节点不可用。
- nacos查看节点监控:
curl -X GET 'nacos的ip:端口/nacos/v1/ns/upgrade/ops/metrics'
结果如下:
可以看到 isDoubleWriteEnabled = true,双写是开启的。
[logs@xx logs]$ curl -X GET 'nacos的ip:端口/nacos/v1/ns/upgrade/ops/metrics'
upgraded = false
isAll20XVersion = true
isDoubleWriteEnabled = true
doubleWriteDelayTaskCount = 0
serviceCountV1 = 0
instanceCountV1 = 0
serviceCountV2 = 0
instanceCountV2 = 16
subscribeCountV2 = 0
responsibleServiceCountV1 = 0
responsibleInstanceCountV1 = 0
ephemeralServiceCountV2 = 0
persistentServiceCountV2 = 0
ephemeralInstanceCountV2 = 0
persistentInstanceCountV2 = 0
service.V1.not.in.V2 =
service.V2.not.in.V1 =
nacos关闭双写:
curl -X PUT 'nacos的ip:端口/nacos/v1/ns/operator/switches?entry=doubleWriteEnabled&value=false'
如果报错403,如下:
"status":403,"error":"Forbidden","message":"unknown user!
就需要就加上账号密码:
curl -X PUT 'nacos的ip:端口/nacos/v1/ns/operator/switches?entry=doubleWriteEnabled&value=false&username=xx&password=xx'
显示ok,关闭双写成功,重新启动服务即可。
参考资料:
https://nacos.io/zh-cn/blog/xiaomi-scale.html
https://zhuanlan.zhihu.com/p/482212172
标签:temporarily,gRPC,nacos,报错,mode,NamingGrpcClientProxy,com,双写 From: https://www.cnblogs.com/expiator/p/17358944.html