0

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

  • Confluent-动物园管理员
  • Confluent-卡夫卡
  • Confluent-Schema 注册表

我想要一个 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 容器失败的确切配置问题?

4

3 回答 3

1

Those are old and deprecated docker images. Use the latest supported docker images from confluentinc https://hub.docker.com/u/confluentinc/

You can find a full compose file here - confluentinc/cp-docker-images

于 2017-05-18T04:46:27.517 回答
0

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

于 2017-05-17T14:48:28.877 回答
0

这个问题很老,尽管留下一个对我有用的解决方案可能会有所帮助。我正在使用 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`
于 2019-05-31T04:17:46.443 回答