Spring Boot Admin学习之路3-Hystrix监控

先来看需要哪些包,下面是我的pom依赖的包,这个功能只要前两个依赖就行

<dependencies>
		<dependency>
			<groupId>org.springframework.cloud</groupId>
			<artifactId>spring-cloud-starter-turbine</artifactId>
		</dependency>

		<dependency>
			<groupId>de.codecentric</groupId>
			<artifactId>spring-boot-admin-server-ui-turbine</artifactId>
			<version>1.5.3</version>
		</dependency>

		<dependency>
			<groupId>de.codecentric</groupId>
			<artifactId>spring-boot-admin-server-ui</artifactId>
			<version>1.5.3</version>
		</dependency>

		<dependency>
			<groupId>de.codecentric</groupId>
			<artifactId>spring-boot-admin-server-ui-activiti</artifactId>
			<version>1.5.3</version>
		</dependency>

		<dependency>
			<groupId>de.codecentric</groupId>
			<artifactId>spring-boot-admin-server-ui-login</artifactId>
			<version>1.5.3</version>
		</dependency>

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

		<dependency>
			<groupId>de.codecentric</groupId>
			<artifactId>spring-boot-admin-server</artifactId>
			<version>1.5.3</version>
		</dependency>

		<dependency>
			<groupId>de.codecentric</groupId>
			<artifactId>spring-boot-admin-starter-client</artifactId>
			<version>1.5.3</version>
		</dependency>
	</dependencies>

下面是我的配置,增加endpoints接口:hystrix.stream和turbine.stream,turbine.location所属应用(就是用admin本身),其中turbine.app-config需要配置监控的服务名称

spring:
  application:
    name: boot-admin
  boot:
    admin:
      routes:
        endpoints: env,metrics,dump,jolokia,info,configprops,trace,logfile,refresh,flyway,liquibase,heapdump,loggers,auditevents,hystrix.stream,turbine.stream,activiti
      turbine:
        location: boot-admin
      username: "${security.user.name}"
      password: "${security.user.password}"
      client:
        metadata:
          user.name: "${security.user.name}"
          user.password: "${security.user.password}"

server:
  port: 8484

eureka:
  instance:
    instanceId: ${spring.application.name}:${server.port}
  client:
    serviceUrl:
      defaultZone: http://localhost:8761/eureka/
    healthcheck:
      enabled: true


custom.print: hello

turbine:
  cluster-name-expression: new String("default")
  app-config: book-service,api-gateway
  combine-host-port: true


management:
  security:
    enabled: false

security:
  user:
    name: user
    password: pass

开启turbine注解

@EnableTurbine

启动服务,分别能全局查看所有服务接口情况,和分别进入各服务里查看,关于怎么读懂这张图,请参考netflix公司的github:https://github.com/Netflix/Hystrix

turbine

api gateway service

book service

转载于:https://my.oschina.net/sean1989/blog/1523181

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值