2

both zookeeper and Kafka communicated well and up running.

not sure why the schema registry and Kafka rest cannot up.

below is the docker-compose file.

this is the schema and rest docker-compose file. error on this 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 Compose:

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' 

this is the zk and 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"
OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
user2201789
  • 1,083
  • 2
  • 20
  • 45

2 Answers2

5

It cannot start because it doesn't know which of the two listeners you are trying to connect to. This cannot be determined by providing a ZK address, AFAIK. You shouldn't need Zookeeper for anything other than Kafka, anyway.

For example, you could use the existing all-in-one compose file for Confluent

In particular, notice the REST Proxy doesn't have ZK

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

For Schema Registry: https://docs.confluent.io/current/schema-registry/installation/deployment.html#ak-based-primary-election

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
  • 5
    So, basically, in the environment of the `schema-registry` the OP has to remove `SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL` and add `SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS: "PLAINTEXT://kafka:29092"` Reference: kafkastore.connection.url is [deprecated.](https://docs.confluent.io/current/schema-registry/installation/config.html#kafkastore-connection-url) – SergiyKolesnikov Jul 07 '20 at 18:08
0

I got it with proper configuration at kafka docker environment.

environment:

KAFKA_ZOOKEEPER_CONNECT: 'zookeeper:2181'

KAFKA_AUTO_CREATE_TOPICS_ENABLE: 'true'

ALLOW_PLAINTEXT_LISTENER: 'yes'

KAFKA_LISTENERS: PLAINTEXT://:9092

KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092

Also kafdrop configuration need not to use 29092. Just use default kafka port 9092.

KAFKA_BROKERCONNECT: "kafka:9092"

user2201789
  • 1,083
  • 2
  • 20
  • 45