更新时间:2022-09-13 GMT+08:00
分享

注册中心地址错误

问题描述

当使用Spring Cloud Huawei时,启动微服务时,当报错示例如下:
send request to https://192.168.10.1:30100/v4/default/registry/microservices failed and retry to https://192.168.10.1:30100/v4/default/registry/microservices once.
org.apache.http.conn.HttpHostConnectException: Connect to 192.168.10.1:30100 [/127.0.0.2] failed: Connection refused: connect
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:156) ~[httpclient-4.5.13.jar:4.5.13]
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:376) ~[httpclient-4.5.13.jar:4.5.13]

原因分析

上述报错,是微服务注册中心地址不可用导致的。

解决方法

  • 启动服务在本地部署
    在本地机器上使用curl https://注册中心IP地址:30100/health命令检查注册中心工作状态,查看是否返回类似如下信息:
    curl: Failed to connect to xxx.xxx.xxx.xxx port 30100: Connection refused

    如果是,请检查是否因注册中心IP地址错误、注册中心端口号错误或者网络被隔离,导致网络不通。

  • 启动服务在云上微服务引擎部署

    微服务通过ServiceStage部署在微服务引擎,注册中心地址可以通过环境变量自动注入。请检查注入的注册中心地址是否正确。如果注册中心地址错误,请修改为正确地址并重新部署服务。

分享:

    相关文档

    相关产品