spring-cloud

spring cloud Hystrix监控面板Hystrix Dashboard和Turbine

久未见 提交于 2019-11-28 03:41:46
我们提到断路器是根据一段时间窗内的请求情况来判断并操作断路器的打开和关闭状态的。而这些请求情况的指标信息都是HystrixCommand和HystrixObservableCommand实例在执行过程中记录的重要度量信息,它们除了Hystrix断路器实现中使用之外,对于系统运维也有非常大的帮助。这些指标信息会以“滚动时间窗”与“桶”结合的方式进行汇总,并在内存中驻留一段时间,以供内部或外部进行查询使用,Hystrix Dashboard就是这些指标内容的消费者之一。 下面我们基于之前的示例来结合Hystrix Dashboard实现Hystrix指标数据的可视化面板,这里我们将用到下之前实现的几个应用,包括: eureka-server:服务注册中心 eureka-client:服务提供者 eureka-consumer-ribbon-hystrix:使用ribbon和hystrix实现的服务消费者 由于eureka-consumer-ribbon-hystrix项目中的 /consumer 接口实现使用了 @HystrixCommand 修饰,所以这个接口的调用情况会被Hystrix记录下来,以用来给断路器和Hystrix Dashboard使用。断路器我们在上一篇中已经介绍过了,下面我们来具体说说Hystrix Dashboard的构建。 动手试一试 在Spring

Turbine——Hystrix集群监控

无人久伴 提交于 2019-11-28 03:41:05
上一篇文章讲述了如何利用Hystrix Dashboard去监控断路器的Hystrix command。当我们有很多个服务的时候,这就需要聚合所有服务的Hystrix Dashboard的数据了。这就需要用到Spring Cloud的另一个组件了,即Hystrix Turbine。 一、Hystrix Turbine简介 看单个的Hystrix Dashboard的数据并没有什么多大的价值,要想看多个系统或集群系统的Hystrix Dashboard数据就需要用到Hystrix Turbine。Hystrix Turbine将每个服务Hystrix Dashboard数据进行了整合。Hystrix Turbine的使用非常简单,只需要引入相应的依赖和加上注解和配置就可以了。 二、准备工作 因为我们需要监控多个服务的Dashboard,所以需要搭建一个Turbine服务来聚合监控 Hystrix 断路器,取名为spring-cloud-hystrix-turbine。 三、创建spring-cloud-hystrix-turbine 1、引入pom依赖 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi

HTTP & RPC & Dubbo & hsf & Spring-cloud 图解比较

允我心安 提交于 2019-11-28 03:26:37
前言 HSF是一个分布式的远程服务调用框架,其实我更喜欢把分布式几个字去掉,因为HSF本身并不是一个单独的服务(指一个进程),他是附属在你的应用里的一个组件,一个RPC组件(远程过程调用——Remote Procedure Call,是一种通过网络从远程计算机程序上请求服务,而不需要了解底层网络技术的协议。在OSI网络通信模型中,RPC跨越了传输层和应用层。RPC使得开发分布式应用更加容易),当然HSF完全的内容肯定不止这些。 ​ HSF(High-speed Service Framework),高速服务框架,是阿里系主要采用的服务框架,其目的是作为桥梁联通不同的业务系统,解耦系统之间的实现依赖。其高速体现在底层的非阻塞I/O以及优秀的序列化机制上,实现了同步和异步调用方式,并且有一套软负载体系,实现分布式应用。 RPC 我们先来看一张图: 很多同学看了这张图可能会觉得这跟http的过程有什么区别? 有这么一个场景(本来想举一个便具体业务的例子,想想还是已技术实现相关的比较好),监控平台:监控所有主机的状态,这时候每台主机上有一个agent,每个几秒向监控平台上传一次数据(主机内存使用率、硬盘状况、CPU、load、进程信息等等)。 可能在开发的时候最简单的方式就是监控平台有一个http接口,agent每隔几秒请求一次,能够满足需求,但是如果主机数快速增长了很多、监控项越来越多

Using Zuul as an authentication gateway

