Spring Cloud构建微服务架构-Hystrix监控面板

在Spring Cloud中构建一个Hystrix Dashboard非常简单,只需要下面四步:愿意了解源码的朋友直接求求交流分享技术 一零三八七七四六二六

创建一个标准的Spring Boot工程,命名为:hystrix-dashboard。 编辑pom.xml,具体依赖内容如下:

<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-parent</artifactId>
<version>Dalston.SR1</version>
<relativePath />
</parent>
<dependencies>
<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>
</dependencies>
复制代码

为应用主类加上@EnableHystrixDashboard,启用Hystrix Dashboard功能。


@EnableHystrixDashboard
@SpringCloudApplication
public class HystrixDashboardApplication {
public static void main(String[] args) {
SpringApplication.run(HystrixDashboardApplication.class, args);
}
}
复制代码

根据实际情况修改application.properties配置文件,比如:选择一个未被占用的端口等,此步非必须。

spring.application.name=hystrix-dashboard
server.port=1301
复制代码

既然Hystrix Dashboard监控单实例节点需要通过访问实例的/hystrix.stream接口来实现,自然我们需要为服务实例添加这个端点,而添加该功能的步骤也同样简单,只需要下面两步:

在服务实例pom.xml中的dependencies节点中新增spring-boot-starter-actuator监控模块以开启监控相关的端点,并确保已经引入断路器的依赖spring-cloud-starter-hystrix:

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-hystrix</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
复制代码

确保在服务实例的主类中已经使用@EnableCircuitBreaker或@EnableHystrix注解,开启了断路器功能。完整项目源码

转载于:https://juejin.im/post/5c67b30af265da2dbc597a5b

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/388272.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Google 地图 API 参考

杨航收集技术资料&#xff0c;分享给大家 Google 地图 API 参考 Google 地图 API 现在与 Google AJAX API 载入器集成&#xff0c;后者创建了一个公共命名空间&#xff0c;以便载入和使用多个 Google AJAX API。该框架可让您将可选 google.maps.* 命名空间用于当前在 Google …

spotify歌曲下载_使用Spotify数据预测哪些“ Novidades da semana”歌曲会成为热门歌曲

spotify歌曲下载TL; DR (TL;DR) Spotify is my favorite digital music service and I’m very passionate about the potential to extract meaningful insights from data. Therefore, I decided to do this article to consolidate my knowledge of some classification mod…

Hook技术之Hook Activity

一、Hook技术概述 Hook技术的核心实际上是动态分析技术&#xff0c;动态分析是指在程序运行时对程序进行调试的技术。众所周知&#xff0c;Android系统的代码和回调是按照一定的顺序执行的&#xff0c;这里举一个简单的例子&#xff0c;如图所示。 对象A调用类对象B&#xff0c…

(第三周)周报

此作业要求https://edu.cnblogs.com/campus/nenu/2018fall/homework/2143 1.本周PSP 总计&#xff1a;1422 min 2.本周进度条 (1)代码累积折线图 (2)博文字数累积折线图 4.PSP饼状图 转载于:https://www.cnblogs.com/gongylx/p/9761852.html

功能测试代码python_如何使您的Python代码更具功能性

功能测试代码pythonFunctional programming has been getting more and more popular in recent years. Not only is it perfectly suited for tasks like data analysis and machine learning. It’s also a powerful way to make code easier to test and maintain.近年来&am…

layou split 属性

layou split&#xff1a;true - 显示侧分栏 转载于:https://www.cnblogs.com/jasonlai2016/p/9764450.html

BZOJ4503:两个串(bitset)

Description 兔子们在玩两个串的游戏。给定两个字符串S和T&#xff0c;兔子们想知道T在S中出现了几次&#xff0c;分别在哪些位置出现。注意T中可能有“?”字符&#xff0c;这个字符可以匹配任何字符。Input 两行两个字符串&#xff0c;分别代表S和TOutput 第一行一个正整数k&…

C#Word转Html的类

C#Word转Html的类/**//******************************************************************** created: 2007/11/02 created: 2:11:2007 23:13 filename: D:C#程序练习WordToChmWordToHtml.cs file path: D:C#程序练习WordToChm file bas…

分库分表的几种常见形式以及可能遇到的难题

前言 在谈论数据库架构和数据库优化的时候&#xff0c;我们经常会听到“分库分表”、“分片”、“Sharding”…这样的关键词。让人感到高兴的是&#xff0c;这些朋友所服务的公司业务量正在&#xff08;或者即将面临&#xff09;高速增长&#xff0c;技术方面也面临着一些挑战。…

iOS 钥匙串的基本使用

级别&#xff1a; ★☆☆☆☆ 标签&#xff1a;「钥匙串」「keychain」「iOS」 作者&#xff1a; WYW 审校&#xff1a; QiShare团队 前言 &#xff1a; 项目中有时会需要存储敏感信息&#xff08;如密码、密钥等&#xff09;&#xff0c;苹果官方提供了一种存储机制--钥匙串&a…

线性回归和将线拟合到数据

Linear Regression is the Supervised Machine Learning Algorithm that predicts continuous value outputs. In Linear Regression we generally follow three steps to predict the output.线性回归是一种监督机器学习算法&#xff0c;可预测连续值输出。 在线性回归中&…

Spring Boot MyBatis配置多种数据库

mybatis-config.xml是支持配置多种数据库的&#xff0c;本文将介绍在Spring Boot中使用配置类来配置。 1. 配置application.yml # mybatis配置 mybatis:check-config-location: falsetype-aliases-package: ${base.package}.modelconfiguration:map-underscore-to-camel-case: …

小米盒子4 拆解图解_我希望当我开始学习R时会得到的盒子图解指南

小米盒子4 拆解图解Customizing a graph to transform it into a beautiful figure in R isn’t alchemy. Nonetheless, it took me a lot of time (and frustration) to figure out how to make these plots informative and publication-quality. Rather than hoarding this …

组态王仿真随机数

1、新建IO设备&#xff0c;选择PLC---亚控---仿真PLC&#xff0c;一直“下一步”。 2、在“数据词典”中新建变量“Tag1”&#xff0c;双击Tag1&#xff0c;变量类型选&#xff1a;I/O实数&#xff1b;初始值设为&#xff1a;0.6&#xff1b;最小值设为&#xff1a;0.5&#xf…

蓝牙一段一段_不用担心,它在那里存在了一段时间

蓝牙一段一段You’re sitting in a classroom. You look around and see your friends writing something down. It seems they are taking the exam, and they know all the answers (even Johnny who, how to say it… wasn’t the brilliant one). You realize that your ex…

Linux基础命令---ifup、ifdown

ifupifup指令用来启动网络接口设备&#xff0c;设备必须是定义在“/etc/sysconfig/network-scripts/ifcfg-ethX”或者“/etc/sysconfig/network”的文件。这些脚本通常使用一个参数&#xff1a;配置的名称(例如eth0)。在引导序列中&#xff0c;使用“boot”的第二个参数调用它们…

OllyDBG 入门之四--破解常用断点设

OllyDBG 入门之四--破解常用断点&#xff08;转&#xff09; 软件汉化2010-07-08 16:25:23 阅读76评论0 字号&#xff1a;大中小 订阅 bpx hmemcpy 破解万能断点&#xff0c;拦截内存拷贝动作 bpx Lockmytask 当你用其它断点都无效时可以试一下&#xff0c;这个断点拦截…

POJ1204 Word Puzzles

传送门 这题果然是AC自动机的大好题&#xff01; 题目的大意是&#xff0c;给定一个l*c的大网格&#xff0c;每个格子里有一个字符&#xff0c;每个格子可以向八个方向形成字符串&#xff0c;问给定的字符串在哪里能被匹配以及在网格中出现的方向&#xff08;A代表北&#xff0…

普通话测试系统_普通话

普通话测试系统Traduzido/adaptado do original por Vincius Barqueiro a partir do texto original “Writing Alt Text for Data Visualization”, escrito por Amy Cesal e publicado no blog Nightingale.Traduzido / adaptado由 VinciusBarqueiro 提供原始 文本“为数据可…

Mac OS 被XCode搞到无法正常开机怎么办?

Mac OS 被XCode搞到无法正常开机怎么办&#xff1f; 第一天拿到这台air的时候&#xff0c;迫不及待地把从别处搜集来的XCode 3.2.5iOS SDK 4.1的dmg安装了上来&#xff0c;结果系统直接崩溃&#xff0c;再开机就不能正常开机&#xff0c;总是碰到kernel panic。这不坑爹吗…… …