kafka是 装在vmware虚拟机里的centos7上。
---------------------
我装的应该是单机,看网上的教程,配置了3个server。properties文件,应该是3个broker。
我server。properties文件的 #listeners=PLAINTEXT://:9092 默认是注释状态,我也没有打开,不知道是不是这个原因。
jps启动线程有:
[root@localhost kafka_2.11-2.0.0]# jps
5298 Jps
1862 QuorumPeerMain
4582 Kafka
3992 ConsoleConsumer
3421 ConsoleProducer
2158 Kafka
4926 Kafka
----------------
我在虚拟机上使用生产者和消费者是可以看到消息的, 但我的idea跑测试用例就失败了,消费者shell里也看不到消息。
控制台一直报这个问题,直到超时
2018-08-17 14:56:26.210 WARN 14824 --- [ad | producer-1] org.apache.kafka.clients.NetworkClient : [Producer clientId=producer-1] Connection to node 0 could not be established. Broker may not be available.
。。。
java.lang.IllegalStateException: Producer is closed forcefully.
at org.apache.kafka.clients.producer.internals.RecordAccumulator.abortBatches(RecordAccumulator.java:696) [kafka-clients-1.0.2.jar:na]
at org.apache.kafka.clients.producer.internals.RecordAccumulator.abortIncompleteBatches(RecordAccumulator.java:683) [kafka-clients-1.0.2.jar:na]
at org.apache.kafka.clients.producer.internals.Sender.run(Sender.java:185) [kafka-clients-1.0.2.jar:na]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_181]
-----
最后再问一下老师,修改完server。properties需要重启服务么?