springCloud -31 Hystrix Dashboard可视化监控数据

上篇文章我们使用actuator 来监控了系统数据,但是并不详细,需要一个可视化系统,我们可以使用hystrix dashboard 。

一,在服务消费者引入依赖

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

二,在启动类上加入EnableHystrixDashboard注解

package com.zjk.feignHystrix;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
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;

@SpringBootApplication
@EntityScan("com.zjk.feignHystrix.entity")
@EnableEurekaClient
//通过@EnableFeignClients 激活feign
@EnableFeignClients
//激活hystrix
@EnableCircuitBreaker
@EnableHystrixDashboard
public class OrdFeignHystrixApplication {

    @Bean
    @LoadBalanced
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }

    public static void main(String[] args) {
        SpringApplication.run(OrdFeignHystrixApplication.class,args);
    }
}

三,重启访问

http://ip:端口/hystrix

springCloud -31 Hystrix Dashboard可视化监控数据

 

输入我们acturtor 的地址http://localhost:9013/actuator/hystrix.stream 后,就可以看到下面的页面

springCloud -31 Hystrix Dashboard可视化监控数据

 

上一篇:Python IPy模块常用方法


下一篇:python基础语法看一篇就够了,全网最全python语法笔记汇总