目标
1、Hystrix集群及监控turbine
2、Feign、Hystrix整合之服务熔断服务降级彻底解耦
3、集群后超时设置
Hystrix集群及监控turbine
前面Dashboard演示的仅仅是单机服务监控,实际项目基本都是集群,所以这里集群监控用的是turbine。
turbine是基于Dashboard的。
先搞个集群;
再microservice-student-provider-hystrix-1004项目的基础上再搞一个microservice-student-provider-hystrix-1005
代码和配置都复制一份,然后修改几个地方;
1、yml配置
---
server:
port: 1004
context-path: /
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3306/T226?useUnicode=true&characterEncoding=utf8
username: root
password: 123
jpa:
hibernate:
ddl-auto: update
show-sql: true
application:
name: microservice-student
profiles: provider-hystrix-1004
eureka:
instance:
hostname: localhost
appname: microservice-student
instance-id: microservice-student:1004
prefer-ip-address: true
client:
service-url:
defaultZone: http://eureka2001.xieminglu.com:2001/eureka/,http://eureka2002.xieminglu.com:2002/eureka/,http://eureka2003.xieminglu.com:2003/eureka/
info:
groupId: com.xieminglu.testmicroservice
artifactId: microservice-student-provider-hystrix-1004
version: 1.0-SNAPSHOT
userName: http://xieminglu.com
phone: 123456
hystrix:
command:
default:
execution:
isolation:
thread:
timeoutInMilliseconds: 1500
---
server:
port: 1005
context-path: /
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3306/T226?useUnicode=true&characterEncoding=utf8
username: root
password: 123
jpa:
hibernate:
ddl-auto: update
show-sql: true
application:
name: microservice-student
profiles: provider-hystrix-1005
eureka:
instance:
hostname: localhost
appname: microservice-student
instance-id: microservice-student:1005
prefer-ip-address: true
client:
service-url:
defaultZone: http://eureka2001.xieminglu.com:2001/eureka/,http://eureka2002.xieminglu.com:2002/eureka/,http://eureka2003.xieminglu.com:2003/eureka/
info:
groupId: com.xieminglu.testmicroservice
artifactId: microservice-student-provider-hystrix-1005
version: 1.0-SNAPSHOT
userName: http://xieminglu.com
phone: 123456
hystrix:
command:
default:
execution:
isolation:
thread:
timeoutInMilliseconds: 1500
---
server:
port: 1006
context-path: /
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3306/T226?useUnicode=true&characterEncoding=utf8
username: root
password: 123
jpa:
hibernate:
ddl-auto: