美文网首页
SpringCloud-hystrix-dashboard实战0

SpringCloud-hystrix-dashboard实战0

作者: 天的安排 | 来源:发表于2019-07-23 08:52 被阅读0次

服务监控

端口修改

server.port=19000

pom依赖:

<!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-netflix-hystrix-dashboard -->
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId>
    <version>2.1.2.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-netflix-hystrix -->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
            <version>2.1.2.RELEASE</version>
        </dependency>

启动类中增加#EnableHystrixDashboard注解

@SpringBootApplication(exclude= {DataSourceAutoConfiguration.class})
@EnableHystrixDashboard
public class ApplicationConsumerhystrixDashboard {
    private static Logger logger = Logger.getLogger(ApplicationConsumerhystrixDashboard.class);

    /**
     * Start
     */
    public static void main(String[] args) {
        SpringApplication.run(ApplicationConsumerhystrixDashboard.class, args);
//        logger.info("SpringBoot Start Success");
    }
}

检查服务提供者是否增加了监控依赖

<!--actuator监控信息完善-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
服务提供者中添加监控依赖

验证服务启动ok

启动eureka集群

eureka集群

启动一个服务提供者


证明服务提供者启动ok

服务提供项目启动之后访问不到http://localhost:18084/hystrix.stream,添加以下配置及bean

#application.properties中
management.endpoints.web.exposure.include="*"
#启动类中注入bean
    @Bean
    public ServletRegistrationBean hystrixMetricsStreamServlet() {
        ServletRegistrationBean registration = new ServletRegistrationBean(new HystrixMetricsStreamServlet());
        registration.addUrlMappings("/hystrix.stream");
        return registration;
    }

访问 http://localhost:18084/hystrix.stream 出现好多个ping

这个属于正常情况(只有ping,没有数据)

将这个地址添加到hystrixDashboard中,如下图:

将这个地址添加到hystrixDashboard中

点击monitor stream会出现如下展示:

这个属于正常情况

访问服务提供者接口,如下图:

再次访问 http://localhost:18084/hystrix.stream 会看到有数据出现,如下图:

我们刷新dashboard的监控页面,会看到如下图:

发现有图形,有折线图

如何看图

7色
一圈
一线

多次访问服务提供者,会发现折线图上升,绿色的实心圆不断变大

实心圆变大,折线图上升,说明接口调用在增加

实心圆的两种含义

它通过颜色的变化代表了实力的健康程度,它的健康度从绿色<黄色<橙色<红色递减,红色代表服务基本不可用了。
该实心圆除了颜色的变化之外,它的大小也会根据实例的请求流量发生变化,流量越大,该实心圆就越大。所以通过该实心圆的展示,就可以在大量实例中快速的发现故障和高压力实例

整图说明

整图说明.png

相关文章

  • SpringCloud-hystrix-dashboard实战0

    服务监控 端口修改 pom依赖: 启动类中增加#EnableHystrixDashboard注解 检查服务提供者是...

  • java开发实战1——纲要

    本人将从以下内容介绍java开发实战。 0(思想)1——纲要 0(思想)2——devops/敏捷 0(思想)3——...

  • 2021-03-14

    抖音小程序赚钱最新实战课程,0基础,实操+理论,有人已经日赚20000+ 抖音小程序赚钱最新实战课程,0基础,实操...

  • RxJS实战(0)

    开头胡扯 无意中得到这本书,犹如《葵花宝典》爱不释手,看一下几大出版社和开放社区都尚未开始翻译,于是有了这个版本。...

  • 位运算

    实战位运算要点: 判断奇偶x % 2 == 1 → x & 1 == 1x % 2 == 0 → x & 0 =...

  • 《文案堂》作品目录

    1.《实战写作》一本写作秘籍 每周一更新001【实战写作】(1)写作有多难?002【实战写作】(2)选题是门学问0...

  • 2018-10-11

    maven实战97~147 java多线程编程核心技术 0~9

  • 蓝看除4余1路01.05两个!环保五星福彩126期双色球推荐

    双色球126期推荐: 12红:02.03.09.10.12.18.21.22.25.28.32.33 实战9红:0...

  • Python建代理配合burp实现自动免费用水

    0x00 目录 0x01 前言0x02 利用fd分析与实战0x03 Python+burp简易搭建代理服务器0x0...

  • lldb

    lldb 调试实战 0x0 命令结构 其中options和argument是可选的. 0x1 常用命令 1,设置断...

网友评论

      本文标题:SpringCloud-hystrix-dashboard实战0

      本文链接:https://www.haomeiwen.com/subject/tfgdlctx.html