报的错误为信息为:
Exception in thread "main" joptsimple.UnrecognizedOptionException: '.....' is not a recognized option
at joptsimple.OptionException.unrecognizedOption(OptionException.java:93)
at joptsimple.OptionParser.handleLongOptionToken(OptionParser.java:402)
at joptsimple.OptionParserState$2.handleArgument(OptionParserState.java:55)
at joptsimple.OptionParser.parse(OptionParser.java:392)
at kafka.tools.ConsoleProducer$ProducerConfig.<init>(ConsoleProducer.scala:216)
at kafka.tools.ConsoleProducer$.main(ConsoleProducer.scala:35)
at kafka.tools.ConsoleProducer.main(ConsoleProducer.scala)
其实出现这种错误是你的参数没有写正确
我在网上找的启动producer命令为
kafka-console-producer.sh -broker -list 192.168.19.150:9092 -topic test
但是就会报错,后来我看了看自己kafka的启动producer的命令后的参数,原来已经不一样了,我的为
kafka-console-producer.sh --broker-list 192.168.19.150:9092 --topic test
你们可以看看自己kafka的命令参数,我的kafka版本是kafka_2.10-0.8.2.2的