- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个 python 应用程序,使用端口 8004,它有端点。我需要将其集成到微服务平台中,该平台有Eureka发现服务器端口8001,Spring Boot管理端口8002,网关端口80。网关使用Zuul代理,它将请求转发到所需的服务。
我有两个选择:
我决定拥有 sidecar。 Sidecar 端口 8003,python-app 端口 8004。@EnableSidecar
注释 + @EnableDiscoveryClient
- 和魔法。然后我需要添加网关配置以将请求转发到 python-service。我需要配置 sidecar Zuul Proxy,以便它将请求转发到 python 应用程序。
网关端口 80 -> sidecar 端口 8003 -> python-app 端口 8004。
漂亮,而且有效。当我打开 Eureka web-ui 时,所有服务都在那里。当我打开 Spring Boot 管理 UI 时,它显示 python-service(其 sidecar)已关闭。
Spring Boot Admin 客户端(sidecar 端配置),端口为 28003,与 sidecar 不同。
management:
server:
port: 18003
endpoints:
web:
exposure:
include: '*'
endpoint:
health:
show-details: ALWAYS
我用@EnableZuulProxy替换了@EnableSidecar。现在一切正常,并且 python-app 在 Spring Boot Admin 中可见。
我的两个问题:
如果sidecar默认不需要断路器,为什么@EnableSidecar
有@EnableCircuitBreaker
?如果有一个 sidecar 实例和多个 python-service 实例,这是有意义的。我有 1:1 - 一个 sidecar 和一个 python-app。如果 python 应用程序不可用,sidecar 应该返回错误。我不需要断路器吗?还是我呢?
为什么注解@EnableSidecar
会影响Spring Boot客户端,因此它不会显示在Spring Boot管理UI上。我认为存在错误,或者如何在 Spring Boot Admin web-ui 中启用 sidecar 进行监控。
Spring Boot版本为2.0.7,Spring Cloud版本为2.0.0
最佳答案
sidecar 不应将请求代理到非 jvm 服务。它使用java eureka客户端代表非jvm服务进行注册。然后非jvm服务可以使用sidecar中嵌入的zuul向其他服务发出请求。它不需要了解 eureka、hystrix(断路器)或 Ribbon(客户端负载均衡器),但这是可选的。
关于java - 为什么Spring Cloud @EnableSidecar使用@EnableCircuitBreaker,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55902559/
我是一名优秀的程序员,十分优秀!