6.监控面板

来源:互联网 发布:为知笔记注销不能用 编辑:程序博客网 时间:2024/06/01 10:09
hystrix面板
一、项目添加依赖
<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>
二、在启动类中添加Hystrix Dashboard支持
- @EnableHystrix
- @EnableHystrixDashboard
三.输入网址
http://localhost:4001/hystrix

hystrix-turbine集群

一、项目添加依赖
<dependency>
     <groupId>org.springframework.cloud</groupId>
     <artifactId>spring-cloud-starter-hystrix-dashboard</artifactId>
</dependency>
<dependency>
     <groupId>org.springframework.cloud</groupId>
     <artifactId>spring-cloud-netflix-turbine</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-hystrix-dashboard</artifactId>
</dependency>


applacation

@SpringBootApplication
@EnableDiscoveryClient
@EnableZuulProxy
public class GatewayApplication {

  public static void main(String[] args) {
      SpringApplication.run(GatewayApplication.class, args);
  }
}

properties

#从配置中心获取配置
spring.application.name=zuul
spring.cloud.config.discovery.enabled=true
spring.cloud.config.discovery.service-id=config-server
spring.cloud.config.failFast=true
#注册为服务
eureka.client.serviceUrl.defaultZone=http://localhost:1001/eureka/
二、在启动类中添加Hystrix Dashboard支持
@EnableTurbine

三.输入网址
http://localhost:4001/hystrix