Consul+Zuul报错zuul.exception.ZuulException: 和 zuul.exceptionZuulException: Forwarding error

两个错误,

  • 错误一:

com.netflix.zuul.exception.ZuulException: Forwarding error

Caused by: java.lang.RuntimeException: java.net.SocketTimeoutException: Read timed out

at rx.exceptions.Exceptions.propagate(Exceptions.java:58) ~[rxjava-1.1.10.jar:1.1.10]

at rx.observables.BlockingObservable.blockForSingle(BlockingObservable.java:465) ~[rxjava-1.1.10.jar:1.1.10]

at rx.observables.BlockingObservable.single(BlockingObservable.java:342) ~[rxjava-1.1.10.jar:1.1.10]

at com.netflix.client.AbstractLoadBalancerAwareClient.executeWithLoadBalancer(AbstractLoadBalancerAwareClient.java:117) ~[ribbon-loadbalancer-2.2.2.jar:2.2.2]

... 132 common frames omitted

Caused by: java.net.SocketTimeoutException: Read timed out

  • 错误二:

com.netflix.zuul.exception.ZuulException: Forwarding error

Caused by: com.netflix.client.ClientException: Load balancer does not have available [Consul服务上的已经注册成功的服务名]

 

断路器问题/ribbon问题,加了配置:

zuul:
  host:
    connect-timeout-millis: 3000
    socket-timeout-millis: 60000

# 添加ribbon的超时时间设置
ribbon:
  ReadTimeout: 60000
  ConnectTimeout: 60000
hystrix:
  command:
    default:
      execution:
        isolation:
          thread:
            timeoutInMilliseconds: 60000

 

我这里报的是错误二:

解决方案是

spring.cloud.consul.ribbon.enabled=false
# 示例:hello-world.ribbon.listOfServers=192.168.26.183:8777
{替换成需要调用的服务名}.ribbon.listOfServers={替换成需要调用服务的IP:端口号}

 

 大部分网上的解决方法是eureka的解决方法:

 

再次查询,成功。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值