Skip to content

Commit 2b51021

Browse files
authored
MINOR: Add missing streams groups tools doc (#21248)
This was accidentally removed in [78bc948](78bc948) Reviewers: Lucas Brutschy <[email protected]>
1 parent 84fa531 commit 2b51021

File tree

2 files changed

+184
-1
lines changed

2 files changed

+184
-1
lines changed

docs/streams/developer-guide/app-reset-tool.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Prerequisites
5656

5757
# Step 1: Run the application reset tool
5858

59-
If you are using **streams rebalance protocol** (available since AK 4.2), use the [Streams groups CLI](kafka-streams-group-sh.html#reset-offsets).
59+
If you are using **streams rebalance protocol** (available since AK 4.2), use the [Streams groups CLI](kafka-streams-group-sh#reset-offsets).
6060

6161
If you are using **classic rebalance protocol** , run the classic application reset tool as described below.
6262

Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
---
2+
title: Kafka Streams Groups Tool
3+
type: docs
4+
description:
5+
weight: 14
6+
tags: ['kafka', 'docs']
7+
aliases:
8+
keywords:
9+
---
10+
11+
<!--
12+
Licensed to the Apache Software Foundation (ASF) under one or more
13+
contributor license agreements. See the NOTICE file distributed with
14+
this work for additional information regarding copyright ownership.
15+
The ASF licenses this file to You under the Apache License, Version 2.0
16+
(the "License"); you may not use this file except in compliance with
17+
the License. You may obtain a copy of the License at
18+
19+
http://www.apache.org/licenses/LICENSE-2.0
20+
21+
Unless required by applicable law or agreed to in writing, software
22+
distributed under the License is distributed on an "AS IS" BASIS,
23+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24+
See the License for the specific language governing permissions and
25+
limitations under the License.
26+
-->
27+
28+
Use `kafka-streams-groups.sh` to manage **Streams groups** for the Streams Rebalance Protocol (KIP‑1071): list and describe groups, inspect members and offsets/lag, reset or delete offsets for input topics, and delete groups (optionally including internal topics).
29+
30+
31+
# Overview
32+
33+
A **Streams group** is a broker‑coordinated group type for Kafka Streams that uses Streams‑specific RPCs and metadata, distinct from classic consumer groups. The CLI surfaces Streams‑specific states, assignments, and input‑topic offsets to simplify visibility and administration.
34+
35+
**Use with care:** Mutating operations (offset resets/deletes, group deletion) affect how applications will reprocess data when restarted. Always preview with \--dry-run before executing and ensure application instances are stopped/inactive and the group is empty before executing the command.
36+
37+
# What the Streams Groups tool does
38+
39+
* **List Streams groups** across a cluster and display or filter by group state (Empty, Not Ready, Assigning, Reconciling, Stable, Dead).
40+
* **Describe a Streams group** and show:
41+
* Group state, group epoch, target assignment epoch (with `--state`, `--verbose` for additional details).
42+
* Per‑member info such as epochs, current vs target assignments, and whether a member still uses the classic protocol (with `--members` and `--verbose`).
43+
* Input‑topic offsets and lag (with `--offsets`), to understand how far behind processing is.
44+
* **Reset input‑topic offsets** for a Streams group to control reprocessing boundaries using precise specifiers (earliest, latest, to‑offset, to‑datetime, by‑duration, shift‑by, from‑file). Requires `--dry-run` or `--execute` and inactive instances.
45+
* **Delete offsets** for input topics to force re‑consumption on next start.
46+
* **Delete a Streams group** to clean up broker‑side Streams metadata (offsets, topology, assignments). Optionally delete all, or a subset of, **internal topics** at the same time using `--internal-topics`.
47+
48+
49+
50+
# Usage
51+
52+
The script is located in `bin/kafka-streams-groups.sh` and connects to your cluster via `--bootstrap-server`. For secured clusters, pass AdminClient properties using `--command-config`.
53+
54+
55+
$ kafka-streams-groups.sh --bootstrap-server <host:port> [COMMAND] [OPTIONS]
56+
57+
**Note:** `kafka-streams-groups.sh` complements the Streams Admin API for Streams groups. The CLI exposes list/describe/delete operations and offset management similar in spirit to consumer-group tools, but tailored to Streams groups defined in KIP‑1071.
58+
59+
# Commands
60+
61+
## List Streams groups
62+
63+
Discovering groups
64+
65+
66+
# List all Streams groups
67+
kafka-streams-groups.sh --bootstrap-server localhost:9092 --list
68+
69+
70+
## Describe Streams groups
71+
72+
Inspecting group's state, members, and lag
73+
74+
75+
# Describe a group: state + epochs
76+
kafka-streams-groups.sh --bootstrap-server localhost:9092 \
77+
--describe --group my-streams-app --state --verbose
78+
79+
# Describe a group: members (assignments vs target, classic/streams)
80+
kafka-streams-groups.sh --bootstrap-server localhost:9092 \
81+
--describe --group my-streams-app --members --verbose
82+
83+
# Describe a group: input-topic offsets and lag
84+
kafka-streams-groups.sh --bootstrap-server localhost:9092 \
85+
--describe --group my-streams-app --offsets
86+
87+
88+
## Reset input-topic offsets (preview, then apply) {#reset-offsets}
89+
90+
Ensure all application instances are stopped/inactive. Always preview changes with `--dry-run` before using `--execute`.
91+
92+
93+
# Preview resetting all input topics to a specific timestamp
94+
kafka-streams-groups.sh --bootstrap-server localhost:9092 \
95+
--group my-streams-app \
96+
--reset-offsets --all-input-topics --to-datetime 2025-01-31T23:57:00.000 \
97+
--dry-run
98+
99+
# Apply the reset
100+
kafka-streams-groups.sh --bootstrap-server localhost:9092 \
101+
--group my-streams-app \
102+
--reset-offsets --all-input-topics --to-datetime 2025-01-31T23:57:00.000 \
103+
--execute
104+
105+
106+
## Delete offsets to force re-consumption
107+
108+
Delete offsets for all or specific input topics to have the group re-read data on restart.
109+
110+
111+
# Delete offsets for all input topics (execute)
112+
kafka-streams-groups.sh --bootstrap-server localhost:9092 \
113+
--group my-streams-app \
114+
--delete-offsets --all-input-topics --execute
115+
116+
# Delete offsets for specific topics
117+
kafka-streams-groups.sh --bootstrap-server localhost:9092 \
118+
--group my-streams-app \
119+
--delete-offsets --topic input-a --topic input-b --execute
120+
121+
122+
## Delete a Streams group (cleanup)
123+
124+
Delete broker-side Streams metadata for a group and optionally remove a subset of internal topics.
125+
126+
127+
# Delete Streams group metadata
128+
kafka-streams-groups.sh --bootstrap-server localhost:9092 \
129+
--delete --group my-streams-app
130+
131+
# Delete a subset of internal topics alongside the group (use with care)
132+
kafka-streams-groups.sh --bootstrap-server localhost:9092 \
133+
--delete --group my-streams-app \
134+
--internal-topics my-app-repartition-0,my-app-changelog
135+
136+
137+
# All options and flags
138+
139+
## Core actions
140+
141+
* `--list`: List Streams groups. Use `--state` to display/filter by state.
142+
* `--describe`: Describe a group selected by `--group`. Combine with:
143+
* `--state` (group state and epochs), `--members` (members and assignments), `--offsets` (input and repartition topics offsets/lag).
144+
* `--verbose` for additional details (e.g., leader epochs where applicable).
145+
* `--reset-offsets`: Reset input-topic offsets (one group at a time; instances should be inactive). Choose exactly one specifier:
146+
* `--to-earliest`, `--to-latest`, `--to-current`, `--to-offset <n>`
147+
* `--by-duration <PnDTnHnMnS>`, `--to-datetime <YYYY-MM-DDTHH:mm:SS.sss>`
148+
* `--shift-by <n>` (±), `--from-file` (CSV)
149+
Scope:
150+
* `--all-input-topics` or one/more `--topic <name>`; some builds also support `--all-topics` (all input topics per broker topology metadata).
151+
Safety:
152+
* Requires `--dry-run` or `--execute`.
153+
* `--delete-offsets`: Delete offsets for `--all-input-topics`, specific `--topic` names, or `--from-file`.
154+
* `--delete`: Delete Streams group metadata; optionally pass `--internal-topics <list>` to delete a subset of internal topics.
155+
156+
157+
158+
## Common flags
159+
160+
* `--group <id>`: Target Streams group (application.id).
161+
* `--all-groups`: Operate on all groups (allowed with `--delete`).
162+
* `--bootstrap-server <host:port>`: Broker(s) to connect to (required).
163+
* `--command-config <file>`: Properties for AdminClient (security, timeouts, etc.).
164+
* `--timeout <ms>`: Wait time for group stabilization in some operations (default: 5000ms).
165+
* `--dry-run`, `--execute`: Preview vs apply for mutating operations.
166+
* `--help`, `--version`, `--verbose`: Usage, version, verbosity.
167+
168+
169+
170+
# Best practices and safety
171+
172+
* Preview changes with `--dry-run` to verify topic scope and impact before `--execute`.
173+
* Use `--internal-topics` carefully: deleting internal topics removes state backing topics; only do this when you intend to rebuild state from input topics.
174+
175+
176+
177+
This page documents `kafka-streams-groups.sh` capabilities for Streams groups as defined by KIP‑1071 and implemented in Apache Kafka.
178+
179+
* [Documentation](/documentation)
180+
* [Kafka Streams](/documentation/streams)
181+
* [Developer Guide](/documentation/streams/developer-guide/)
182+
183+

0 commit comments

Comments
 (0)