Hystrix bashboard监控一直报ping

Hystrix dashboard监控


pom文件
 <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-ribbon</artifactId>
            <version>1.4.7.RELEASE</version>
        </dependency>
        <!--Hystrix-->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-hystrix</artifactId>
            <version>1.4.6.RELEASE</version>
        </dependency>
        <!--监控支持 在服务端一定要添加监控的依赖-->
         <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <!--客户端添加 -->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-hystrix-dashboard</artifactId>
            <version>1.4.6.RELEASE</version>
        </dependency>

application.yml
server:
  port: 9001

客户端启动类

@SpringBootApplication
@EnableHystrixDashboard
public class DeptConsumerDashboard {
    
    
    public static void main(String[] args) {
    
    
        SpringApplication.run(DeptConsumerDashboard.class, args);
    }
}

服务端

启动类
@SpringBootApplication
@EnableEurekaClient   //在服务启动后自动注册到Eureka中
@EnableDiscoveryClient  //eureka服务发现
@EnableCircuitBreaker  //添加熔断支持
public class HystrixDeptProvider_8001 {
    
    
    public static void main(String[] args) {
    
    
        SpringApplication.run(HystrixDeptProvider_8001.class,args);
    }
    @Bean
    public ServletRegistrationBean hystrixMetricsStreamServlet() {
    
    
        ServletRegistrationBean registrationBean = new ServletRegistrationBean(new HystrixMetricsStreamServlet());
        registrationBean.addUrlMappings("/actuator/hystrix.stream");
        return registrationBean;
    }
}

在这里插入图片描述

!!!必须添加熔断支持,亲测不加就http://localhost:8001/actuator/hystrix.stream
一直显示ping无data数据,刷新请求也无;


猜你喜欢

转载自blog.csdn.net/weixin_44313584/article/details/109648743