简体   繁体   English

在Apache Kafka中创建主题时出错

[英]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 /usr/local/kafka/bin/kafka-topics.sh --create --zookeeper localhost:2181 --rerelication-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. 我遵循Kafka:The Definitive Guide一书中的说明。

Thanks in advance. 提前致谢。

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 我能够通过在脚本中添加sudo来使其工作:/usr/local/kafka/bin/kafka-topics.sh

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

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. 如果您尝试在源代码版本中运行脚本,则可能会发生这种情况。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM