简体   繁体   English

Spring 云 Stream Kafka 无法连接

[英]Spring Cloud Stream Kafka won't connect

I'm using this docker compose:我正在使用这个 docker 撰写:

version: '2'
services:

  zookeeper:
    image: confluentinc/cp-zookeeper:4.1.1
    hostname: zookeeper
    ports:
    - "32181:32181"
    environment:
      ZOOKEEPER_CLIENT_PORT: 32181
      ZOOKEEPER_TICK_TIME: 2000
      ZOOKEEPER_SYNC_LIMIT: 2

  kafka:
    image: confluentinc/cp-kafka:4.1.1
    hostname: kafka
    ports:
    - "29092:29092"
    depends_on:
    - zookeeper
    environment:
      KAFKA_BROKER_ID: 1
      KAFKA_ZOOKEEPER_CONNECT: zookeeper:32181
      KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:29092
      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1

And my properties are:我的属性是:

spring.cloud.stream.bindings.event.binder=event-binder
spring.cloud.stream.bindings.event.destination=event    

spring.cloud.stream.binders.event-binder.type=kafka

spring.cloud.stream.kafka.binder.brokers=localhost:29092
spring.cloud.stream.kafka.binder.zkNodes=localhost:32181

But I'm receiving this error:但我收到此错误:

9:54:14.534 [main] INFO  o.a.kafka.common.utils.AppInfoParser - Kafka version : 2.0.1
19:54:14.534 [main] INFO  o.a.kafka.common.utils.AppInfoParser - Kafka commitId : fa14705e51bd2ce5
19:54:14.576 [kafka-admin-client-thread | adminclient-1] WARN  o.apache.kafka.clients.NetworkClient - [AdminClient clientId=adminclient-1] Connection to node -1 could not be established. Broker may not be available.
19:54:14.679 [kafka-admin-client-thread | adminclient-1] WARN  o.apache.kafka.clients.NetworkClient - [AdminClient clientId=adminclient-1] Connection to node -1 could not be established. Broker may not be available.
19:

My spring boot version is 2.1.4.RELEASE and my spring cloud version is Greenwich.SR1.我的 spring 启动版本是 2.1.4.RELEASE,我的 spring 云版本是 Greenwich.SR1。

Thanks in advance!提前致谢!

With that configuration, I think you need使用该配置,我认为您需要

KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:29092

You should configuration with:您应该配置:

spring.cloud.stream.kafka.binder.brokers=PLAINTEXT://your host:29092 spring.cloud.stream.kafka.binder.zkNodes=PLAINTEXT://your host:29092 spring.cloud.stream.kafka.binder.brokers=PLAINTEXT://your host:29092 spring.cloud.stream.kafka.binder.zkNodes=PLAINTEXT://your host:29092

In file docker-compose.yml you should have: KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://your host:29092 If connect successful in docker and you have run successful in spring cloud stream. In file docker-compose.yml you should have: KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://your host:29092 If connect successful in docker and you have run successful in spring cloud stream.

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用Kafka经纪人的Dockerized Spring Cloud Stream服务无法连接到Zookeeper - Dockerized Spring Cloud Stream services with Kafka broker unable to connect to Zookeeper Spring 云 Stream Kafka 与微服务和 Docker-Compose 错误 - Spring Cloud Stream Kafka with Microservices and Docker-Compose Error 如何更改 Spring Cloud Stream Kafka binder 的目标? - How to change target of the Spring Cloud Stream Kafka binder? spring-cloud-starter-stream-kafka不会创建提供给spring.boot.cloud.stream.bindings.output.destination的主题 - spring-cloud-starter-stream-kafka does not creates topic provided to spring.boot.cloud.stream.bindings.output.destination 我的 spring 应用程序无法连接到 kafka 代理 - My spring app can't connect to kafka broker Spring-Cloud-Stream Kafka Azure-提取数据时出现意外错误代码13 - Spring-Cloud-Stream Kafka Azure - Unexpected error code 13 while fetching data Spring Cloud Config Server无法从本地文件系统服务 - Spring Cloud Config Server Won't Serve from Local Filesystem 无法将Kafka连接到Zookeeper - Can't connect Kafka to Zookeeper Spring 作为 Docker 容器启动时,启动服务无法连接到 Spring 云配置服务器 - Spring Boot service can't connect to Spring Cloud Config Server when start as a Docker container 无法从通过 intellij 运行的 spring 引导应用程序连接到我在 docker 上运行的 kafka - Can't connect to my kafka running on docker from spring boot application running via intellij
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM