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

  • 相关阅读:
    [Objective-C语言教程]决策结构(10)
    [Objective-C语言教程]循环语句(9)
    [Objective-C语言教程]关系运算符(8)
    [Objective-C语言教程]常量(7)
    [Objective-C语言教程]变量(6)
    [Objective-C语言教程]数据类型(5)
    转 Apache Ant 实现自动化部署
    转 智能化运维最佳实践-自动化
    ANT 操控 ORACLE数据库实践
    转: Ant 脚本的结构化设计
  • 原文地址:https://www.cnblogs.com/maohuidong/p/9881137.html
Copyright © 2011-2022 走看看