Deleting a consumer group removes a consumer group from your Managed Service for Apache Kafka cluster.
To delete a consumer group, you can use the Google Cloud console, the Google Cloud CLI, the client libraries, the Managed Kafka API, or the open source Apache Kafka APIs.
Required roles and permissions to delete a consumer group
To get the permissions that you need to delete your consumer groups,
ask your administrator to grant you the
Managed Kafka Consumer Group Editor (roles/managedkafka.consumerGroupEditor
) IAM role on your project.
For more information about granting roles, see Manage access to projects, folders, and organizations.
This predefined role contains the permissions required to delete your consumer groups. To see the exact permissions that are required, expand the Required permissions section:
Required permissions
The following permissions are required to delete your consumer groups:
-
Delete consumer groups:
managedkafka.consumerGroups.delete
You might also be able to get these permissions with custom roles or other predefined roles.
For more information about the Managed Kafka Consumer Group Editor role, see Managed Service for Apache Kafka predefined roles.
Delete a consumer group
When you delete a consumer group, the consumer offsets it stores are permanently lost. You are also unable to see the logs and metrics for the consumer groups in the console. However, the metrics and logs associated with the consumer group are retained and accessible using Logs Explorer. Deleting a consumer group also does not delete the messages it has consumed. The messages are still available in the topics with which they were originally associated.
To delete a consumer group, follow these steps:
Console
In the Google Cloud console, go to the Cluster page.
- From the list of clusters, click the cluster to which the consumer
group that you want to delete belongs.
The Cluster details page opens.
- Click the consumer group that you want to delete.
- In the Consumer group details page, click Delete.
- Confirm the operation.
gcloud
-
In the Google Cloud console, activate Cloud Shell.
At the bottom of the Google Cloud console, a Cloud Shell session starts and displays a command-line prompt. Cloud Shell is a shell environment with the Google Cloud CLI already installed and with values already set for your current project. It can take a few seconds for the session to initialize.
Run the
gcloud managed-kafka consumer-groups delete
command:gcloud managed-kafka consumer-groups delete CONSUMER_GROUP_ID \ --cluster=CLUSTER_ID \ --location=LOCATION
This command permanently removes a consumer group from your Managed Service for Apache Kafka cluster.
Replace the following:
-
CONSUMER_GROUP_ID: The ID or name of the consumer group.
-
CLUSTER_ID: The ID or name of the cluster.
-
LOCATION: The location of the cluster.
-