Scenario
In the following scenarios, you need to create a consumer group in Kafka:
l Multiple applications need to consume the same topic independently: If multiple applications need to independently consume messages on the same Kafka topic, and each application needs to manage its own consumption progress and partition assignment, you can create a separate consumer group for each application.
l Consumers need to implement message load balancing: When multiple consumers need to consume messages on the same topic, you can add them to the same consumer group, and Kafka automatically evenly distributes the topic partitions to the consumers in the consumer group to implement message load balancing.
l Consumers need to process messages in parallel: If you need to process messages on a topic in parallel, you can create multiple consumer instances and add them to the same consumer group. Kafka assigns the partitions of a topic to consumers in the consumer group, and each consumer consumes only its assigned partitions, so as to implement parallel processing of messages.
l Consumers need to achieve high availability: To improve consumer availability, you can create a consumer group and add multiple consumer instances to it. When a consumer instance fails, Kafka reassigns the consumer's partitions to other healthy consumers to ensure continuous consumption of messages.
Procedure
(1) Log in to the management console.
(2) Go to the Kafka console.
(3) In the operation column of the instance list page, click Manage in the target instance row.
(4) Click Consumer Group Management to enter the consumer group management page.
(5) Click Create Consumer Group, enter a name for the consumer group, and click Create.
Note: When a consumer group business application is connected, the client can create the consumer group automatically.
Batch Create Consumer Groups
For scenarios where a large number of new consumer groups are created, the function to create consumer groups in batches is available.
(1) Log in to the management console.
(2) Go to the Kafka console.
(3) In the operation column of the instance list page, click Manage in the target instance row.
(4) Click Consumer Group Management, and then click Batch Create.
(5) Then, the following file-uploading interface will appear.
(6) Click Upload to complete the batch creation.
Download Bulk Creation Template
(1) Log in to the management console.
(2) Go to the Kafka console.
(3) In the operation column of the instance list page, click Manage in the target instance row.
(4) Click Consumer Group Management and click Download Batch Creation Template.
(5) Download the batch creation template, and the content is as shown below.
(6) Parameter description.
Parameter | Description |
consumer group name | Consumer group name. |
isPrivate(private:1 public:2) | Whether the consumer group is private, 1: private, 2: public. |
description | Description |