Home > Mobile >  demo-kafka exited with code 1 on M1 Mashine
demo-kafka exited with code 1 on M1 Mashine

Time:08-18

I am trying to start some Kafka demo project on my machine MacOS Monterey, Apple Chip.

Below is the content for docker-compose file:

version: '3.7'
services:

  zookeeper:
    container_name: demo-zookeeper
    image: bitnami/zookeeper:3.4.14
    ports:
      - "2181:2181"
    environment:
      ALLOW_ANONYMOUS_LOGIN: 'yes'

  kafka:
    container_name: demo-kafka
    image: wurstmeister/kafka:2.12-2.4.1
    depends_on:
      - zookeeper
    ports:
      - "9092:9092"
    environment:
      KAFKA_LISTENERS: PLAINTEXT://:9092
      KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://demo-kafka:9092
      KAFKA_BROKER_ID: 1
      KAFKA_PORT: 9092
      KAFKA_ADVERTISED_PORT: 9092
      KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181

However, running it fails:

demo-zookeeper | Starting zookeeper ... STARTED
demo-kafka   | [2022-08-13 18:15:21,133] INFO Opening socket connection to server zookeeper/172.18.0.2:2181. Will not attempt to authenticate using SASL (unknown error) (org.apache.zookeeper.ClientCnxn)
demo-kafka   | [2022-08-13 18:15:21,134] INFO Socket error occurred: zookeeper/172.18.0.2:2181: Connection refused (org.apache.zookeeper.ClientCnxn)
demo-kafka   | [2022-08-13 18:15:21,597] INFO [ZooKeeperClient Kafka server] Closing. (kafka.zookeeper.ZooKeeperClient)
demo-kafka   | [2022-08-13 18:15:22,239] INFO Opening socket connection to server zookeeper/172.18.0.2:2181. Will not attempt to authenticate using SASL (unknown error) (org.apache.zookeeper.ClientCnxn)
demo-kafka   | [2022-08-13 18:15:22,346] INFO Session: 0x0 closed (org.apache.zookeeper.ZooKeeper)
demo-kafka   | [2022-08-13 18:15:22,347] INFO EventThread shut down for session: 0x0 (org.apache.zookeeper.ClientCnxn)
demo-kafka   | [2022-08-13 18:15:22,348] INFO [ZooKeeperClient Kafka server] Closed. (kafka.zookeeper.ZooKeeperClient)
demo-kafka   | [2022-08-13 18:15:22,350] ERROR Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer)
demo-kafka   | kafka.zookeeper.ZooKeeperClientTimeoutException: Timed out waiting for connection while in state: CONNECTING
demo-kafka   |  at kafka.zookeeper.ZooKeeperClient.$anonfun$waitUntilConnected$3(ZooKeeperClient.scala:259)
demo-kafka   |  at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
demo-kafka   |  at kafka.utils.CoreUtils$.inLock(CoreUtils.scala:253)
demo-kafka   |  at kafka.zookeeper.ZooKeeperClient.waitUntilConnected(ZooKeeperClient.scala:255)
demo-kafka   |  at kafka.zookeeper.ZooKeeperClient.<init>(ZooKeeperClient.scala:113)
demo-kafka   |  at kafka.zk.KafkaZkClient$.apply(KafkaZkClient.scala:1858)
demo-kafka   |  at kafka.server.KafkaServer.createZkClient$1(KafkaServer.scala:375)
demo-kafka   |  at kafka.server.KafkaServer.initZkClient(KafkaServer.scala:399)
demo-kafka   |  at kafka.server.KafkaServer.startup(KafkaServer.scala:207)
demo-kafka   |  at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:44)
demo-kafka   |  at kafka.Kafka$.main(Kafka.scala:84)
demo-kafka   |  at kafka.Kafka.main(Kafka.scala)
demo-kafka   | [2022-08-13 18:15:22,352] INFO shutting down (kafka.server.KafkaServer)
demo-kafka   | [2022-08-13 18:15:22,356] INFO shut down completed (kafka.server.KafkaServer)
demo-kafka   | [2022-08-13 18:15:22,356] ERROR Exiting Kafka. (kafka.server.KafkaServerStartable)
demo-kafka   | [2022-08-13 18:15:22,358] INFO shutting down (kafka.server.KafkaServer)
demo-kafka exited with code 1

Following is content for full output at pastebin.

What is missed for Kafka to start?

CodePudding user response:

Last I checked, neither of those containers support ARM/M1

Instead, you may use Confluent images, version 7.2.0, or later, which do support ARM images

  • Related