gpt4 book ai didi

docker - zuul, Eureka 服务器, Eureka 服务器和docker

转载 作者:行者123 更新时间:2023-12-02 19:46:13 28 4
gpt4 key购买 nike

我对Docker和微服务有疑问。因此,我创建了ZuulService,EurekaServer + EurekaService,它在没有docker的情况下也可以正常工作。
但是我正在尝试研究docker,我创建了dockerfile,使用Maven创建了jar,并创建并运行了docker-compose.yml。 (谢谢,Maven)
Eureka (Eureka)有效,但Zuul说拒绝连接:

2020-08-01 14:39:12.463  INFO 1 --- [           main] com.netflix.discovery.DiscoveryClient    : Getting all instance registry info from the eureka server
2020-08-01 14:39:12.695 ERROR 1 --- [ main] c.n.d.s.t.d.RedirectingEurekaHttpClient : Request execution error

com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused (Connection refused)
application.yml
zuul:
prefix: /api
routes:
user:
path: /cat/**
serviceId: CAT

country:
path: /country/**
serviceId: COUNTRY

about:
path: /about/**
servcieId: ABOUT


ribbon:
ConnectTimeout: 10000
ReadTimeout: 30000

hystrix:
threadpool:
default:
coreSize: 1000
maximumSize: 10000
queueSizeRejectionThreshold: -1
maxQueueSize: -1
command:
default:
execution:
isolation:
strategy: THREAD
thread:
timeoutInMilliseconds: 41000
application.properties
spring.application.name=ZuulService
server.port=8080

eureka.client.service-url.defaultZone=http://localhost:8761/eureka
eureka.instance.prefer-ip-address=true

最佳答案

因此,将zuul属性更改为

eureka.client.service-url.defaultZone=http://eureka-service:8761/eureka
并运行docker-compose.yml,等到eureka启动,然后重新启动zuul和其他服务。 Eureka (Eureka)注册了他们。

关于docker - zuul, Eureka 服务器, Eureka 服务器和docker,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63206648/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com