-
Notifications
You must be signed in to change notification settings - Fork 35
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
base: main
Are you sure you want to change the base?
Changes from all commits
def6bb5
879eef4
c5252dd
7927cef
83dae87
b7f0472
2a46e0d
413e13a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,240 @@ | ||||||
= Quickstart with rpk | ||||||
:page-categories: rpk | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Needs a |
||||||
// 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. | ||||||
|
||||||
== 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. | ||||||
|
||||||
[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. | ||||||
---- | ||||||
|
||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should you say you need to |
||||||
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 consume from the topic. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Probably better, wdyt? as |
||||||
|
||||||
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 | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you don't merge this with the rpk Profile page, then add a link to it here. |
||||||
|
||||||
For the complete list of `rpk` commands and their syntax, see the xref:reference:rpk/index.adoc[rpk reference]. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It appears in the navtree as Reference > rpk Commands |
||||||
|
||||||
// end::single-source[] |
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.
You could consider moving it this page into the Quickstart section in the left nav, and just have links to it in the pages in the Redpanda CLI section.
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.
If you do move it there, I'd probably rename the title to something like Redpanda CLI Quickstart and page to
rpk-quickstart.adoc
.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.
Or Redpanda rpk Quickstart?