LinuxCommandLibrary

rpk

Manage Redpanda streaming platform

TLDR

Create a new topic

$ rpk topic create [topic_name]
copy

Produce a message to a topic
$ rpk topic produce [topic_name]
copy

Consume messages from multiple topics
$ rpk topic consume [topic_name1 topic_name2 ...]
copy

List all topics
$ rpk topic list
copy

Display cluster information
$ rpk cluster info
copy

List all consumer groups
$ rpk group list
copy

Describe a consumer group with lag information
$ rpk group describe [group_name]
copy

Display version
$ rpk version
copy

SYNOPSIS

rpk [global-options] command [command-options] [arguments]

Common top-level commands include:

rpk cluster ...
rpk topic ...
rpk group ...
rpk acl ...
rpk config ...
rpk profile ...
rpk container ...
rpk producer ...
rpk consumer ...

PARAMETERS

--help, -h
    Show help for the command or subcommand.

--version
    Show the rpk client version.

--config <path>
    Path to the rpk configuration file (e.g., rpk.yaml). Defaults to ~/.config/rpk/rpk.yaml.

--profile <name>
    The rpk profile to use from the configuration file, allowing for easy switching between different cluster connections.

--api-urls <urls>
    Comma-separated list of URLs to the Redpanda Admin API (e.g., http://localhost:9644), used for administrative tasks.

--brokers <urls>
    Comma-separated list of URLs to the Redpanda Kafka API (e.g., localhost:9092), used for producing/consuming messages and Kafka-compatible operations.

--user <username>
    Username for SASL authentication when connecting to brokers.

--password <password>
    Password for SASL authentication when connecting to brokers.

--sasl-mechanism <mechanism>
    SASL mechanism to use (e.g., SCRAM-SHA-256, PLAIN).

--tls-enabled
    Enable TLS encryption when connecting to brokers.

--tls-truststore <path>
    Path to the CA certificate file for TLS validation.

--verbose
    Enable verbose output, providing more detailed information during command execution.

--debug
    Enable debug logging, which outputs extensive diagnostic information.

DESCRIPTION

The rpk command is the primary command-line interface for interacting with Redpanda, a Kafka-compatible, C++ based streaming data platform designed for high performance and low latency. It provides comprehensive tools for managing Redpanda clusters, including administering topics, consumer groups, users, and Access Control Lists (ACLs). rpk allows developers and operators to perform tasks such as creating and deleting topics, producing and consuming messages, inspecting cluster health, and managing cluster configurations. It's an indispensable tool for development, debugging, and day-to-day operations of Redpanda deployments, whether on bare metal, virtual machines, or Kubernetes. Its hierarchical subcommand structure makes it versatile for a wide range of administrative and data-centric tasks, simplifying complex streaming data operations.

CAVEATS

  • Requires a running Redpanda cluster or a containerized Redpanda instance that is network-reachable from where rpk is executed.
  • Operations like topic creation or user management require appropriate administrative privileges (ACLs) configured within the Redpanda cluster.
  • Network connectivity between the rpk client and the Redpanda cluster's Admin API and Kafka API ports is essential for all operations.
  • The --api-urls and --brokers flags, or a correctly configured rpk.yaml file, are crucial for rpk to establish connections to the cluster.

SUBCOMMANDS OVERVIEW

rpk utilizes a rich subcommand structure to organize its functionalities. For instance, `rpk topic` handles all topic-related operations (create, delete, list, describe), `rpk cluster` provides cluster-wide information and management (health, config), and `rpk acl` manages access control lists for users and resources. Each subcommand often has its own set of options and sub-subcommands, allowing for granular control over Redpanda resources and their attributes.

CONFIGURATION

rpk can be configured via a YAML file, typically named rpk.yaml, located in ~/.config/rpk/ or specified by the --config flag. This file allows users to define connection parameters, authentication credentials, and profiles for different Redpanda clusters, simplifying command invocation by avoiding repetitive flag inputs. Environment variables can also be used to override configuration settings, providing flexibility in deployment environments.

HISTORY

The rpk command was developed by Vectorized (now Redpanda Data) as the native command-line interface for the Redpanda streaming data platform. Redpanda was conceived as a high-performance, C++ alternative to Apache Kafka, prioritizing ease of operations and enterprise-grade features. From its inception, rpk has been an integral part of the Redpanda ecosystem, designed to provide a comprehensive and intuitive way to manage and interact with Redpanda clusters. Its development has closely tracked the evolution of Redpanda itself, incorporating new features and optimizations to simplify cluster administration, development workflows, and debugging processes for users.

SEE ALSO

kafka-topics.sh (Kafka CLI for topic management), kafka-consumer-groups.sh (Kafka CLI for consumer group management), kubectl(1) (Kubernetes command-line tool, relevant when Redpanda is deployed on Kubernetes), docker(1) (Container management tool, relevant for `rpk container` commands)

Copied to clipboard