我正在使用docker-compose容器部署3个项目:Eureka,Zuul Service和应用程序。
以下是这些项目的配置:
Eureka :
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}
当我在做docker-compose时,它正在正确地旋转容器,没有错误。
但是,当我使用API网关调用REST端点时,出现错误:com.netflix.zuul.exception.ZuulException:转发错误
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]
最佳答案
问题出在我的用户服务应用属性中:
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
关于docker - 通过Docker运行时,Eureka ZUUL “Forwarding error”,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/49405291/