Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error while executing Kafka on port 2181 - topic command: Timed out waiting for a node assignment. OS Win 10

I have configured kafka_2.11-2.3.0 and apache-zookeeper-3.5.5-bin on Windows 10. But while running the topic creation command I am getting the below error:

C:\kafka_2.11-2.3.0>.\bin\windows\kafka-topics.bat --create --bootstrap-server 127.0.0.1:2181 --partitions 1 --replication-factor 1 --topic testD1
Error while executing topic command : org.apache.kafka.common.errors.TimeoutException: Timed out waiting for a node assignment.
[2019-10-14 16:42:40,603] ERROR java.util.concurrent.ExecutionException: org.apache.kafka.common.errors.TimeoutException: Timed out waiting for a node assignment.
        at org.apache.kafka.common.internals.KafkaFutureImpl.wrapAndThrow(KafkaFutureImpl.java:45)
        at org.apache.kafka.common.internals.KafkaFutureImpl.access$000(KafkaFutureImpl.java:32)
        at org.apache.kafka.common.internals.KafkaFutureImpl$SingleWaiter.await(KafkaFutureImpl.java:89)
        at org.apache.kafka.common.internals.KafkaFutureImpl.get(KafkaFutureImpl.java:260)
        at kafka.admin.TopicCommand$AdminClientTopicService.createTopic(TopicCommand.scala:178)
        at kafka.admin.TopicCommand$TopicService$class.createTopic(TopicCommand.scala:149)
        at kafka.admin.TopicCommand$AdminClientTopicService.createTopic(TopicCommand.scala:172)
        at kafka.admin.TopicCommand$.main(TopicCommand.scala:60)
        at kafka.admin.TopicCommand.main(TopicCommand.scala)
Caused by: org.apache.kafka.common.errors.TimeoutException: Timed out waiting for a node assignment.

Read somewhere in stackoverflow to add listeners=PLAINTEXT://127.0.0.1:9092 in the server.properties file but that didn't work out as expected.

like image 629
P.S.Rawat Avatar asked Oct 14 '19 12:10

P.S.Rawat


2 Answers

I've struggled with the same issue on linux. The recommended way to create topics is still via the broker, you shouldn't need to connect directly to zookeeper.

It turned out to be that the shell scripts need a little more configuration when connecting to a TLS endpoint:

  1. Copy the certs linked to by your jdk to a temporary location:
cp /usr/lib/jvm/java-11-openjdk-amd64/lib/security/cacerts /tmp/kafka.client.truststore.jks
  1. Make a properties file (e.g. client.properties)
security.protocol=SSL
ssl.truststore.location=/tmp/kafka.client.truststore.jks

Then try running the script again, while passing the option --command-config with your properties file e.g.:

./kafka-topics.sh --bootstrap-server <server>:<port> --list --command-config client.properties

Note that the option is not consistent between the different scripts, for the console consumer / producer you'll need: --consumer.config and --producer.config

like image 25
EddKing Avatar answered Oct 21 '22 05:10

EddKing


Zookeeper runs on 2181, not Kafka (the bootstrap server)

By default, Kafka runs on port 9092 as below

kafka-topics --bootstrap-server 127.0.0.1:9092 --topic first_topic --create --partitions 3 --replication-factor 1

like image 200
Anand Krish Avatar answered Oct 21 '22 04:10

Anand Krish