Skip to content

Commit c274374

Browse files
authored
KAFKA-19380: Update streams/developer-guide/app-reset-tool.html (#20946)
- created `docs/streams/developer-guide/kafka-streams-group-sh.html` that lists all available cli commands . - refered to `docs/streams/developer-guide/kafka-streams-group-sh.html` from `app-reset-tool.html` Reviewers: Matthias J. Sax <[email protected]>, Lucas Brutschy <[email protected]>
1 parent 51bb036 commit c274374

File tree

4 files changed

+300
-4
lines changed

4 files changed

+300
-4
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<!--
2+
Licensed to the Apache Software Foundation (ASF) under one or more
3+
contributor license agreements. See the NOTICE file distributed with
4+
this work for additional information regarding copyright ownership.
5+
The ASF licenses this file to You under the Apache License, Version 2.0
6+
(the "License"); you may not use this file except in compliance with
7+
the License. You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
-->
17+
18+
<!-- should always link the latest release's documentation -->
19+
<!--#include virtual="../../../streams/developer-guide/kafka-streams-group-sh.html" -->

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@
6565
</dl>
6666
<div class="section" id="step-1-run-the-application-reset-tool">
6767
<h2>Step 1: Run the application reset tool<a class="headerlink" href="#step-1-run-the-application-reset-tool" title="Permalink to this headline"></a></h2>
68+
<p>If you are using <strong>streams rebalance protocol</strong> (available since AK 4.2), use the <a href = "kafka-streams-group-sh.html#reset-offsets">Streams groups CLI</a>.</p>
69+
<p>If you are using <strong>classic rebalance protocol</strong>, run the classic application reset tool as described below.</p>
6870
<p>Invoke the application reset tool from the command line</p>
6971
<p>Warning! This tool makes irreversible changes to your application. It is strongly recommended that you run this once with <code class="docutils literal"><span class="pre">--dry-run</span></code> to preview your changes before making them.</p>
7072
<pre><code class="language-bash">$ bin/kafka-streams-application-reset.sh</code></pre>

docs/streams/developer-guide/index.html

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,11 @@ <h1>Developer Guide for Kafka Streams</h1>
5252
<li class="toctree-l1"><a class="reference internal" href="manage-topics.html">Managing Streams Application Topics</a></li>
5353
<li class="toctree-l1"><a class="reference internal" href="security.html">Streams Security</a></li>
5454
<li class="toctree-l1"><a class="reference internal" href="app-reset-tool.html">Application Reset Tool</a></li>
55+
<li class="toctree-l1"><a class="reference internal" href="kafka-streams-group-sh.html">Kafka Streams Groups CLI</a></li>
5556
</ul>
5657
</div>
5758
</div>
5859

59-
60-
</div>
61-
</div>
62-
6360
<div class="pagination">
6461
<a href="/{{version}}/documentation/streams/architecture" class="pagination__btn pagination__btn__prev">Previous</a>
6562
<a href="/{{version}}/documentation/streams/developer-guide/write-streams" class="pagination__btn pagination__btn__next">Next</a>
Lines changed: 278 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,278 @@
1+
<!--
2+
Licensed to the Apache Software Foundation (ASF) under one or more
3+
contributor license agreements. See the NOTICE file distributed with
4+
this work for additional information regarding copyright ownership.
5+
The ASF licenses this file to You under the Apache License, Version 2.0
6+
(the "License"); you may not use this file except in compliance with
7+
the License. You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
-->
17+
18+
<script><!--#include virtual="../../js/templateData.js" --></script>
19+
20+
<script id="content-template" type="text/x-handlebars-template">
21+
<!-- h1>Developer Guide for Kafka Streams</h1 -->
22+
<div class="sub-nav-sticky">
23+
<div class="sticky-top">
24+
<!-- div style="height:35px">
25+
<a href="/{{version}}/documentation/streams/">Introduction</a>
26+
<a class="active-menu-item" href="/{{version}}/documentation/streams/developer-guide">Developer Guide</a>
27+
<a href="/{{version}}/documentation/streams/core-concepts">Concepts</a>
28+
<a href="/{{version}}/documentation/streams/quickstart">Run Demo App</a>
29+
<a href="/{{version}}/documentation/streams/tutorial">Tutorial: Write App</a>
30+
</div -->
31+
</div>
32+
</div>
33+
<div class="everything">
34+
35+
<div class="container">
36+
37+
<div id="header">
38+
<div class="container">
39+
<h1>Kafka Streams Groups Tool (kafka-streams-groups.sh)</h1>
40+
<p>Use <code>kafka-streams-groups.sh</code> to manage <strong>Streams groups</strong> 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).</p>
41+
</div>
42+
</div>
43+
44+
<div class="contents local topic" id="table-of-contents">
45+
<p class="topic-title first"><b>Table of Contents</b></p>
46+
<ul class="simple">
47+
<li><a class="reference internal" href="#overview">Overview</a></li>
48+
<li><a class="reference internal" href="#what-it-does">What the Streams Groups tool does</a></li>
49+
<li><a class="reference internal" href="#usage">Usage</a></li>
50+
<li><a class="reference internal" href="#commands">Commands</a></li>
51+
<li><a class="reference internal" href="#options">All options and flags</a></li>
52+
<li><a class="reference internal" href="#best-practices">Best practices and safety</a></li>
53+
54+
</ul>
55+
</div>
56+
57+
<div id="overview">
58+
<span class="anchor" aria-hidden="true"></span>
59+
<h2>Overview</h2>
60+
<p>A <strong>Streams group</strong> 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.</p>
61+
62+
<div class="admonition warning">
63+
<strong>Use with care:</strong> Mutating operations (offset resets/deletes, group deletion) affect how applications will reprocess data when restarted. Always preview with <span class="kbd">--dry-run</span> before executing and ensure application instances are stopped/inactive and the group is empty before executing the command.
64+
</div>
65+
</div>
66+
67+
<div id="what-it-does">
68+
<span class="anchor" aria-hidden="true"></span>
69+
<h2>What the Streams Groups tool does</h2>
70+
<ul>
71+
<li><strong>List Streams groups</strong> across a cluster and display or filter by group state (Empty, Not Ready, Assigning, Reconciling, Stable, Dead).</li>
72+
73+
<li><strong>Describe a Streams group</strong> and show:
74+
<ul>
75+
<li>Group state, group epoch, target assignment epoch (with <code>--state</code>, <code>--verbose</code> for additional details).</li>
76+
<li>Per‑member info such as epochs, current vs target assignments, and whether a member still uses the classic protocol (with <code>--members</code> and <code>--verbose</code>).</li>
77+
<li>Input‑topic offsets and lag (with <code>--offsets</code>), to understand how far behind processing is.</li>
78+
</ul>
79+
</li>
80+
81+
<li><strong>Reset input‑topic offsets</strong> for a Streams group to control reprocessing boundaries using precise specifiers (earliest, latest, to‑offset, to‑datetime, by‑duration, shift‑by, from‑file). Requires <code>--dry-run</code> or <code>--execute</code> and inactive instances.</li>
82+
83+
<li><strong>Delete offsets</strong> for input topics to force re‑consumption on next start.</li>
84+
85+
<li><strong>Delete a Streams group</strong> to clean up broker‑side Streams metadata (offsets, topology, assignments). Optionally delete all, or a subset of, <strong>internal topics</strong> at the same time using <code>--internal-topics</code>.</li>
86+
</ul>
87+
</div>
88+
89+
<div id="usage">
90+
<span class="anchor" aria-hidden="true"></span>
91+
<h2>Usage</h2>
92+
<p>The script is located in <code>bin/kafka-streams-groups.sh</code> and connects to your cluster via <code>--bootstrap-server</code>. For secured clusters, pass AdminClient properties using <code>--command-config</code>.</p>
93+
94+
<pre><code>$ kafka-streams-groups.sh --bootstrap-server &lt;host:port&gt; [COMMAND] [OPTIONS]</code></pre>
95+
96+
<div class="admonition note">
97+
<strong>Note:</strong> <code>kafka-streams-groups.sh</code> 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.
98+
</div>
99+
</div>
100+
101+
<div id="commands">
102+
<span class="anchor" aria-hidden="true"></span>
103+
<h2>Commands</h2>
104+
105+
<div id="list">
106+
<h3>List Streams groups</h3>
107+
<p>Discovering groups</p>
108+
<pre><code># List all Streams groups
109+
kafka-streams-groups.sh --bootstrap-server localhost:9092 --list
110+
</code></pre>
111+
</div>
112+
113+
<div id="describe">
114+
<h3>Describe Streams groups</h3>
115+
<p>Inspecting group's state, members, and lag</p>
116+
<pre><code># Describe a group: state + epochs
117+
kafka-streams-groups.sh --bootstrap-server localhost:9092 \
118+
--describe --group my-streams-app --state --verbose
119+
120+
# Describe a group: members (assignments vs target, classic/streams)
121+
kafka-streams-groups.sh --bootstrap-server localhost:9092 \
122+
--describe --group my-streams-app --members --verbose
123+
124+
# Describe a group: input-topic offsets and lag
125+
kafka-streams-groups.sh --bootstrap-server localhost:9092 \
126+
--describe --group my-streams-app --offsets
127+
</code></pre>
128+
</div>
129+
130+
<div id="reset-offsets">
131+
<h3>Reset input-topic offsets (preview, then apply)</h3>
132+
<p>Ensure all application instances are stopped/inactive. Always preview changes with <code>--dry-run</code> before using <code>--execute</code>.</p>
133+
<pre><code># Preview resetting all input topics to a specific timestamp
134+
kafka-streams-groups.sh --bootstrap-server localhost:9092 \
135+
--group my-streams-app \
136+
--reset-offsets --all-input-topics --to-datetime 2025-01-31T23:57:00.000 \
137+
--dry-run
138+
139+
# Apply the reset
140+
kafka-streams-groups.sh --bootstrap-server localhost:9092 \
141+
--group my-streams-app \
142+
--reset-offsets --all-input-topics --to-datetime 2025-01-31T23:57:00.000 \
143+
--execute
144+
</code></pre>
145+
</div>
146+
147+
<div id="delete-offsets">
148+
<h3>Delete offsets to force re-consumption</h3>
149+
<p>Delete offsets for all or specific input topics to have the group re-read data on restart.</p>
150+
<pre><code># Delete offsets for all input topics (execute)
151+
kafka-streams-groups.sh --bootstrap-server localhost:9092 \
152+
--group my-streams-app \
153+
--delete-offsets --all-input-topics --execute
154+
155+
# Delete offsets for specific topics
156+
kafka-streams-groups.sh --bootstrap-server localhost:9092 \
157+
--group my-streams-app \
158+
--delete-offsets --topic input-a --topic input-b --execute
159+
</code></pre>
160+
</div>
161+
162+
<div id="delete-group">
163+
<h3>Delete a Streams group (cleanup)</h3>
164+
<p>Delete broker-side Streams metadata for a group and optionally remove a subset of internal topics.</p>
165+
<pre><code># Delete Streams group metadata
166+
kafka-streams-groups.sh --bootstrap-server localhost:9092 \
167+
--delete --group my-streams-app
168+
169+
# Delete a subset of internal topics alongside the group (use with care)
170+
kafka-streams-groups.sh --bootstrap-server localhost:9092 \
171+
--delete --group my-streams-app \
172+
--internal-topics my-app-repartition-0,my-app-changelog
173+
</code></pre>
174+
</div>
175+
</div>
176+
177+
<div id="options">
178+
<span class="anchor" aria-hidden="true"></span>
179+
<h2>All options and flags</h2>
180+
181+
<div class="options-core">
182+
<h3>Core actions</h3>
183+
<ul>
184+
<li><code>--list</code>: List Streams groups. Use <code>--state</code> to display/filter by state.</li>
185+
<li><code>--describe</code>: Describe a group selected by <code>--group</code>. Combine with:
186+
<ul>
187+
<li><code>--state</code> (group state and epochs), <code>--members</code> (members and assignments), <code>--offsets</code> (input and repartition topics offsets/lag).</li>
188+
<li><code>--verbose</code> for additional details (e.g., leader epochs where applicable).</li>
189+
</ul>
190+
</li>
191+
<li><code>--reset-offsets</code>: Reset input-topic offsets (one group at a time; instances should be inactive). Choose exactly one specifier:
192+
<ul>
193+
<li><code>--to-earliest</code>, <code>--to-latest</code>, <code>--to-current</code>, <code>--to-offset &lt;n&gt;</code></li>
194+
<li><code>--by-duration &lt;PnDTnHnMnS&gt;</code>, <code>--to-datetime &lt;YYYY-MM-DDTHH:mm:SS.sss&gt;</code></li>
195+
<li><code>--shift-by &lt;n&gt;</code> (±), <code>--from-file</code> (CSV)</li>
196+
</ul>
197+
Scope:
198+
<ul>
199+
<li><code>--all-input-topics</code> or one/more <code>--topic &lt;name&gt;</code>; some builds also support <code>--all-topics</code> (all input topics per broker topology metadata).</li>
200+
</ul>
201+
Safety:
202+
<ul>
203+
<li>Requires <code>--dry-run</code> or <code>--execute</code>.</li>
204+
</ul>
205+
</li>
206+
<li><code>--delete-offsets</code>: Delete offsets for <code>--all-input-topics</code>, specific <code>--topic</code> names, or <code>--from-file</code>.</li>
207+
<li><code>--delete</code>: Delete Streams group metadata; optionally pass <code>--internal-topics &lt;list&gt;</code> to delete a subset of internal topics.</li>
208+
</ul>
209+
</div>
210+
211+
<div class="options-common">
212+
<h3>Common flags</h3>
213+
<ul>
214+
<li><code>--group &lt;id&gt;</code>: Target Streams group (application.id).</li>
215+
<li><code>--all-groups</code>: Operate on all groups (allowed with <code>--delete</code>).</li>
216+
<li><code>--bootstrap-server &lt;host:port&gt;</code>: Broker(s) to connect to (required).</li>
217+
<li><code>--command-config &lt;file&gt;</code>: Properties for AdminClient (security, timeouts, etc.).</li>
218+
<li><code>--timeout &lt;ms&gt;</code>: Wait time for group stabilization in some operations (default: 5000ms).</li>
219+
<li><code>--dry-run</code>, <code>--execute</code>: Preview vs apply for mutating operations.</li>
220+
<li><code>--help</code>, <code>--version</code>, <code>--verbose</code>: Usage, version, verbosity.</li>
221+
</ul>
222+
</div>
223+
</div>
224+
225+
<div id="best-practices">
226+
<span class="anchor" aria-hidden="true"></span>
227+
<h2>Best practices and safety</h2>
228+
<ul>
229+
<li>Preview changes with <code>--dry-run</code> to verify topic scope and impact before <code>--execute</code>.</li>
230+
<li>Use <code>--internal-topics</code> carefully: deleting internal topics removes state backing topics; only do this when you intend to rebuild state from input topics.</li>
231+
</ul>
232+
</div>
233+
234+
<div class="footer">
235+
<p>This page documents <code>kafka-streams-groups.sh</code> capabilities for Streams groups as defined by KIP‑1071 and implemented in Apache Kafka.</p>
236+
</div>
237+
</div>
238+
</div>
239+
</script>
240+
<!--#include virtual="../../../includes/_header.htm" -->
241+
<!--#include virtual="../../../includes/_top.htm" -->
242+
<div class="content documentation ">
243+
<!--#include virtual="../../../includes/_nav.htm" -->
244+
<div class="right">
245+
<!--//#include virtual="../../../includes/_docs_banner.htm" -->
246+
<ul class="breadcrumbs">
247+
<li><a href="/documentation">Documentation</a></li>
248+
<li><a href="/documentation/streams">Kafka Streams</a></li>
249+
<li><a href="/documentation/streams/developer-guide/">Developer Guide</a></li>
250+
</ul>
251+
<div class="p-content"></div>
252+
</div>
253+
</div>
254+
<!--#include virtual="../../../includes/_footer.htm" -->
255+
<script>
256+
$(function() {
257+
// Show selected style on nav item
258+
$('.b-nav__streams').addClass('selected');
259+
260+
//sticky secondary nav
261+
var $navbar = $(".sub-nav-sticky"),
262+
y_pos = $navbar.offset().top,
263+
height = $navbar.height();
264+
265+
$(window).scroll(function() {
266+
var scrollTop = $(window).scrollTop();
267+
268+
if (scrollTop > y_pos - height) {
269+
$navbar.addClass("navbar-fixed")
270+
} else if (scrollTop <= y_pos) {
271+
$navbar.removeClass("navbar-fixed")
272+
}
273+
});
274+
275+
// Display docs subnav items
276+
$('.b-nav__docs').parent().toggleClass('nav__item__with__subs--expanded');
277+
});
278+
</script>

0 commit comments

Comments
 (0)