rpk topic create
Create topics.
Topics created with this command will have the same number of partitions, replication factor, and key/value configs.
Flags
| Value | Type | Description |
|---|---|---|
|
- |
Dry run: validate the topic creation request; do not create topics. |
|
- |
Help for create. |
|
- |
Only create the topic if it does not already exist. |
|
int32 |
Number of partitions to create per topic; |
|
int16 |
Replication factor (must be odd); -1 defaults to the cluster’s default_topic_replications (default -1). In Redpanda Cloud, the replication factor is set to 3. |
|
string (repeatable) |
Topic properties can be set by using |
|
string |
Redpanda or |
|
stringArray |
Override |
|
string |
Profile to use. See |
|
- |
Enable verbose logging. |
|
Starting in Redpanda v25.3, several topic properties support enhanced tristate behavior. Properties like |
Examples
Create a topic
Create a topic named my-topic:
rpk topic create my-topic
Output:
TOPIC STATUS
my-topic OK
Create multiple topics
Create two topics (my-topic-1, my-topic-2) at the same time with one command:
rpk topic create my-topic-1 my-topic-2
Output:
TOPIC STATUS
my-topic-1 OK
my-topic-2 OK
Set a topic property
Create topic my-topic-3 with the topic property cleanup.policy=compact:
rpk topic create my-topic-3 -c cleanup.policy=compact
Output:
TOPIC STATUS
my-topic-3 OK
Create topic with multiple partitions
Create topic my-topic-4 with 20 partitions:
rpk topic create my-topic-4 -p 20
Output:
TOPIC STATUS
my-topic-4 OK