怎么实现Spring Cloud的断路器监控
发表于:2025-02-10 作者:千家信息网编辑
千家信息网最后更新 2025年02月10日,本篇内容介绍了"怎么实现Spring Cloud的断路器监控"的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有
千家信息网最后更新 2025年02月10日怎么实现Spring Cloud的断路器监控
本篇内容介绍了"怎么实现Spring Cloud的断路器监控"的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!
一、准备工作
启动以前的项目 erurekaserver,config-server,eurekaclient1
二、修改项目service-ribbon
1、修改ServiceRibbonApplication.java
package wg;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication;import org.springframework.boot.web.servlet.ServletRegistrationBean;import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;import org.springframework.cloud.client.discovery.EnableDiscoveryClient;import org.springframework.cloud.client.loadbalancer.LoadBalanced;import org.springframework.cloud.netflix.eureka.EnableEurekaClient;import org.springframework.cloud.netflix.hystrix.EnableHystrix;import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;import org.springframework.context.annotation.Bean;import org.springframework.web.client.RestTemplate;import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet;@SpringBootApplication@EnableEurekaClient@EnableDiscoveryClient@EnableHystrix@EnableCircuitBreaker@EnableHystrixDashboardpublic class ServiceRibbonApplication { public static void main(String[] args) { SpringApplication.run( ServiceRibbonApplication.class, args ); } @Bean @LoadBalanced RestTemplate restTemplate() { return new RestTemplate(); } @Bean public ServletRegistrationBean getServlet(){ HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet(); ServletRegistrationBean registrationBean = new ServletRegistrationBean(streamServlet); registrationBean.setLoadOnStartup(1); registrationBean.addUrlMappings("/actuator/hystrix.stream"); registrationBean.setName("HystrixMetricsStreamServlet"); return registrationBean; }}
2、修改pom.xml
4.0.0 wg service-ribbon 0.0.1-SNAPSHOT jar service-ribbon http://maven.apache.org UTF-8 UTF-8 Greenwich.RELEASE 1.8 org.springframework.boot spring-boot-starter-parent 2.1.1.RELEASE org.springframework.cloud spring-cloud-starter-zipkin org.springframework.boot spring-boot-starter-actuator org.springframework.cloud spring-cloud-starter-netflix-hystrix org.springframework.cloud spring-cloud-starter-netflix-hystrix-dashboard org.springframework.cloud spring-cloud-starter-netflix-eureka-client org.springframework.boot spring-boot-starter-web org.springframework.cloud spring-cloud-starter-netflix-ribbon junit junit test org.springframework.cloud spring-cloud-dependencies ${spring-cloud.version} pom import
3、启动项目,访问:http://localhost:8764/hello
4、访问:http://localhost:8764/hystrix
输入:
确定,留着这个页面打开状态。
5、 访问:http://localhost:8764/hello,回来查看监控页:
6、关闭 eurekaclient1 ,访问 :http://localhost:8764/hello
查看监控页面:
"怎么实现Spring Cloud的断路器监控"的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注网站,小编将为大家输出更多高质量的实用文章!
监控
项目
断路器
内容
更多
知识
页面
UTF-8
实用
学有所成
接下来
困境
实际
情况
文章
案例
状态
编带
网站
行业
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
网络安全专业从事什么专业
金山区智能化软件开发价钱
阿里网络技术服务有限公司
北京农商公社互联网科技发展
个股软件开发
服务器与管理需求分析
大流量服务器洪水攻击骗局
如何连接任子行内数据库
数据库大致结构
服务器域名怎么看
vb里面打开数据库
软件开发品牌设计
上海启约互联网科技有限公司
传奇怪物数据库祥解
网络安全 国家电网
致癌性数据库网站
网络安全话你知
数据库互相联查
网络技术院校
如何对服务器,进行远程管理
如何设计pos数据库系统
矽品科技CIM软件开发面试
网易服务器崩溃
大同机械网络安全常见问题
从网络安全谈保密
数据中心服务器厂家供应
雅娟应用软件开发工作室
网络安全等级保护四级要求
青岛头条网络技术
统信uos系统安装神舟数据库