1

zookeeper 和 Kafka 都沟通良好并且正常运行。

不知道为什么模式注册表和卡夫卡休息不能起来。

下面是 docker-compose 文件。

这是架构和休息 docker-compose 文件。此泊坞窗上的错误

[main] ERROR io.confluent.admin.utils.cli.KafkaReadyCommand - Error while running kafka-ready.
java.lang.RuntimeException: No endpoints found for security protocol [PLAINTEXT]. Endpoints found in ZK [{EXTERNAL=localhost:9092, INTERNAL=kafka:29092}]
        at io.confluent.admin.utils.cli.KafkaReadyCommand.main(KafkaReadyCommand.java:143)



[main] INFO org.apache.zookeeper.ZooKeeper - Session: 0x1003f4a8fa10006 closed
[main] ERROR io.confluent.admin.utils.cli.KafkaReadyCommand - Error while running kafka-ready.
java.lang.RuntimeException: No endpoints found for security protocol [PLAINTEXT]. Endpoints found in ZK [{EXTERNAL=localhost:9092, INTERNAL=kafka:29092}]
        at io.confluent.admin.utils.cli.KafkaReadyCommand.main(KafkaReadyCommand.java:143)

码头工人组成:

schema-registry:
    network_mode: pm
    image: confluentinc/cp-schema-registry:5.2.1
    hostname: schema-registry
    container_name: schema-registry
    depends_on:
      - zookeeper
      - kafka
    ports:
      - "8081:8081"
    environment:
      SCHEMA_REGISTRY_HOST_NAME: 'schema-registry'
      SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL: 'zookeeper:2181'
      SCHEMA_REGISTRY_LISTENERS: "http://schema-registry:8081"

  rest-proxy:
    network_mode: pm
    image: confluentinc/cp-kafka-rest:5.2.1
    depends_on:
      - zookeeper
      - kafka
      - schema-registry
    ports:
      - "8082:8082"
    hostname: rest-proxy
    container_name: rest-proxy
    environment:
      KAFKA_REST_HOST_NAME: 'rest-proxy'
      KAFKA_REST_BOOTSTRAP_SERVERS: 'kafka:29092'
      KAFKA_REST_LISTENERS: "http://rest-proxy:8082"
      KAFKA_REST_SCHEMA_REGISTRY_URL: 'http://schema-registry:8081'
      KAFKA_REST_ZOOKEEPER_CONNECT: 'zookeeper:2181' 

这是 zk 和 kafka docker compose

  zookeeper:
    network_mode: pm
    image: wurstmeister/zookeeper
    hostname: zookeeper
    container_name: zookeeper
    ports:
      - "2181:2181"
    environment:
      ZOOKEEPER_CLIENT_PORT: 2181
      ZOOKEEPER_TICK_TIME: 2000
      ALLOW_ANONYMOUS_LOGIN: 1

  kafka:
    network_mode: pm
    image: wurstmeister/kafka
    hostname: kafka
    container_name: kafka
    depends_on:
      - zookeeper
    ports:
      - "9092:9092"
    environment:
      KAFKA_ZOOKEEPER_CONNECT: 'zookeeper:2181'
      KAFKA_AUTO_CREATE_TOPICS_ENABLE: 'true'
      ALLOW_PLAINTEXT_LISTENER: 'yes'
      KAFKA_ADVERTISED_HOST_NAME: kafka
      KAFKA_LISTENERS: "INTERNAL://:29092,EXTERNAL://:9092"
      KAFKA_ADVERTISED_LISTENERS: "INTERNAL://kafka:29092,EXTERNAL://localhost:9092"
      KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: "INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT"
      KAFKA_INTER_BROKER_LISTENER_NAME: "INTERNAL"
      KAFKA_ZOOKEEPER_SESSION_TIMEOUT: "6000"
      KAFKA_RESTART_ATTEMPTS: "10"
      KAFKA_RESTART_DELAY: "5"
      ZOOKEEPER_AUTOPURGE_PURGE_INTERVAL: "0"
4

2 回答 2

4

它无法启动,因为它不知道您要连接的两个侦听器中的哪一个。这不能通过提供 ZK 地址 AFAIK 来确定。无论如何,除了 Kafka 之外,你不应该需要 Zookeeper。

例如,您可以将现有的一体式撰写文件用于 Confluent

特别要注意 REST 代理没有 ZK

https://github.com/confluentinc/cp-all-in-one/blob/5.5.0-post/cp-all-in-one-community/docker-compose.yml#L139-L143

对于模式注册表:https ://docs.confluent.io/current/schema-registry/installation/deployment.html#ak-based-primary-election

于 2020-05-26T15:48:15.210 回答
0

我在 kafka docker 环境中进行了适当的配置。

环境:

KAFKA_ZOOKEEPER_CONNECT:'动物园管理员:2181'

KAFKA_AUTO_CREATE_TOPICS_ENABLE:'真'

ALLOW_PLAINTEXT_LISTENER:“是”

KAFKA_LISTENERS: PLAINTEXT://:9092

KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092

此外,kafdrop 配置不需要使用 29092。只需使用默认的 kafka 端口 9092。

KAFKA_BROKERCONNECT: "kafka:9092"

于 2020-05-28T11:55:59.360 回答