首页 > 编程语言 > 详细

kafka Java创建生产者报错:Invalid partition given with record: 1 is not in the range [0...1)

时间:2018-08-07 19:22:59      阅读:4112      评论:0      收藏:0      [点我收藏+]

参考:https://www.jianshu.com/p/9e72b3942c59

原因是在kafka集群kafka/config/server.properties文件中num.patitions = 1. 需要修改分区默认值。

partitions在是在创建topic的时候默认创建的partitions节点的个数,只对新创建的topic生效,所有尽量在项目规划时候定一个合理的值。也可以通过命令行动态扩容。

./bin/kafka-topics.sh --zookeeper  localhost:2181 --alter --partitions 2 --topic  test

 

kafka Java创建生产者报错:Invalid partition given with record: 1 is not in the range [0...1)

原文:https://www.cnblogs.com/ryu-manager/p/9438863.html

(0)
(1)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!