zoukankan      html  css  js  c++  java
  • hystrix 添加turbine

    1.创建turbine项目,修改pom.xml文件

            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-actuator</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
            </dependency>
    
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-starter-netflix-turbine</artifactId>
            </dependency>
    

    2.创建main函数

    package com.imooc.springcloud;
    
    import org.springframework.boot.WebApplicationType;
    import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
    import org.springframework.boot.builder.SpringApplicationBuilder;
    import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
    import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
    import org.springframework.cloud.netflix.hystrix.EnableHystrix;
    import org.springframework.cloud.netflix.turbine.EnableTurbine;
    
    @EnableDiscoveryClient
    @EnableHystrix
    @EnableCircuitBreaker
    @EnableTurbine
    @EnableAutoConfiguration
    public class TurbineApplication {
        public static void main(String[] args) {
            new SpringApplicationBuilder(TurbineApplication.class)
                    .web(WebApplicationType.SERVLET)
                    .run(args);
        }
    }
    
    

    3.添加配置

    3.1修改turbine的application.propertise
    spring.application.name=hystrix-turbine
    server.port=52000
    management.port=52001
    
    eureka.client.serviceUrl.defaultZone=http://localhost:20000/eureka/
    
    # 指定了需要监控的服务名
    turbine.app-config=hystrix-consumer
    turbine.cluster-name-expression="default"
    
    # 将端口和hostname 作为区分不同服务的条件
    turbine.combine-host-port=true
    turbine.instanceUrlSuffix.default=actuator/hystrix.stream
    turbine.aggregator.clusterConfig=default
    

    3.2 在原来用hystrix的服务中配置文件中添加下面配置

    # actuator 暴露接口
    management.security.enabled=false
    management.endpoints.web.exposure.include=*
    management.endpoint.health.show-details=always
    

    4.开启Eureka,服务提供者,服务消费者

  • 相关阅读:
    vue使用elementui合并table
    使用layui框架导出table表为excel
    vue使用elementui框架,导出table表格为excel格式
    前台传数据给后台的几种方式
    uni.app图片同比例缩放
    我的博客
    【C语言】取16进制的每一位
    SharePoint Solution 是如何部署的呢 ???
    无效的数据被用来用作更新列表项 Invalid data has been used to update the list item. The field you are trying to update may be read only.
    SharePoint 判断用户在文件夹上是否有权限的方法
  • 原文地址:https://www.cnblogs.com/hardy-wang/p/14142020.html
Copyright © 2011-2022 走看看