Zipkin在本地运行良好,但在Docker容器中运行不好。所有微服务都在Eureka中注册良好,并且可以很好地通信。但唯一的问题是Zipkin。我收到以下错误:
org.springframework.web.client.ResourceAccessException: I/O error on POST request for "http://localhost:9411/api/v2/spans": Connect to http://localhost:9411 [localhost/127.0.0.1] failed: Connection refused
我的docker-compose. yaml如下所示:
version: '3.8'
services:
currency-exchange:
image: samankt/springboot-udemy-currency-exchange:0.0.1-SNAPSHOT
mem_limit: 512m
ports:
- '8000:8000'
networks:
- saman-network
environment:
EUREKA.CLIENT.SERVICE-URL.DEFAULTZONE: http://naming-server:8761/eureka
EUREKA.INSTANCE.PREFERIPADDRESS: true
SPRING.ZIPKIN.BASE-URL: http://zipkin-server:9411/
RABBIT_URI: amqp://guest:guest@rabbitmq:5672
SPRING_RABBITMQ_HOST: rabbitmq
SPRING_ZIPKIN_SENDER_TYPE: rabbit
depends_on:
- naming-server
- rabbitmq
api-gateway:
image: samankt/springboot-udemy-currency-api-gateway:0.0.1-snapshot
mem_limit: 512m
ports:
- '8765:8765'
networks:
- saman-network
environment:
EUREKA.CLIENT.SERVICE-URL.DEFAULTZONE: http://naming-server:8761/eureka
EUREKA.INSTANCE.PREFERIPADDRESS: true
SPRING.ZIPKIN.BASE-URL: http://zipkin-server:9411/
RABBIT_URI: amqp://guest:guest@rabbitmq:5672
SPRING_RABBITMQ_HOST: rabbitmq
SPRING_ZIPKIN_SENDER_TYPE: rabbit
depends_on:
- naming-server
- rabbitmq
currency-converter:
image: samankt/currency-conversion:0.0.1-SNAPSHOT
mem_limit: 700m
ports:
- '8100:8100'
networks:
- saman-network
environment:
EUREKA.CLIENT.SERVICE-URL.DEFAULTZONE: http://naming-server:8761/eureka
EUREKA.INSTANCE.PREFERIPADDRESS: true
SPRING.ZIPKIN.BASE-URL: http://zipkin-server:9411/
SPRING.ZIPKIN.DISCOVERYCLIENTENABLED: true
RABBIT_URI: amqp://guest:guest@rabbitmq:5672
SPRING_RABBITMQ_HOST: rabbitmq
SPRING_ZIPKIN_SENDER_TYPE: rabbit
depends_on:
- naming-server
- rabbitmq
naming-server:
image: samankt/naming-server:0.0.1-SNAPSHOT
mem_limit: 512m
ports:
- '8761:8761'
environment:
SPRING.ZIPKIN.BASE-URL: http://zipkin-server:9411/
networks:
- saman-network
zipkin-server:
image: openzipkin/zipkin:latest
mem_limit: 400m
ports:
- '9411:9411'
networks:
- saman-network
environment:
RABBIT_URI: amqp://guest:guest@rabbitmq:5672
depends_on:
- rabbitmq
restart: always
rabbitmq:
image: rabbitmq:3.8.12-management
ports:
- '5672:5672'
- '15672:15672'
networks:
- saman-network
networks:
saman-network:
1条答案
按热度按时间g2ieeal71#
当我从3.0降级到Spring 2.x时,这个问题得到了解决。
看起来Zipkin目前在Spring 3.0上运行得不好。问题出在docker上,而不是本地运行。我找不到足够的资源来支持这个想法。但是根据我的经验,情况就是这样。我在Spring 3.0.0上尝试了带有“latest”标签的Zipkin,但是问题仍然存在。但是它在Spring 2.x上运行得很好