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

  • 相关阅读:
    centos7以yum方式安装zabbix-agent客户端服务
    centos7搭建nexus maven私服
    pyinstaller打包python项目为windows运行exe程序
    nginx 查看安装的模块以及安装新模块
    securecrt终端显示乱码问题
    利用Anemometer做mysql慢日志的查询与可视化
    centos7安装kubernetes1.18.5
    k8s执行kubectl相关命令报错:Unable to connect to the server: x509
    postman接口测试10_导入curl请求接口
    app测试04_app性能测试之perfdog
  • 原文地址:https://www.cnblogs.com/maohuidong/p/9881137.html
Copyright © 2011-2022 走看看