故事扮演 提交于 2019-11-28 03:24:10
Background I want to implement the design presented in this article . It can be summarised by the diagram below: The client first authenticate with the IDP (OpenID Connect/OAuth2) The IDP returns an access token (opaque token with no user info) The client makes a call through the API gateway use the access token in the Authorization header The API gateway makes a request to the IDP with the Access Token The IDP verifies that the Access Token is valid and returns user information in JSON format The API Gateway store the user information in a JWT and sign it with a private key. The JWT is then

Spring Zuul API Gateway with Spring Session / Redis Authenticate and Route in same Request

冷暖自知 提交于 2019-11-27 20:36:12
问题 I have been really been searching high and low for the last few days on how to do this and have finally decided to admit defeat and ask for help, please!!! I have followed Dr Dave Syer's tutorial on Angular and Spring Security specifically the Zuul Proxy as an api gateway and using Spring Session with Redis (https://github.com/spring-guides/tut-spring-security-and-angular-js/tree/master/double#_sso_with_oauth2_angular_js_and_spring_security_part_v) The issue I am having is that I am calling

Spring OAuth Authorization Server behind Spring Cloud Zuul Proxy

淺唱寂寞╮ 提交于 2019-11-27 19:50:41
问题 I am currently developing a application based on a micro service architecture. We use a API-Gateway implemented using Spring Cloud Netfix's Zuul Server to route the requests to our micro services. To realize single sign on for all our services I am currently working on an OAuth2 server set up using Spring Cloud Security. The server is basically just copy and past of the implementation in Dave Syer's Repo: https://github.com/dsyer/spring-security-angular/tree/master/oauth2/authserver The main

How to override Spring Cloud Eureka default discovery client default ssl context?

不问归期 提交于 2019-11-27 19:04:29
问题 I'm trying to enable https for spring cloud eureka server. Yaml config: server: port: 8100 ssl: clientAuth: want protocol: TLS key-store: classpath:keystore/keystore.jks key-store-password: some key-password: some eureka: instance: prefer-ip-address: true non-secure-port-enabled: false secure-port-enabled: true secure-port: ${server.port} healthCheckUrl: https://${eureka.hostname}:${secure-port}/health statusPageUrl: https://${eureka.hostname}:${secure-port}/info homePageUrl: https://${eureka

How do you create custom zuul filters in spring cloud

纵饮孤独 提交于 2019-11-27 15:13:51
I want to write some of my own custom zuul filters for a spring cloud microservice i am writing. Once i have the filter written how do I integrate it so the underlying netflix zuul framework can take advantage of it. Create a @Bean that extends ZuulFilter . See java configuration examples here . As long as the bean is in the same context as the @EnableZuulProxy app, it will automatically get picked up. @Bean public MyFilter myFilter() { return new MyFilter(); } See examples of filters here . public class MyFilter extends ZuulFilter { //... } There are three types of filters: pre, route and

Can I configure a @FeignClient url using a properties/yml file?

断了今生、忘了曾经 提交于 2019-11-27 12:06:10
问题 My goal is to create a strategy of different steps to get from a point-to-point communication between 2 components to a "full blown netflix" style of communication using eureka, ribbon, hystrix. With each iteration I want to add more while I try to limit the amount of changes to the actual code. Feign is my preferred client side framework to make this happen. First step is to create a FeignClient to communicate to the server: @FeignClient(url = "http://localhost:9000") interface Client {

Configuring hystrix command properties using application.yaml in Spring-Boot application

大城市里の小女人 提交于 2019-11-27 11:41:17
问题 I am having same issue, where i am trying to override the hystrix properties in application.yaml. When I run the app & check the properties with localhost:port/app-context/hystrix.stream, I get all default values instead. here is the hystrix config in my application.yaml hystrix: command.StoreSubmission.execution.isolation.thread.timeoutInMilliseconds: 30000 command.StoreSubmission.circuitBreaker.requestVolumeThreshold: 4 command.StoreSubmission.circuitBreaker.sleepWindowInMilliseconds: 60000