springCloud(十二) hystrix dashboard
2021-05-04 19:30
标签:open one port serve href turn artifact ping board 在 浏览器 输入 http://localhost:9100/hystrix 注意:springboot2.2.x, hystrix-dashboard监控页面一直显示loading的问题 (https://blog.csdn.net/weixin_43493520/article/details/106646860?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-3.nonecase&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromBaidu-3.nonecase) springCloud(十二) hystrix dashboard 标签:open one port serve href turn artifact ping board 原文地址:https://www.cnblogs.com/guhualin/p/13194266.html被监控端
1: 在微服务上pom.xml 引入依赖
2: 在application.java 中 引入bean
package com.itlaoqi.springcloud.memberserviceopenfeign;
import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet;
import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.RandomRule;
import feign.Logger;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
@SpringBootApplication
@EnableFeignClients
public class MemberServiceOpenfeignApplication {
// 被引入的bean
@Bean
public ServletRegistrationBean hystrixServlet(){
HystrixMetricsStreamServlet servlet = new HystrixMetricsStreamServlet();
ServletRegistrationBean registrationBean = new ServletRegistrationBean(servlet);
registrationBean.addUrlMappings("/hystrix.stream");
registrationBean.setName("HystrixMetricsStreamServlet");
registrationBean.setLoadOnStartup(1);
return registrationBean;
}
public static void main(String[] args) {
SpringApplication.run(MemberServiceOpenfeignApplication.class, args);
}
}
2: 创建监控工程 dashboard 监控
1: pom.xml
2: application.yml文件
server:
port: 9100
spring:
application:
name: hystrix-dashboard
eureka:
client:
service-url:
defaultZone:
http://localhost:8761/eureka
3: 在java 类上开启
package com.itlaoqi.springcloud.hystrix.dashboard.dashboardservice;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
@SpringBootApplication
@EnableHystrixDashboard
public class DashboardServiceApplication {
public static void main(String[] args) {
SpringApplication.run(DashboardServiceApplication.class, args);
}
}
4: 开始演示
我的其他微服务 使用的是 2.3.x版本 。但是2.3.X 版本的 dashboard 前端代码有问题。所以该用2.1.x 版本的dashboard 。使用正常
下一篇:01 createJS代码作用域
文章标题:springCloud(十二) hystrix dashboard
文章链接:http://soscw.com/index.php/essay/82410.html