等待Kafka在Zookeeper中创建/brokers/ids时超时

pxiryf3j  于 2023-06-20  发布在  Apache
关注(0)|答案(1)|浏览(185)

我得到一个io.confluent.admin.utils.cli.KafkaReadyCommand错误,
表示org.apache.kafka.common.errors.TimeoutException: Timed out waiting for Kafka to create /brokers/ids in Zookeeper. timeout (ms) = 40000
我可以看到我的kafkazookeeper服务都已启动并正在运行,但schem-registry在启动时抛出此错误
这是我的docker-compose文件,对Kafka来说还是新的,非常感谢帮助并指出我是否遗漏了什么。

version: "3.1"
services:
  zookeeper:
    image: confluentinc/cp-zookeeper:5.3.1
    hostname: zookeeper
    ports:
      - 2181:2181
    container_name: zookeeper
    environment:
      ZOOKEEPER_CLIENT_PORT: 2181
      ZOOKEEPER_TICK_TIME: 2000

  kafka:
    container_name: dvs-kafka
    image: wurstmeister/kafka:2.12-2.4.0
    hostname: kafka
    depends_on:
      - zookeeper
    links:
      - zookeeper
    ports:
      - 29092:29092
    environment:
      KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
      KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:29092
      KAFKA_LISTENERS: PLAINTEXT://kafka:29092
      KAFKA_ADVERTISED_HOST_NAME: kafka:29092
      KAFKA_ZOOKEEPER_CONNECTION_TIMEOUT_MS: 30000
      KAFKA_AUTO_CREATE_TOPICS_ENABLE: "false"

  schema-registry:
    image: confluentinc/cp-schema-registry:5.3.1
    hostname: schema-registry
    depends_on:
      - zookeeper
      - kafka
    links:
      - zookeeper
      - kafka
    container_name: schema-registry
    ports:
      - "8081:8081"
    environment:
      SCHEMA_REGISTRY_HOST_NAME: schema-registry
      SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL: "zookeeper:2181"
jpfvwuh4

jpfvwuh41#

Schema Registry不再使用Zookeeper,链接是一个不推荐的合成功能...
请使用此存储库作为Confluent Platform的最新参考
https://github.com/confluentinc/cp-all-in-one

相关问题