SpringCloud-Hystrix-dashBoard搭建

前言

hystrix-dashboard是对服务监控的可视化界面

1.新建dashborad工程,引入hystrix-dashborad相关依赖

<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jetty</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
        </dependency>
        <dependency>
            <groupId>com.m.spring.cloud</groupId>
            <artifactId>mservice-cloud-api</artifactId>
            <version>1.0-SNAPSHOT</version>
            <scope>compile</scope>
        </dependency>
        <!-- 将微服务provider侧注册进eureka -->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-eureka</artifactId>
        </dependency>
        <!--hystrix-->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-hystrix</artifactId>
        </dependency>
        <!--hystrix dashboard-->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-hystrix-dashboard</artifactId>
        </dependency>

2.主启动类加入注解@EnableHystrixDashboard


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

3.在要监控的服务提供端加入配置,pom文件引入依赖

注意这里是springboot的依赖

   <!--hystrix-dashboard需要监控的服务的依赖-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>

4.启动dashborad工程,访问http://localhost:9001/hystrix

在这里插入图片描述

5.访问监控页面

在输入框中输入要显示的监控服务地址页面
http://localhost:8001/hystrix.stream
localhost:80018001是服务提供方的地址
在这里插入图片描述

点击按钮
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值