当前位置:网站首页>Solve the problem of unable to connect to command metric stream and related problems in the hystrix dashboard
Solve the problem of unable to connect to command metric stream and related problems in the hystrix dashboard
2022-06-30 18:04:00 【Cunning foxes】
solve hystrix dashboard Error reported in Unable to connect to Command Metric Stream And related questions
In practice spring cloud hystrix dashboard when , Summarize the three problems encountered .
Premise :
On the provider client ( The port number is 8001) Be dependent :
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
On the consumer client ( The port number is 9001) Be dependent :
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId>
</dependency>
1. visit http://localhost:8001/actuator/hystrix.stream, Page blank .
The situation is as follows :
The problem is solved : We will add... In the main startup class of the provider client ServletRegistrationBean Component can solve the problem of blank pages .
@Bean
public ServletRegistrationBean hystrixMetricsStreamServlet(){
ServletRegistrationBean registrationBean = new ServletRegistrationBean(new HystrixMetricsStreamServlet());
registrationBean.addUrlMappings("/actuator/hystrix.stream");
return registrationBean;
}
2. visit http://localhost:8001/actuator/hystrix.stream, Page always ping.
The situation is as follows :
The problem is solved : First, we need to add a circuit breaker mechanism to the control class of the provider client
@RestController
public class DeptController {
@Autowired
private DeptService deptService;
@RequestMapping(value = "/dept/get/{id}", method = RequestMethod.GET)
@HystrixCommand(fallbackMethod = "processHystrix_Get")
public Dept get(@PathVariable("id") Long id) {
Dept dept = deptService.get(id);
if (dept == null) {
throw new RuntimeException(" The ID: " + id + " There is no corresponding information ");
}
return dept;
}
public Dept processHystrix_Get(@PathVariable("id") Long id) {
return new Dept().setDeptno(id)
.setDname(" The ID: " + id + " There is no corresponding information ,[email protected]")
.setDb_source("no this database in MySQL");
}
}
Secondly, add a pair in the main startup class of the provider client Hystrix The support of fuse mechanism
@EnableCircuitBreaker
restart eureka、 Provider client and consumer client services , Finally, request the method in the control class several times before accessing http://localhost:8001/actuator/hystrix.stream, will ping Produce results , as follows :
3. The graphical interface of fuse monitoring reports an error Unable to connect to Command Metric Stream
The situation is as follows :
Problem solving : On the consumer client yml Add the following code to the file to solve
hystrix:
dashboard:
proxy-stream-allow-list: "*"
restart eureka、 Provider client and consumer client services , After sending several requests, refresh the graphic page of fuse monitoring , The final results are as follows :
边栏推荐
- Lenovo's "dual platform" operation and maintenance solution helps to comprehensively improve the intelligent management ability of the intelligent medical industry
- Generate confrontation network, from dcgan to stylegan, pixel2pixel, face generation and image translation.
- Acwing game 57
- Building a basic buildreoot file system
- Redis (IV) - delete policy
- K-line diagram interpretation and practical application skills (see position entry)
- Course design for the end of the semester: product sales management system based on SSM
- Six photos vous montrent pourquoi TCP serre la main trois fois?
- 广电5G正式启航,黄金频段将如何应用引关注
- 2022上半年盘点:20+主流数据库重大更新及技术要点汇总
猜你喜欢

Development: how to install offline MySQL in Linux system?

Simulation of campus network design based on ENSP

Hyper-V: enable SR-IOV in virtual network

ABAP-发布Restful服务

New skill: accelerate node through code cache JS startup

Tubes响应性数据系统的设计与原理

Animesr: learnable degradation operator and new real world animation VSR dataset

China Infrastructure Development Association: electronic contract is recommended

Plane intersection and plane equation

Mo Tianlun salon | Tsinghua qiaojialin: Apache iotdb, originated from Tsinghua, is building an open source ecological road
随机推荐
【剑指Offer】52. 两个链表的第一个公共节点
Add code block in word (Reprint)
Word中添加代码块(转载)
TFTP下载kernel,nfs挂载文件系统
Splitting. JS text title slow loading JS effect
Parker variable displacement piston pump pv092r1k1t1nmmc
Shortcut keys for the rainbow brackets plug-in
Generate confrontation network, from dcgan to stylegan, pixel2pixel, face generation and image translation.
Tencent cloud installs MySQL database
A tough battle for Tencent cloud
元宇宙带来的游戏变革会是怎样的?
MSF后渗透总结
网络:服务器网卡组技术原理与实践
Redis (V) - advanced data types
Plane intersection and plane equation
Animesr: learnable degradation operator and new real world animation VSR dataset
MySQL之零碎知识点
Exch:修复丢失的系统邮箱
Compile and generate busybox file system
Cloud practice of key business migration of Internet of things by well-known Internet housing rental service companies