SpringCloud_Monitor Dear 丶 2021-10-06 03:22 353阅读 0赞 ### SpringCloud\_Monitor ### * 依赖pom.xml * 配置文件bootstrap.yml * 配置源码 # 依赖pom.xml # <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.pingruan</groupId> <artifactId>vander-framework-parent</artifactId> <version>0.0.1-SNAPSHOT</version> </parent> <groupId>org.pingruan.springboot</groupId> <artifactId>vander-monitor-center</artifactId> <name>hystrix熔断监控</name> <description>微服务之间hystrix远程调用监控系统</description> <dependencies> <!-- 服务监控 --> <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-dashboard</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> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> </dependency> </dependencies> </project> # 配置文件bootstrap.yml # server: port: 9005 spring: application: name: vander-monitor-center #--------------turbine聚合-------------- turbine: aggregator: clusterConfig: default # 指定聚合哪些集群 appConfig: VANDER-CLIENT-DEMO-A,VANDER-CLIENT-DEMO # 指定哪些服务 ,多个用逗号隔开 clusterNameExpression: "'default'" #------------注册中心配置------------------ eureka: client: registerWithEureka: true #服务注册开关 fetchRegistry: true #服务发现开关 serviceUrl: #Eureka客户端与Eureka服务端进行交互的地址,多个中间用逗号分隔 defaultZone: ${EUREKA_SERVERS:http://root:qwe123@server1:9001/eureka/} instance: prefer-ip-address: true #将自己的ip地址注册到Eureka服务中 ip-address: ${IP_ADDRESS:127.0.0.1} instance-id: ${spring.application.name}:${server.port} #指定实例id # 配置源码 # //<dependency> //<groupId>org.springframework.cloud</groupId> //<artifactId>spring-cloud-starter-netflix-hystrix</artifactId> //</dependency> //@EnableHystrix //监控远程服务的熔断器情况 /** * http://127.0.0.1:8101/hystrix * 输入框:输入需要使用远程调用(feign)服务地址/hystrix.stream * * @author vander * */ @EnableTurbine @EnableHystrixDashboard // 监控远程服务的熔断器情况 @EnableDiscoveryClient @SpringBootApplication public class SpringBootMonitorCenter { public static void main(String[] args) { SpringApplication.run(SpringBootMonitorCenter.class, args); } }
还没有评论,来说两句吧...