Hystrix Dashboard是Hystrix的仪表盘组件,主要用来实时监控Hystrix的各项指标信息,通过界面反馈的信息可以快速发现系统中存在的问题。

整合快速体验:

pom.xml(这个是F系之后的依赖)

    <dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId>
</dependency>

之前的使用:

<dependency>   
 <groupId>org.springframework.cloud</groupId>  
  <artifactId>spring-cloud-starter-hystrix</artifactId>
</dependency>
<dependency>   
 <groupId>org.springframework.cloud</groupId> 
   <artifactId>spring-cloud-starter-hystrix-dashboard</artifactId>
</dependency><dependency>  
  <groupId>org.springframework.boot</groupId>  
  <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

启动类上加

启动类配置@EnableHystrixDashboard注解

启动类加配置:

package com.cxy;

import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet;
import com.netflix.loadbalancer.BestAvailableRule;
import com.netflix.loadbalancer.IRule;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate; /***
* @ClassName: PersonApplication
* @Description:
* @Auther: 陈绪友
* @Date: 2019/1/2816:30
* @version : V1.0
*/
@EnableCircuitBreaker
@SpringBootApplication
@EnableEurekaClient //开启注解,注册服务
@MapperScan("com.cxy")
@EnableFeignClients
@EnableHystrixDashboard
public class UserApplication {
public static void main(String[] args) { SpringApplication.run(UserApplication.class,args);
}
@Bean
// @LoadBalanced //使用负载均衡器Ribbon
public RestTemplate getRestTemplate(){
return new RestTemplate();
} /*@Bean
public IRule myRule(){
//return new RoundRobinRule();//轮询
// return new RetryRule();//重试
return new BestAvailableRule();
}*/
@Bean
public ServletRegistrationBean getServlet(){
HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet();
ServletRegistrationBean registrationBean = new ServletRegistrationBean(streamServlet);
registrationBean.setLoadOnStartup();
registrationBean.addUrlMappings("/actuator/hystrix.stream");
registrationBean.setName("HystrixMetricsStreamServlet");
return registrationBean;
}
}

http://127.0.0.1:8082/actuator/hystrix.stream  这个路径配置千万不要写localhost

不然控制台报错:

java.net.UnknownHostException: loclahost
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method) ~[na:1.8.0_192]
at java.net.InetAddress$.lookupAllHostAddr(InetAddress.java:) ~[na:1.8.0_192]
at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:) ~[na:1.8.0_192]
at java.net.InetAddress.getAllByName0(InetAddress.java:) ~[na:1.8.0_192]
at java.net.InetAddress.getAllByName(InetAddress.java:) ~[na:1.8.0_192]
at java.net.InetAddress.getAllByName(InetAddress.java:) ~[na:1.8.0_192]
at org.apache.http.impl.conn.SystemDefaultDnsResolver.resolve(SystemDefaultDnsResolver.java:) ~[httpclient-4.5..jar:4.5.]
at org.apache.http.impl.conn.DefaultClientConnectionOperator.resolveHostname(DefaultClientConnectionOperator.java:) ~[httpclient-4.5..jar:4.5.]
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:) ~[httpclient-4.5..jar:4.5.]
at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:) ~[httpclient-4.5..jar:4.5.]
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:) ~[httpclient-4.5..jar:4.5.]
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:) ~[httpclient-4.5..jar:4.5.]
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:) ~[httpclient-4.5..jar:4.5.]
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:) ~[httpclient-4.5..jar:4.5.]
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:) ~[httpclient-4.5..jar:4.5.]
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:) ~[httpclient-4.5..jar:4.5.]
at org.springframework.cloud.netflix.hystrix.dashboard.HystrixDashboardConfiguration$ProxyStreamServlet.doGet(HystrixDashboardConfiguration.java:) ~[spring-cloud-netflix-hystrix-dashboard-2.1..RELEASE.jar:2.1..RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:) [tomcat-embed-core-9.0..jar:9.0.]

点击mointor

