rpk topic

Manage Kafka topics, including creating, deleting, and configuring topics. Also includes commands for producing and consuming messages.

Usage

rpk topic [flags]

Subcommands

Command Description

rpk topic add-partitions

Add partitions to existing topics.

rpk topic alter-config

Set, delete, add, and remove key/value configs for a topic. This command allows you to incrementally alter the configuration for multiple topics at a time.

rpk topic analyze

Analyze topics. This command consumes records from the specified topics to determine topic characteristics such as batch rate and batch size.

rpk topic consume

Consume records from topics. Consuming records reads from any amount of input topics, formats each record according to --format, and prints them to STDOUT.

rpk topic create

Create one or more Kafka topics with configurable partitions, replication factor, and topic-level settings.

rpk topic delete

Delete one or more Kafka topics. This operation is irreversible and removes all data in the topics.

rpk topic describe

Print detailed information about topics. There are three potential views: a summary of the topic, the topic configurations, and a detailed partitions section.

rpk topic describe-storage

Describe the cloud storage status of a topic, including storage mode, offset availability, segment sizes, and synchronization state.

rpk topic list

List topics, optionally listing specific topics. This command lists all topics that you have access to by default.

rpk topic produce

Produce records to a topic. Producing records reads from STDIN, parses input according to --format, and produces records to Redpanda.

rpk topic trim-prefix

Trim records from topics by setting the LogStartOffset for partitions to the requested offset. All segments whose base offset is less than the requested offset are deleted, and any records within the segment before the requested offset can no longer be read.

Global flags

Value Type Description

--config

string

Redpanda or rpk config file; default search paths are ~/.config/rpk/rpk.yaml, $PWD/redpanda.yaml, and /etc/redpanda/redpanda.yaml.

-X, --config-opt

stringArray

Override rpk configuration settings; -X help for detail or -X list for terser detail.

--ignore-profile

bool

Ignore rpk.yaml and redpanda.yaml; use default settings.

--profile

string

rpk profile to use.

-v, --verbose

bool

Enable verbose logging.