Spring Cloud中如何断路器聚合监控

技术Spring Cloud中如何断路器聚合监控Spring Cloud中如何断路器聚合监控,很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所收获。一

春云中如何断路器聚合监控,很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所收获。

一、准备工作

把以前的项目服务feign进行同样的改造。

二、新建专家项目服务涡轮

1、新建pom.xml

项目xmlns=' http://aven。阿帕奇。org/POM/4。0 .0 ' xmlns : xsi=' http://www。w3。org/2001/XMLSchema-instance '

xsi :架构位置=' http://aven。阿帕奇。org/POM/4。0 .0http://aven。阿帕奇。org/xsd/maven-4。0 .0 .xsd '

模型版本4 .0 .0/模型版本

groupIdwg/groupId

artifactIdservice _涡轮机/artifactId

版本0 .0 .1-快照/版本

包装罐/包装

名称服务_涡轮机/名称

urlhttp://maven.apache.org/url

性能

项目。建造。sourceencodingutf-8/项目。建造。源编码

项目。报道。outputen coding TF-8/项目。报道。输出编码

spring-cloud.versionGreenwich.RELEASE/spring-cloud.version

java.version1.8/java.version

/properties

父母

groupIdorg.springframework.boot/groupId

artifactId弹簧-启动-启动-父/artifactId

version2.1.1.RELEASE/version

relativePath/!- lookupparentfromrepository -

/家长

属国

属国

groupIdorg.springframework.boot/groupId

人工智能弹簧-启动-启动器-致动器/人工智能

/依赖性

属国

groupIdorg.springframework.cloud/groupId

artifactIdspring-cloud-starter-网飞-子宫/人造物品

Id>
</dependency>
<dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId>
    </dependency>
   <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-netflix-eureka-client</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-openfeign</artifactId>
    </dependency>
     <dependency>
         <groupId>org.springframework.cloud</groupId>
         <artifactId>spring-cloud-starter-netflix-turbine</artifactId>
     </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-dependencies</artifactId>
        <version>${spring-cloud.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
</project>

2、新建ServiceTurbineApplication.java

package wg;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.hystrix.EnableHystrix;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
import org.springframework.cloud.netflix.turbine.EnableTurbine;
import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication
@EnableEurekaClient
@EnableDiscoveryClient
@EnableFeignClients
@EnableHystrix
@EnableHystrixDashboard
@EnableCircuitBreaker
@EnableTurbine
public class ServiceTurbineApplication {
	public static void main(String[] args) {
        SpringApplication.run( ServiceTurbineApplication.class, args );
    }
}

3、新建application.yml

server:
  port: 8767
spring:
  application:
    name: service-turbine
eureka:
  client:
    serviceUrl:
      defaultZone: http://localhost1:8761/eureka/,http://localhost2:8861/eureka/
management:
  endpoints:
    web:
      exposure:
        include: "*"
      cors:
        allowed-origins: "*"
        allowed-methods: "*"
turbine:
  app-config: service-feign,service-ribbon
  aggregator:
    clusterConfig: default
  clusterNameExpression: new String("default")
  combine-host: true
  instanceUrlSuffix:
    default: actuator/hystrix.stream

4、启动项目,访问:http://localhost:8767/turbine.stream

Spring Cloud中如何断路器聚合监控

5、访问:http://localhost:8764/hystrix ,填写内容

Spring Cloud中如何断路器聚合监控

6、点击监控,然后访问:http://localhost:8765/hello,http://localhost:8764/hello

Spring Cloud中如何断路器聚合监控

看完上述内容是否对您有帮助呢?如果还想对相关知识有进一步的了解或阅读更多相关文章,请关注行业资讯频道,感谢您对的支持。

内容来源网络,如有侵权,联系删除,本文地址:https://www.230890.com/zhan/51143.html

(0)

相关推荐

  • 0337-打家劫舍III

    技术0337-打家劫舍III 0337-打家劫舍III在上次打劫完一条街道之后和一圈房屋后,小偷又发现了一个新的可行窃的地区。这个地区只有一个入口,我们称之为“根”。 除了“根”之外,每栋房子有且只有一

    礼包 2021年12月3日
  • Python中如何实现数据库操作

    技术Python中如何实现数据库操作这篇文章主要为大家展示了“Python中如何实现数据库操作”,内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下“Python中如何实现数据库操作”

    攻略 2021年10月28日
  • 怎样深入学习JVM堆与JVM栈

    技术怎样深入学习JVM堆与JVM栈今天就跟大家聊聊有关怎样深入学习JVM堆与JVM栈,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。JVM栈解决程序的运行问题,即程

    攻略 2021年10月23日
  • 40种聚会小游戏,聚会适合两人一组玩的小游戏

    技术40种聚会小游戏,聚会适合两人一组玩的小游戏快乐大本营的,谁是卧底40种聚会小游戏!还有考验默契的,一个人画一个人猜,or一个人看词比动作,然后不说话的那种,叫别人猜是什么
    瞎子背瘸子
    目的:沟通配合能力,活跃气氛

    生活 2021年10月31日
  • 清除ehcache缓存方法(ehcache分布式缓存怎么清除)

    技术如何使用@CacheEvict清除指定下所有缓存这篇文章将为大家详细讲解有关如何使用@CacheEvict清除指定下所有缓存,文章内容质量较高,因此小编分享给大家做个参考,希望大家阅读完这篇文章后对相关知识有一定的了

    攻略 2021年12月25日
  • python光学仿真面向对象光学元件类的实现是什么

    技术python光学仿真面向对象光学元件类的实现是什么python光学仿真面向对象光学元件类的实现是什么,很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能

    攻略 2021年10月20日