Ryan
Ryan

Reputation: 107

Error creating topic in Apache Kafka

When using the command:

/usr/local/kafka/bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test

I get the following error:

Unrecognized option: --create
Error: Could not create the Java Virtual Machine
Error: A fatal exception has occurred. Program will exit.

I am following the instructions in the Kafka: The Definitive Guide book.

Thanks in advance.

Upvotes: 1

Views: 3125

Answers (2)

Kobe-Wan Kenobi
Kobe-Wan Kenobi

Reputation: 3874

You should check whether you have downloaded the correct (compiled) version.

This may happen if you are trying to run the script in the source code version.

Upvotes: 1

Sam
Sam

Reputation: 36

I had the same problem as yours. I was able to make it work by adding sudo in the script: /usr/local/kafka/bin/kafka-topics.sh

exec sudo $(dirname $0)/kafka-run-class.sh kafka.admin.TopicCommand "$@"

Upvotes: 2

Related Questions