Eureka ZUUL通过Docker运行时“转发错误”

时间:2018-03-21 11:34:59

标签: docker netflix-zuul netflix-eureka

我正在使用docker-compose容器来部署3个项目:Eureka,Zuul服务和应用程序。 以下是这些项目的配置:

尤里卡:

eureka.client.registerWithEureka = false
eureka.client.fetchRegistry= false
eureka.client.serviceUrl.defaultZone= http://${EUREKA_HOST}:8070/eureka/
eureka.instance.hostname= ${EUREKA_HOST}

Zuul:

eureka:
  client:
    serviceUrl:
      defaultZone: http://${EUREKA_HOST}:8070/eureka/
  instance:
    hostname: ${EUREKA_HOST}

应用

eureka.client.registerWithEureka = true
eureka.client.fetchRegistry= true
eureka.client.serviceUrl.defaultZone= http://${EUREKA_HOST}:8070/eureka/
eureka.instance.hostname= ${EUREKA_HOST}

当我正在进行码头工作时,它正确地旋转容器而没有错误。 但是,当我使用API​​网关调用REST端点时,我收到错误:com.netflix.zuul.exception.ZuulException:Forwarding error

zuul-service | ]}ServerList:org.springframework.cloud.netflix.ribbon.eureka.DomainExtractingServerList@75584e66
zuul-service | 2018-03-21 11:33:31.383  WARN 1 --- [nio-8069-exec-3] o.s.c.n.z.filters.post.SendErrorFilter   : Error during filtering
zuul-service | 
zuul-service | com.netflix.zuul.exception.ZuulException: Forwarding error
zuul-service |  at org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.handleException(RibbonRoutingFilter.java:190) ~[spring-cloud-netflix-zuul-2.0.0.M5.jar!/:2.0.0.M5]
zuul-service |  at org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.forward(RibbonRoutingFilter.java:165) ~[spring-cloud-netflix-zuul-2.0.0.M5.jar!/:2.0.0.M5]
zuul-service |  at org.springframework.cloud.netflix.zuul.filters.route.RibbonRoutingFilter.run(RibbonRoutingFilter.java:112) ~[spring-cloud-netflix-zuul-2.0.0.M5.jar!/:2.0.0.M5]
zuul-service |  at com.netflix.zuul.ZuulFilter.runFilter(ZuulFilter.java:112) ~[zuul-core-1.3.0.jar!/:1.3.0]
zuul-service |  at com.netflix.zuul.FilterProcessor.processZuulFilter(FilterProcessor.java:193) ~[zuul-core-1.3.0.jar!/:1.3.0]

1 个答案:

答案 0 :(得分:1)

问题出在我的用户服务应用程序属性中:

eureka.client.registerWithEureka = true
eureka.client.fetchRegistry= true
eureka.client.serviceUrl.defaultZone= http://${EUREKA_HOST}:8070/eureka/
eureka.instance.hostname= ${EUREKA_HOST}

理想情况应该是:

eureka.client.registerWithEureka = true
eureka.client.fetchRegistry= true
eureka.client.serviceUrl.defaultZone= http://${EUREKA_HOST}:8070/eureka/
eureka.instance.hostname= user-service