博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
spring cloud DashBoard
阅读量:6418 次
发布时间:2019-06-23

本文共 2559 字,大约阅读时间需要 8 分钟。

1 依赖

<parent>

<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.4.RELEASE</version>
</parent>

<properties>

<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
</properties>

<dependencies>

<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId>
</dependency>

<dependency>

<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>

<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-ribbon</artifactId>
</dependency>

<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>

<dependencyManagement>

<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Camden.SR7</version>
<type>pom</type>
<scope>import</scope>
</dependency>

</dependencies>

</dependencyManagement>
</project>

 

2. 启动类

@SpringBootApplication

@EnableEurekaClient
@EnableHystrixDashboard
@EnableHystrix
@EnableCircuitBreaker
public class HystrixBoardApplication {

@Bean

@LoadBalanced
RestTemplate restTmeplate() {
return new RestTemplate();
}
public static void main(String[] args) {
SpringApplication.run(HystrixBoardApplication.class, args);
}
@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;
}
}

 

3. 配置

server:

port: 8001
spring:
application:
name: hystrix-dashboard
eureka:
client:
serviceUrl:
defaultZone: http://admin:admin@ym-eureka-server1:8761/eureka/,http://admin:admin@ym-eureka-server2:8762/eureka/,http://admin:admin@ym-eureka-server3:8763/eureka/
instance:
preferIpAddress: true
hystrix:
command:
default:
execution:
isolation:
thread:
timeoutInMilliseconds: 4000
config:
stream:
maxConcurrentConnections: 50

转载于:https://www.cnblogs.com/maohuidong/p/9881137.html

你可能感兴趣的文章
Nginx限制带宽
查看>>
All Web Application Attack Techniques
查看>>
归档日志ORA-19809: 超出了恢复文件数的限制
查看>>
精品德国软件 UltraShredder 文件粉碎机
查看>>
PANDAS 数据合并与重塑(join/merge篇)
查看>>
文件时间信息在测试中的应用
查看>>
Exception loading sessions from persistent storage (tomcat异常)
查看>>
直播疑难杂症排查(8)— 播放杂音、噪音、回声问题
查看>>
安装乌班图系统,并且演示有趣的linux命令,你还怕对linux无兴趣吗
查看>>
如何写gdb命令脚本
查看>>
Android ListView展示不同的布局
查看>>
iOS宏(自己使用,持续更新)
查看>>
手把手玩转win8开发系列课程(3)
查看>>
NGINX引入线程池 性能提升9倍
查看>>
《淘宝技术这十年》读书笔记 (四). 分布式时代和中间件
查看>>
linux下mongodb定时备份指定的集合
查看>>
oVirt JBAS server start failed, ajp proxy cann't server correct. ovirt-engine URL cann't open
查看>>
CDP WebConsole上线公告
查看>>
ubuntu下安装摄像头应用程序xawtv
查看>>
PostgreSQL 如何比较两个表的定义是否一致
查看>>