-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DOC-31 add rpk tutorial #935
Merged
Merged
Changes from 14 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
ea028a2
add rpk tutorial
Deflaimun 2c6b2ce
remove control c
Deflaimun 0d07926
adjut from bash to json
Deflaimun bb32770
reorganize note
Deflaimun ee5a6ea
add links and next steps
Deflaimun b47f5ed
update per style guide
Deflaimun 2d592f2
change page name. fix some commands
Deflaimun 5acaa5b
Apply suggestions from code review
Deflaimun 0f987b9
Update modules/get-started/pages/rpk-first-steps.adoc
Deflaimun d86e44c
update with latest doc reviews
Deflaimun 19fe0ee
add next steps
Deflaimun 23cedcc
code review points
Deflaimun 4dfd97a
fix lists
Deflaimun 8757747
Apply suggestions from code review
Deflaimun 6b5a61d
add pre-reqs
Deflaimun 76ad260
Fix link
Deflaimun a322e8b
remove link to rp quickstart
Deflaimun File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,244 @@ | ||
= Redpanda CLI Quickstart | ||
:page-categories: rpk | ||
:description: pass:q[Quickly become familiar with `rpk` commands for basic Redpanda tasks, including creating, producing to, describing, and deleting topics, as well as consuming records and managing consumer groups.] | ||
// Do not put page aliases in the single-sourced content | ||
// tag::single-source[] | ||
|
||
This guide shows how to run the Redpanda CLI, `rpk`, for basic Redpanda tasks, including creating, producing to, describing, and deleting topics, as well as consuming records and managing consumer groups. Follow these examples to quickly become familiar with `rpk` commands. | ||
|
||
Consider creating an rpk profile to simplify your development experience with multiple Redpanda clusters by saving and reusing configurations for different clusters. For more information, see xref:get-started:config-rpk-profile.adoc#about-rpk-profiles[About rpk profiles]. | ||
|
||
== Create a topic | ||
|
||
To start streaming data, first create a topic as the destination for your records: | ||
|
||
[source,bash] | ||
---- | ||
rpk topic create tutorial | ||
---- | ||
|
||
Output: | ||
[source,bash] | ||
---- | ||
TOPIC STATUS | ||
tutorial OK | ||
---- | ||
|
||
See xref:reference:rpk/rpk-topic/rpk-topic-create.adoc[]. | ||
|
||
== Produce records to a topic | ||
|
||
Produce records to the topic. Downstream consumers will then be able to read these records. To exit the producer session, press `Ctrl+C`: | ||
|
||
[source,bash] | ||
---- | ||
rpk topic produce tutorial | ||
---- | ||
|
||
Additional input: | ||
[source,bash] | ||
---- | ||
hello | ||
world | ||
---- | ||
|
||
Output: | ||
[source,bash] | ||
---- | ||
Produced to partition 0 at offset 0 with timestamp 1734640650348. | ||
Produced to partition 0 at offset 1 with timestamp 1734640653558. | ||
---- | ||
|
||
See xref:reference:rpk/rpk-topic/rpk-topic-produce.adoc[]. | ||
|
||
== Get a description of a topic | ||
|
||
Check the topic’s configuration and status to ensure that it’s ready for use: | ||
|
||
[source,bash] | ||
---- | ||
rpk topic describe tutorial | ||
---- | ||
|
||
Output: | ||
[source,bash] | ||
---- | ||
SUMMARY | ||
======= | ||
NAME tutorial | ||
PARTITIONS 1 | ||
REPLICAS 1 | ||
|
||
CONFIGS | ||
======= | ||
KEY VALUE SOURCE | ||
cleanup.policy delete DEFAULT_CONFIG | ||
compression.type producer DEFAULT_CONFIG | ||
delete.retention.ms -1 DEFAULT_CONFIG | ||
flush.bytes 262144 DEFAULT_CONFIG | ||
flush.ms 100 DEFAULT_CONFIG | ||
initial.retention.local.target.bytes -1 DEFAULT_CONFIG | ||
initial.retention.local.target.ms -1 DEFAULT_CONFIG | ||
max.message.bytes 1048576 DEFAULT_CONFIG | ||
message.timestamp.type CreateTime DEFAULT_CONFIG | ||
redpanda.iceberg.delete true DEFAULT_CONFIG | ||
redpanda.iceberg.mode disabled DEFAULT_CONFIG | ||
redpanda.leaders.preference none DEFAULT_CONFIG | ||
redpanda.remote.delete true DEFAULT_CONFIG | ||
redpanda.remote.read false DEFAULT_CONFIG | ||
redpanda.remote.write false DEFAULT_CONFIG | ||
retention.bytes -1 DEFAULT_CONFIG | ||
retention.local.target.bytes -1 DEFAULT_CONFIG | ||
retention.local.target.ms 86400000 DEFAULT_CONFIG | ||
retention.ms 604800000 DEFAULT_CONFIG | ||
segment.bytes 134217728 DEFAULT_CONFIG | ||
segment.ms 1209600000 DEFAULT_CONFIG | ||
write.caching true DEFAULT_CONFIG | ||
---- | ||
|
||
See xref:reference:rpk/rpk-topic/rpk-topic-describe.adoc[]. | ||
|
||
== Consume records from a topic | ||
|
||
Consume records from the topic: | ||
|
||
[source,bash] | ||
---- | ||
rpk topic consume tutorial | ||
---- | ||
|
||
Output: | ||
[source,json] | ||
---- | ||
{ "topic": "tutorial", "value": "hello", "timestamp": 1678807229837, "partition": 0, "offset": 0 } | ||
{ "topic": "tutorial", "value": "world", "timestamp": 1678807232413, "partition": 0, "offset": 1 } | ||
---- | ||
|
||
Consume from an offset, where `2` is not inclusive: | ||
[source,bash] | ||
---- | ||
rpk topic consume tutorial --offset 0:2 | ||
---- | ||
Output: | ||
[source,json] | ||
---- | ||
{ "topic": "tutorial", "value": "hello", "timestamp": 1678807229837, "partition": 0, "offset": 0 } | ||
{ "topic": "tutorial", "value": "world", "timestamp": 1678807232413, "partition": 0, "offset": 1 } | ||
---- | ||
|
||
See xref:reference:rpk/rpk-topic/rpk-topic-consume.adoc[]. | ||
|
||
== Create a consumer group and consume topics | ||
|
||
Organize consumers into groups to share workloads and balance consumption: | ||
|
||
[source,bash] | ||
---- | ||
rpk topic consume tutorial --group tutorial-group | ||
---- | ||
|
||
NOTE: The consumer group is created when you start consuming from the topic. | ||
|
||
Output: | ||
[source,json] | ||
---- | ||
{ | ||
"topic": "tutorial", | ||
"value": "hello", | ||
"timestamp": 1734640650348, | ||
"partition": 0, | ||
"offset": 0 | ||
} | ||
{ | ||
"topic": "tutorial", | ||
"value": "world", | ||
"timestamp": 1734640653558, | ||
"partition": 0, | ||
"offset": 1 | ||
} | ||
---- | ||
|
||
See xref:reference:rpk/rpk-topic/rpk-topic-consume.adoc[]. | ||
|
||
== List all consumer groups | ||
|
||
List available consumer groups in your cluster: | ||
|
||
[source,bash] | ||
---- | ||
rpk group list | ||
---- | ||
|
||
Output: | ||
[source,bash] | ||
---- | ||
BROKER GROUP STATE | ||
0 tutorial-group Empty | ||
---- | ||
|
||
See xref:reference:rpk/rpk-group/rpk-group-list.adoc[]. | ||
|
||
== Get a description of a consumer group | ||
|
||
View details about the consumer group’s state, coordinator, members, and offsets: | ||
|
||
[source,bash] | ||
---- | ||
rpk group describe tutorial-group | ||
---- | ||
Output: | ||
[source,bash] | ||
---- | ||
GROUP tutorial-group | ||
COORDINATOR 0 | ||
STATE Empty | ||
BALANCER | ||
MEMBERS 0 | ||
TOTAL-LAG 0 | ||
|
||
TOPIC PARTITION CURRENT-OFFSET LOG-START-OFFSET LOG-END-OFFSET LAG MEMBER-ID CLIENT-ID HOST | ||
tutorial 0 2 0 2 0 | ||
---- | ||
|
||
See xref:reference:rpk/rpk-group/rpk-group-describe.adoc[]. | ||
|
||
== Delete a consumer group | ||
|
||
Clean up by removing the `tutorial-group` consumer group: | ||
|
||
[source,bash] | ||
---- | ||
rpk group delete tutorial-group | ||
---- | ||
Output: | ||
[source,bash] | ||
---- | ||
GROUP STATUS | ||
tutorial-group OK | ||
---- | ||
|
||
See xref:reference:rpk/rpk-group/rpk-group-delete.adoc[]. | ||
|
||
== Delete a topic | ||
|
||
Clean up by removing the `tutorial` topic: | ||
|
||
[source,bash] | ||
---- | ||
rpk topic delete tutorial | ||
---- | ||
Output: | ||
[source,bash] | ||
---- | ||
TOPIC STATUS | ||
tutorial OK | ||
---- | ||
|
||
See xref:reference:rpk/rpk-topic/rpk-topic-delete.adoc[]. | ||
|
||
== Next steps | ||
|
||
* To generate a profile to save and reuse configurations for different Redpanda clusters, see xref:get-started:config-rpk-profile.adoc#about-rpk-profiles[About rpk profiles]. | ||
* For the complete list of `rpk` commands and their syntax, see the xref:reference:rpk/index.adoc[rpk Command Reference]. | ||
|
||
// end::single-source[] |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The intro should say something about make sure you have rpk installed, or a prereq to install rpk with link: https://deploy-preview-935--redpanda-docs-preview.netlify.app/current/get-started/rpk-install/