-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3c79109
commit 5dc5105
Showing
8 changed files
with
348 additions
and
273 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,71 @@ | ||
--- | ||
title: Creating an Apache Kafka® topic | ||
title: Create an Apache Kafka® topic | ||
--- | ||
import Tabs from '@theme/Tabs'; | ||
import TabItem from '@theme/TabItem'; | ||
|
||
When working with Apache Kafka®, while it is possible to configure it to | ||
[automatically create topics when a message is produced to a non-existent topic](create-topics-automatically), it is generally recommended to create topics beforehand, | ||
especially in production environments. This approach offers several | ||
advantages: | ||
When working with Apache Kafka®, while it is possible to configure it to [automatically create topics when a message is produced to a non-existent topic](create-topics-automatically), it is generally recommended to create topics beforehand, | ||
especially in production environments. | ||
|
||
- It allows you to define specific topic settings, such as the number | ||
of partitions, replication factor, retention period, and more. | ||
- It helps prevent the generation of incorrect topics due to typos or | ||
This approach offers several advantages: | ||
|
||
- You can define specific topic settings, such as the number of partitions, | ||
replication factor, retention period, and more. | ||
- It helps prevent the creation of incorrect topics due to typos or | ||
other mistakes. | ||
|
||
## Create an Apache Kafka® topic | ||
|
||
To create a topic using the [Aiven | ||
Console](https://console.aiven.io/), follow these steps: | ||
|
||
1. Log in to [Aiven Console](https://console.aiven.io/) and select the | ||
Aiven for Apache Kafka® service where you want to create the topic. | ||
2. From the left sidebar, select **Topics**. | ||
3. Select **Create topic** to create a topic and enter a name for | ||
the topic. | ||
4. If required, set the advanced configuration option to **Yes**. | ||
5. In the **Topic advanced configuration** section, you can set | ||
properties such as the replication factor, number of partitions, and | ||
other settings. These settings can be modified later if needed. | ||
6. Select **Create topic**. The new topic will be visible immediately, | ||
but may take a few minutes before you can update its settings. | ||
|
||
You can also use the | ||
[topic-create](/docs/tools/cli/service/topic#avn_cli_service_topic_create) command to create a topic using | ||
[Aiven CLI](/docs/tools/cli). | ||
:::note | ||
When tiered storage is activated for your Aiven for Apache Kafka service, all new topics | ||
will have tiered storage enabled by default. | ||
[Learn more about tiered storage](/docs/products/kafka/concepts/kafka-tiered-storage). | ||
::: | ||
|
||
## Steps to create an Apache Kafka® topic | ||
|
||
<Tabs groupId="setup"> | ||
<TabItem value="Console" label="Console" default> | ||
|
||
1. Log in to the [Aiven Console](https://console.aiven.io/) and select the Aiven for | ||
Apache Kafka® service to create the topic. | ||
1. Click **Topics** in the sidebar. | ||
1. Click **Create topic** and enter a name for the topic. | ||
1. If required, set the advanced configuration option to **Yes**. | ||
1. In the **Topic advanced configuration** section, set properties such as the | ||
replication factor, number of partitions, and other settings. These settings can be | ||
modified later if needed. | ||
1. Click **Create topic**. The new topic will be visible immediately, but it may take a | ||
few minutes before you can update its settings. | ||
|
||
</TabItem> | ||
<TabItem value="CLI" label="CLI"> | ||
|
||
1. Determine the topic specifications, including the number of partitions, | ||
replication factor, and other settings. | ||
|
||
1. Run the following command to create a topic named `exampleTopic`: | ||
|
||
```bash | ||
avn service topic-create \ | ||
--project demo-kafka-project \ | ||
--service-name demo-kafka-service \ | ||
--topic exampleTopic \ | ||
--partitions 2 \ | ||
--replication 2 | ||
``` | ||
|
||
Parameters: | ||
|
||
- `avn service topic-create`: Command to create a topic. | ||
- `--project demo-kafka-project`: Specifies the project name. | ||
- `--service-name demo-kafka-service`: Specifies the Aiven for Apache Kafka® service name. | ||
- `--topic exampleTopic`: Specifies the name of the topic to create. | ||
- `--partitions 2`: Specifies the number of partitions for the topic. | ||
- `--replication 2`: Specifies the replication factor for the topic. | ||
|
||
</TabItem> | ||
</Tabs> | ||
|
||
## Related pages | ||
|
||
- [Manage Aiven for Apache Kafka® topics via CLI](/docs/tools/cli/service/topic#avn_cli_service_topic_create) | ||
- [Create Apache Kafka® topics automatically](/docs/products/kafka/howto/create-topics-automatically) |
Oops, something went wrong.