spring cloud hystrix dashboard 集群监控


spring cloud hystrix dashboard 集群监控

 

 

**************************

集群监控

 

同步监控:监控信息直接输出到dashboard

               

 

异步监控:监控信息发送到消息中间件,消息中间件再将监控信息输出到dashboard

               

 

 

**************************

监控的消费端

 

@FeignClient(name = "hello-provider",fallback = HelloServiceImpl.class)
public interface HelloService {

    @RequestMapping("/hello")
    String hello();

    @RequestMapping("/hello2")
    String hello2(@RequestParam("name")String name);
}

 

 

**************************

新建turbine应用

 

*****************

引入jar包

 

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-consul-discovery</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-turbine</artifactId>
            <exclusions>
                <exclusion>
                    <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
                    <groupId>org.springframework.cloud</groupId>
                </exclusion>
            </exclusions>
        </dependency>

 

*****************

application.yml

 

spring:
  application:
    name: hystrix-turbine
  cloud:
    consul:
      host: 172.18.0.20
      port: 8500

turbine:
  app-config: feign-consumer
  cluster-name-expression: new String("default")
  combine-host-port: true

说明:配置文件中指定监控的服务为feign-consumer

 

*****************

主类加注解:@EnableTurbine

 

@EnableTurbine
@SpringBootApplication
public class DemoApplication {

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

}

 

 

****************************

创建hystrix dashboard应用

 

*****************

引入jar包

 

        <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>

 

*************************

主类加注解:@EnableHystrixDashBoard

 

@SpringBootApplication
@EnableHystrixDashboard
public class DemoApplication {

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

}

 

 

****************************

集群监控界面

 

                       

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值