gpt4 book ai didi

netflix-zuul - Zuul代理无法路由,导致com.netflix.zuul.exception.ZuulException:转发错误

转载 作者:行者123 更新时间:2023-12-04 01:50:58 29 4
gpt4 key购买 nike

我有以下简单服务:

交易核心服务和交易api服务。

transaction-api-service调用Transactions-core-service返回事务列表。 transaction-api-service已使用hystrix命令启用。

两者都使用以下服务ID在Eureka服务器中注册:

TRANSACTIONS-API-SERVICE    n/a (1) (1) UP (1) - 192.168.2.12:transactions-api-service:8083
TRANSACTIONS-CORE-SERVICE n/a (1) (1) UP (1) - 192.168.2.12:transactions-core-service:8087


下面是Zuul服务器:

@SpringBootApplication

@Controller

@EnableZuulProxy

public class ZuulApplication {

public static void main(String[] args) {
new SpringApplicationBuilder(ZuulApplication.class).web(true).run(args);
}
}


Zuul配置:

===============================================

info:
component: Zuul Server

server:
port: 8765

endpoints:
restart:
enabled: true
shutdown:
enabled: true
health:
sensitive: false

zuul:
ignoredServices: "*"
routes:
transactions-api-service:
path: transactions/accounts/**
serviceId: transactions-api-service

eureka:
client:
serviceUrl:
defaultZone: http://localhost:8761/eureka/

logging:
level:
ROOT: INFO
org.springframework.web: DEBUG

===============================================


当我尝试使用url( http://localhost:8765/transactions/accounts/123/transactions/786)调用Transactions-api-service时,出现Zuul异常:


2016-02-13 11:29:29.050 WARN 4936 --- [nio-8765-exec-1]
o.s.c.n.z.filters.post.SendErrorFilter:过滤期间发生错误

com.netflix.zuul.exception.ZuulException:转发错误
在org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.forward(RibbonRoutingFilter.java:131)
〜[spring-cloud-net flix-core-1.1.0.M3.jar:1.1.0.M3]
在org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.run(RibbonRoutingFilter.java:76)
〜[spring-cloud-netflix- core-1.1.0.M3.jar:1.1.0.M3] ......


如果我单独调用transaction-api-service(使用 localhost /accounts/123/transactions/786),则可以正常工作。

我是否在Zuul上缺少任何配置?

最佳答案

您需要通过在zuul服务器的application.yml中添加以下属性来更改zuul执行超时:

# Increase the Hystrix timeout to 60s (globally)
hystrix:
command:
default:
execution:
isolation:
thread:
timeoutInMilliseconds: 60000


请参阅有关netflix问题的此线程: https://github.com/spring-cloud/spring-cloud-netflix/issues/321

关于netflix-zuul - Zuul代理无法路由,导致com.netflix.zuul.exception.ZuulException:转发错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35376860/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com