springcloud系列九 整合Hystrix Dashboard的更多相关文章

  1. springcloud系列10 整合Hystrix遇到的坑:

    首先配置类: @Bean public ServletRegistrationBean getServlet(){ HystrixMetricsStreamServlet streamServlet ...

  2. springcloud系列八 整合Hystrix

    feign本身是支持Hystrix的,所以不需要引入其他依赖: 我们可以看看feign这个项目的依赖,就是引入这个依赖的pom.xml 要想看这个很简单,点击那个依赖进去就可以了 点进去就可以看到 & ...

  3. 微服务SpringCloud之熔断监控Hystrix Dashboard和Turbine

    Hystrix-dashboard是一款针对Hystrix进行实时监控的工具,通过Hystrix Dashboard我们可以在直观地看到各Hystrix Command的请求响应时间, 请求成功率等数 ...

  4. SpringCloud系列七:Hystrix 熔断机制(Hystrix基本配置、服务降级、HystrixDashboard服务监控、Turbine聚合监控)

    1.概念:Hystrix 熔断机制 2.具体内容 所谓的熔断机制和日常生活中见到电路保险丝是非常相似的,当出现了问题之后,保险丝会自动烧断,以保护我们的电器, 那么如果换到了程序之中呢? 当现在服务的 ...

  5. SpringCloud断路器监控面板——Hystrix Dashboard

    一.简介 Hystrix Dashboard是Hystrix的一个组件,Hystrix Dashboard提供一个断路器的监控面板,可以使我们更好的监控服务和集群的状态,仅仅使用Hystrix Das ...

  6. SpringCloud系列九:SpringCloudConfig 基础配置(SpringCloudConfig 的基本概念、配置 SpringCloudConfig 服务端、抓取配置文件信息、客户端使用 SpringCloudConfig 进行配置、单仓库目录匹配、应用仓库自动选择、仓库匹配模式)

    1.概念:SpringCloudConfig 基础配置 2.具体内容 通过名词就可以发现,SpringCloudConfig 核心作用一定就在于进行配置文件的管理上.也就是说为了更好的进行所有微服务的 ...

  7. SpringCloud系列十七:Hystrix的监控

    1. 回顾 上文讲解了使用Hystrix为Feign添加回退,并通过Fallback Factory检查回退原因以及如何为Feign客户端禁用Hystrix. 2. Hystrix的监控 除实现容错外 ...

  8. springcloud系列七 整合slueth,zipkin 分布式链路调用系统:

    首先在代码里面引入依赖: <dependency> <groupId>org.springframework.cloud</groupId> <artifac ...

  9. springcloud系列六 整合security

    一 Eureka注册中心认证: Eureka自带了一个管理界面,如果不加密,所有人都可以进行访问这个地址,这样安全问题就来了,所以需要对其进行加密认证: 那么该如何进行整合呢: 1 在注册中心模块添加 ...

随机推荐

  1. 管理linked break-off snapshot

    1. 建立linked break-off snapshot   (1) 建立原卷 #> vxassist -g APS2_AFC_DG make vol1 4096000 #> vxpr ...

  2. Navicat for Oracle中如何使用外键

    转自:https://blog.csdn.net/weixin_39183543/article/details/80555104 1. 外键名最后保存的时候自动生成: 2. 参考模式自动生成: 3. ...

  3. C++知识点总结(5)

    1.为何静态成员函数不能调用非静态成员函数 静态成员函数可以不需要类的实例就直接使用,非静态的成员函数很可能用到一些成员变量,而成员变量的创建和初始化是在创建了类的实例时在构造函数调用的时候才进行的. ...

  4. FOUC

    如果使用import方法对CSS进行导入,会导致某些页面在Windows 下的Internet Explorer出现一些奇怪的现象:以无样式显示页面内容的瞬间闪烁,这种现象称之为文档样式短暂失效(Fl ...

  5. PHP自定义函数获取汉字首字母的方法

    使用场景:城市列表等根据首字母排序的场景 function getFirstCharter($str) { if (empty($str)) { return ''; } $fchar = ord($ ...

  6. 第3章 ZooKeeper基本数据模型 3-1 zk数据模型介绍

    基本数据模型是zookeeper的重点. 它是参照Linux/Unix的目录结构. 子节点就相当于是父目录下的一个子目录,在zookeeper里面它是称之为节点,父节点和子节点,然后每一个节点就会有一 ...

  7. Swing简介

    ---------------siwuxie095                         Swing 简介:     Java Swing 是 Java Foundation Classes ...

  8. CentOS7:ifconfig command not found解决和netstat -an

    没有 ifconfig 和netstat -an 的话安装 net-tools package yum install net-tools

  9. JAVA语法规则总结

    单继承多实现 抽象类  抽象方法 使用关键字:abstract修饰的方法就是抽象方法; 抽象方法的形式:只有方法的声明,没有方法体; 抽象方法一般存在于父类中,相当于强制要求子类必须重写该方法,相当于 ...

  10. IDEA java 代码格式化统一

    Intellij idea 安装格式化插件 ECLIPSE CODE FORMATTER:1,安装插件:网络安装:选择Setting =>Plugins=>Browse repositor ...