Zuul com.netflix.zuul.exception.ZuulException: Forwarding error,簡單點,說話的方式簡單點~

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]

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章