当前位置:网站首页>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 :
边栏推荐
- Daily interview 1 question - basic interview question of blue team - emergency response (1) basic idea process of emergency response +windows intrusion screening idea
- 【架构】1366- 如何画出一张优秀的架构图
- NFT铸造交易平台开发详情
- Word中添加代码块(转载)
- 编译生成busybox文件系统
- Write the simplest small program in C language Hello World
- Redis (VI) - master-slave replication
- 自旋锁探秘
- 分布式机器学习:模型平均MA与弹性平均EASGD(PySpark)
- How can you choose to work in the county after graduation?
猜你喜欢

K-line diagram interpretation and practical application skills (see position entry)

Splitting. JS text title slow loading JS effect

Solution: STM32 failed to parse data using cjson

送受伤婴儿紧急就医,滴滴司机连闯五个红灯

基于eNSP的校园网设计的仿真模拟

Importing alicloud ECS locally to solve deployment problems

AnimeSR:可学习的降质算子与新的真实世界动漫VSR数据集

Interview shock 60: what will cause MySQL index invalidation?

China Infrastructure Development Association: electronic contract is recommended

DeFi借贷协议机制对比:Euler、Compound、Aave和Rari Capital
随机推荐
Shortcut keys for the rainbow brackets plug-in
Mo Tianlun salon | Tsinghua qiaojialin: Apache iotdb, originated from Tsinghua, is building an open source ecological road
Interview shock 60: what will cause MySQL index invalidation?
Exch:exchange server 2013 is about to end support
Distributed machine learning: model average Ma and elastic average easgd (pyspark)
Ardunio esp32 obtains real-time temperature and humidity in mqtt protocol (DH11)
[零基础学IoT Pwn] 环境搭建
[sword finger offer] 53 - I. find the number I in the sorted array
联想“双平台”运维解决方案 助力智慧医疗行业智慧管理能力全面提升
元宇宙带来的游戏变革会是怎样的?
Generate confrontation network, from dcgan to stylegan, pixel2pixel, face generation and image translation.
流批一体在京东的探索与实践
Ten thousand volumes - list sorting [01]
Is there an optimal solution to the energy consumption anxiety in the data center?
广电5G正式启航,黄金频段将如何应用引关注
China Infrastructure Development Association: electronic contract is recommended
【剑指Offer】剑指 Offer 53 - II. 0~n-1中缺失的数字
TFTP下载kernel,nfs挂载文件系统
News management system based on SSM
ABAP publish restful service