creating/updating kafka 中的主题 -.81 带有分区

creating/updating topic in kafka -.81 with partitions

我想使用 0.81 版在 kafka 中创建一个主题,但我没有 kafka-topics.sh 脚本来执行命令行创建命令。我需要确保主题有多个分区,以便多线程消费者能够使用来自主题的消息。每条消息只能传递一次,有人告诉我,如果队列中没有分区,即使使用相同的组 ID 也无法做到这一点。

我的另一个问题是作为两个独立进程的单个消费者 运行 是否可以使用相同的组 ID 做同样的事情?基本上我目前从队列中读取消息的速度不够快。

由于我使用的是旧版本,我无法按照此命令的建议使用分区计数更新主题:

./bin/kafka-topics.sh --create --zookeeper localhost:2181 --topic 
   my-topic --replication-factor 1 --partitions 2

My other question is whether a single consumer run as two separate processes can do the same thing using the same group ID? Basically I am currently not reading the messages from the queue fast enough.

如果我理解你的问题,答案是肯定的。我的意思是,group.id 以下列方式工作。

  1. 如果相同,则 group.id 内的消费者将与负载均衡器
  2. 一起工作
  3. 如果group.id不同,则每个组都会得到自己的"copy"条消息,因此您可以对相同的消息内容进行不同的操作。

Because of the older version I am using I cannot update the topic with partition count as suggested by this command

我很困惑你在这里做什么,但是要更改主题的参数,你应该使用“--alter”opion/command 而不是“--create”。