目录
关于 gateway中提供统一端口访问时,请求外部服务如何处理
如何使用 feign client 调用外部服务
如果config 服务未接入注册中心的话,如果获取配置
如何使用config-server 在本地存储各个服务的配置文件以及如何提取公共配置
如何替换endpoint 采集服务的信息到turbine ,而是使用stream 比如 rabbitmq ,客户端通过rabbitmq 发送数据,turbine消费服务状态数据
zuul:routes:auth-service:path: /uaa/**###因为其没有在注册中心里面所以我们使用url 进行调转url: auth-service:5000stripPrefix: falsesensitiveHeaders:
rates:url:
@FeignClient(url = "${rates.url}", name = "rates-client", fallback = ExchangeRatesClientFallback.class)
public interface ExchangeRatesClient {@RequestMapping(method = RequestMethod.GET, value = "/latest")ExchangeRatesContainer getRates(@RequestParam("base") Currency base);}
spring:cloud:config:uri: config:8888fail-fast: truepassword: ${CONFIG_SERVICE_PASSWORD}username: user
spring:cloud:config:server:native:search-locations: classpath:/sharedprofiles:active: native
logging:level:org.springframework.security: INFOhystrix:command:default:execution:isolation:thread:timeoutInMilliseconds: 10000eureka:instance:prefer-ip-address: trueclient:serviceUrl:defaultZone: registry:8761/eureka/
服务端 和 客户端 需要添加依赖 ,服务端添加添加注解 @EnableTurbineStream即可
<dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-netflix-hystrix-stream</artifactId></dependency><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-stream-rabbit</artifactId></dependency>
然后就可以直接使用hystrix-dashboard 进行集群或者单个服务的监控了 ,集群的话默默认使用服务实例id作为名称 ,default 的返回所有
:8989/turbine.stream?cluster=customers
:8989/turbine.stream?cluster=products
:8989/turbine.stream?cluster=default
:8989/turbine.stream
可以用如下配置实现自定义集群
turbine:appConfig: PRODUCT,ORDERclusterNameExpression: "'default'"
one by one
spring cloud sleuth 官方文档
参考该章节Only Sleuth (log correlation)
参考该章节 Sleuth with Zipkin via HTTP
参考该章节 Sleuth with Zipkin over RabbitMQ or Kafka
参考该章节 JSON Logback with Logstash
本文发布于:2024-01-30 19:58:03,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/170661588622457.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |