【问题标题】:Schema Registry container: Server died unexpectedly when launching using docker-composeSchema Registry 容器:使用 docker-compose 启动时服务器意外死亡
【发布时间】:2017-10-16 11:05:49
【问题描述】:

我已经编写了 docker-compose.yml 文件来创建以下容器:

  • Confluent-Zookeeper
  • Confluent-Kafka
  • 融合架构注册表

我想要一个 docker-compose 文件来启动必要的容器,公开所需的端口并互连依赖的容器。目标是拥有 我正在使用来自 Docker Hub 的官方融合图像。 我的 docker-compose 文件如下所示:

zookeeper:
  image: confluent/zookeeper
  container_name: confluent-zookeeper
  hostname: zookeeper
  environment:
    ZOOKEEPER_CLIENT_PORT: 2181
  ports:
    - "2181:2181"

kafka:
  environment:
    KAFKA_ZOOKEEPER_CONNECTION_STRING: zookeeper:2181
    KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092
  image: confluent/kafka
  container_name: confluent-kafka
  hostname: kafka
  links:
    - zookeeper
  ports:
    - "9092:9092"

schema-registry:
  image: confluent/schema-registry
  container_name: confluent-schema_registry
  environment:
    SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL: zookeeper:2181
    SCHEMA_REGISTRY_HOSTNAME: schema-registry
    SCHEMA_REGISTRY_LISTENERS: http://schema-registry:8081
    SCHEMA_REGISTRY_DEBUG: 'true'
    SCHEMA_REGISTRY_KAFKASTORE_TOPIC_REPLICATION_FACTOR: '1'
  links:
    - kafka
    - zookeeper
  ports:
    - "8081:8081"

现在当我运行docker-compose up 时,所有这些容器都将被创建并启动。但是 Schema Registry 容器会立即退出。 docker logs 给出以下输出:

 (io.confluent.kafka.schemaregistry.rest.SchemaRegistryConfig:135)
[2017-05-17 06:06:33,415] ERROR Server died unexpectedly:  (io.confluent.kafka.schemaregistry.rest.SchemaRegistryMain:51)
org.apache.kafka.common.config.ConfigException: Only plaintext and SSL Kafka endpoints are supported and none are configured.
        at io.confluent.kafka.schemaregistry.storage.KafkaStore.getBrokerEndpoints(KafkaStore.java:254)
        at io.confluent.kafka.schemaregistry.storage.KafkaStore.<init>(KafkaStore.java:111)
        at io.confluent.kafka.schemaregistry.storage.KafkaSchemaRegistry.<init>(KafkaSchemaRegistry.java:136)
        at io.confluent.kafka.schemaregistry.rest.SchemaRegistryRestApplication.setupResources(SchemaRegistryRestApplication.java:53)
        at io.confluent.kafka.schemaregistry.rest.SchemaRegistryRestApplication.setupResources(SchemaRegistryRestApplication.java:37)
        at io.confluent.rest.Application.createServer(Application.java:117)
        at io.confluent.kafka.schemaregistry.rest.SchemaRegistryMain.main(SchemaRegistryMain.java:43)

我搜索了这个问题,但没有任何帮助。我尝试了各种其他配置,例如提供 KAFKA_ADVERTISED_HOSTNAME、更改 SCHEMA_REGISTRY_LISTENERS 值等,但没有运气。 谁能指出 Schema Registry 容器失败的确切配置问题?

【问题讨论】:

    标签: docker apache-kafka docker-compose confluent-platform confluent-schema-registry


    【解决方案1】:

    这些是旧的和已弃用的 docker 图像。使用来自 confluentinc https://hub.docker.com/u/confluentinc/的最新支持的 docker 镜像

    您可以在此处找到完整的撰写文件 - confluentinc/cp-docker-images

    【讨论】:

    • 他们为我工作。您缺少 SR "depends_on -zookeeper -kafka" 的声明
    • schema_registry: image: confluentinc/cp-schema-registry:3.2.1 depends_on: - zookeeper - kafka 端口: - '8081' 环境: SCHEMA_REGISTRY_HOST_NAME: schema_registry SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL: 'zookeeper:2181'
    • 我也试过这些图片。但没有运气!我在 docker-compose 文件中添加了hostname: schema-registry。我遇到了新的错误:SCHEMA_REGISTRY_HOST_NAME is required.Command [/usr/local/bin/dub ensure SCHEMA_REGISTRY_HOST_NAME] FAILED ! 但这已经在 docker-compose 文件中提到了。
    • links 和 depends_on 具有类似的功能。但我刚刚看到在较新版本的 docker 中弃用了links。我会试试depends_on。
    【解决方案2】:

    您在失败的容器中缺少主机名 (hostname: schema-registry) 条目。默认情况下,Docker 将使用链接容器的别名和名称以及 self 的主机名填充容器的 /etc/hosts。

    【讨论】:

      【解决方案3】:

      这个问题很老,但留下一个对我有用的解决方案可能会有所帮助。我正在使用 docker-compose:

      version: '3.3'
      
      services:
        zookeeper:
          image: confluent/zookeeper:3.4.6-cp1
          hostname: "zookeeper"
          networks:
            - test-net
          ports:
            - 2181:2181
          environment:
            zk_id: "1"
      
        kafka:
          image: confluent/kafka:0.10.0.0-cp1
          hostname: "kafka"
          depends_on:
            - zookeeper
          networks:
            - test-net
          ports:
            - 9092:9092
          environment:
            KAFKA_ADVERTISED_HOST_NAME: "kafka"
            KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092
            KAFKA_BROKER_ID: "0"
            KAFKA_ZOOKEEPER_CONNECT: "zookeeper:2181"
      
        schema-registry:
          image: confluent/schema-registry:3.0.0
          hostname: "schema-registry"
          depends_on:
            - kafka
            - zookeeper
          networks:
            - test-net
          ports:
            - 8081:8081
          environment:
            SR_HOSTNAME: schema-registry
            SR_LISTENERS: http://schema-registry:8081
            SR_DEBUG: 'true'
            SR_KAFKASTORE_TOPIC_REPLICATION_FACTOR: '1'
            SR_KAFKASTORE_TOPIC_SERVERS: PLAINTEXT://kafka:9092
      
      networks:
        test-net:
          driver: bridge`
      

      【讨论】:

        猜你喜欢
        • 2016-11-17
        • 2018-03-10
        • 2018-03-29
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-05-27
        • 1970-01-01
        相关资源
        最近更新 更多