我编写了docker-compose.yml文件来创建以下容器:
合流Zookeeper
合流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
,将创建并启动所有这些容器。但是模式注册表容器立即退出。 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\u播发的\u主机名、更改schema\u注册表\u侦听器值等,但没有成功。有人能指出模式注册表容器失败的确切配置问题吗?
3条答案
按热度按时间8yparm6h1#
这个问题由来已久,不过留下一个对我有用的解决方案或许会有所帮助。我正在使用docker compose:
drnojrws2#
这些都是过时的docker图像。使用confluentinc.最新支持的docker映像https://hub.docker.com/u/confluentinc/
你可以在这里找到一个完整的文件-confluentinc/cp docker images
dzhpxtsq3#
你缺少主机名(
hostname: schema-registry
)失败容器中的条目。默认情况下,docker将填充容器的/etc/hosts
使用链接容器的别名和名称,加上self的主机名。