eureka_client_provider 端。(service id 必須是spring.application.name不能是 eureka.instance.appname)
application.yml
eureka:
client:
service-url:
defaultZone: http://localhost:8000/eureka/,http://localhost:8001/eureka/
instance:
# appname: hystrix # 不可以用這個
prefer-ip-address: true
instanceId: eureka_instance_id_7002
server:
port: 7002
spring:
application:
name: hystrix # service id 必須是這個
eureka_client_Zuul 端(兩點注意事項,如下注釋寫出)
application.yml
server:
port: 6001
eureka:
client:
service-url:
defaultZone: http://localhost:8000/eureka/,http://localhost:8001/eureka/
instance:
instance-id: zuul_instance_6001
prefer-ip-address: true
spring:
application:
name: zuul_application_6001
zuul:
host:
connect-timeout-millis: 60000 # 這個必須寫
routes:
hystrix-service-1: # 這個必須寫,自定義名稱就可以
path: /hystrixservice/**
serviceId: hystrix
測試url
http://localhost:6001/hystrixservice/[加上provider端的請求url]