Spring Cloud构建微服务架构Hystrix监控面板
来源:互联网 发布:千寻软件下载 编辑:程序博客网 时间:2024/05/16 17:55
在Spring Cloud中构建一个Hystrix Dashboard非常简单,只需要下面四步:
- 创建一个标准的Spring Boot工程,命名为:hystrix-dashboard。
- 编辑pom.xml,具体依赖内容如下:
1234567891011121314151617181920
<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功能。
1234567
public class HystrixDashboardApplication {public static void main(String[] args) {SpringApplication.run(HystrixDashboardApplication.class, args);}}
- 根据实际情况修改
application.properties
配置文件,比如:选择一个未被占用的端口等,此步非必须。
12
spring.application.name=hystrix-dashboardserver.port=1301
既然Hystrix Dashboard监控单实例节点需要通过访问实例的/hystrix.stream
接口来实现,自然我们需要为服务实例添加这个端点,而添加该功能的步骤也同样简单,只需要下面两步:
- 在服务实例
pom.xml
中的dependencies
节点中新增spring-boot-starter-actuator
监控模块以开启监控相关的端点,并确保已经引入断路器的依赖spring-cloud-starter-hystrix
:
12345678
<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
注解,开启了断路器功能。
到这里已经完成了所有的配置,已启动对“eureka-consumer-ribbon-hystrix”的监控,点击“Monitor Stream”按钮。
从现在开始,我这边会将近期研发的springcloud微服务云架构的搭建过程和精髓记录下来,帮助更多有兴趣研发spring cloud框架的朋友,希望可以帮助更多的好学者。大家来一起探讨spring cloud架构的搭建过程及如何运用于企业项目。源码来源
阅读全文
3 0
- Spring Cloud构建微服务架构:Hystrix监控面板
- Spring Cloud构建微服务架构Hystrix监控面板
- Spring Cloud构建微服务架构Hystrix监控面板
- Spring Cloud构建微服务架构:Hystrix监控面板【Dalston版】
- Spring Cloud构建微服务架构:Hystrix监控数据聚合
- Spring Cloud构建微服务架构:Hystrix监控数据聚合【Dalston版】
- Spring Cloud构建微服务架构Hystrix依赖隔离
- Spring Cloud构建微服务架构—Hystrix断路器
- Spring Cloud构建微服务架构Hystrix依赖隔离
- Spring Cloud构建微服务架构-Hystrix服务降级
- Spring Cloud构建微服务架构-Hystrix依赖隔离
- Spring Cloud构建微服务架构-Hystrix断路器
- Spring Cloud构建微服务架构:服务容错保护(Hystrix依赖隔离)
- Spring Cloud构建微服务架构:服务容错保护(Hystrix服务降级)
- Spring Cloud构建微服务架构:服务容错保护(Hystrix依赖隔离)
- Spring Cloud构建微服务架构:服务容错保护(Hystrix服务降级)【Dalston版】
- Spring Cloud构建微服务架构:服务容错保护(Hystrix依赖隔离)【Dalston版】
- Spring Cloud构建微服务架构:服务容错保护(Hystrix断路器)【Dalston版】
- 网易2017春招编程题:读棋盘 [python]
- WINDOWS SERVER 2008 架设NTP服务器(修正)
- java_01.2
- 到底什么时候该使用MQ?
- 天猫“双11”狂欢节背后:阿里巴巴加速新技术演变
- Spring Cloud构建微服务架构Hystrix监控面板
- Spring框架中的Ioc
- 网易2017春招编程题:调整队形 [python]
- Java 9 中的 GC 调优基础
- HashMap底层详解-001-数据结构、put、get
- C语言对象化设计的实例——LCD菜单
- php中time()与$_SERVER[REQUEST_TIME]用法区别
- 前后端分离后的前端时代
- 《C语言的面向对象(面向较大型软件)》ppt分享和ppt注解