gpt4 book ai didi

docker schemaregistry和kafkarest无法启动

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

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

不知道为什么架构注册表和 Kafka 休息无法启动。

下面是 docker-compose 文件。

这是架构和其余 docker-compose 文件。此 docker 出现错误

[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)

Docker 撰写:

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 组合

  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"

最佳答案

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

例如,您可以使用 existing all-in-one compose file for 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

关于docker schemaregistry和kafkarest无法启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61927490/

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