zoukankan      html  css  js  c++  java
  • spring cloud DashBoard

    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

  • 相关阅读:
    C# Split 分割字符串
    vim 编辑器命令
    不靠谱的FLOAT数据类型
    linux系统常用命令
    PHP运算方法
    PHP数据类型
    Centos7 系统在安装时指定使用老式网卡命名方式
    PHP代码编写
    PHP变量介绍
    PHP语言介绍
  • 原文地址:https://www.cnblogs.com/maohuidong/p/9881137.html
Copyright © 2011-2022 走看看