spring - Edgware.Release 不能通过 hystrix.command.default 但 [serviceId] 配置 zuul 超时
问题描述
hystrix:
command:
default:
execution:
timeout:
enabled: true
isolation:
thread:
timeoutInMilliseconds: 30000
在我用我的 serviceId 替换“默认”之前,此属性不起作用。我刚刚看到 Edgware.Release 的文档使用默认的commandKey配置 zuul 超时。
更多信息,我在程序中调试时发现 hytrix 命令是RibbonCommand,并且 commandKey 始终等于我的 serviceId。而且我在spring cloud doc中找不到更改它的地方。
这是我的 application.yml
server:
port: 80
spring:
application:
name: mofeng-pay-zuul
##zipkin:
## base-url: http://localhost:7000
##sleuth:
## sampler:
## percentage: 1.0
eureka:
client:
serviceUrl:
defaultZone: http://localhost:8761/eureka/
logging:
level:
com:
DEBUG
file: ${JAVA_LOG_HOME}/zuul.log
zuul:
ribbonIsolationStrategy: THREAD
threadPool:
useSeparateThreadPools: true
host:
connections: 500
socket-timeout-millis: 30000
connect-timeout-millis: 30000
ribbon:
ReadTimeout: 10000
ConnectTimeout: 10000
MaxAutoRetries: 1
MaxAutoRetriesNextServer: 1
eureka:
enabled: true
eager-load:
enabled: true
clients:
- client-service
hystrix:
command:
client-service:
execution:
timeout:
enabled: true
isolation:
thread:
timeoutInMilliseconds: 30000
删除 hystrix 配置并附加配置,如下所示:
client-service:
ribbon:
ConnectTimeout: 10000
ReadTimeout: 30000
MaxTotalHttpConnections: 500
MaxConnectionsPerHost: 100
它仍然不起作用。
解决方案
这是在Edgware.SR1中更改的错误(实际上是一种改进)。
https://github.com/spring-cloud/spring-cloud-netflix/pull/2633
在Edgware.RELEASE中,您不能使用带default
键的 Hystrix 超时,因为超时是在代码中设置的功能区连接超时加上读取超时。在 Edgware.RELEASE 中设置超时的唯一方法是使用命令键(服务 ID)设置超时。
但它被改变了。请尝试使用Edgware.SR1或更高版本。
推荐阅读
- react-native - 我如何在 expo react native 应用程序中集成 Instagram 身份验证登录
- python - 在 Python 中通过错误处理请求用户输入的递归函数
- inno-setup - 更改设置框架的颜色
- python - 如何验证时间格式输入?
- node.js - 如何在使用 postgres 运行超级测试时修复“无法获取连接”错误
- java - 如何在Java中使用SSH将ubuntu的shell脚本的命令输入结果返回给java
- python - 数据框列中非零连续值的总和和计数
- python - 在嵌套 django 模型中创建查询并在 django 中对结果进行分组
- javascript - 如何在 HighMaps 中通过拖动选择框获取多个区域
- google-apps-script - 在 GoogleSheets 中写得不好