このコンテンツは選択した言語では利用できません。
Chapter 5. Using the Topic Operator
5.1. Topic Operator usage recommendations リンクのコピーリンクがクリップボードにコピーされました!
-
Be consistent and always operate on
KafkaTopic
resources or always operate on topics directly. Avoid routinely using both methods for a given topic. When creating a
KafkaTopic
resource:- Remember that the name cannot be changed later.
-
Choose a name for the
KafkaTopic
resource that reflects the name of the topic it describes. -
Ideally the
KafkaTopic.metadata.name
should be the same as itsspec.topicName
. To do this, the topic name will have to be a valid Kubernetes resource name.
When creating a topic:
- Remember that the name cannot be changed later.
-
It is best to use a name that is a valid Kubernetes resource name, otherwise the operator will have to modify the name when creating the corresponding
KafkaTopic
.
5.2. Creating a topic リンクのコピーリンクがクリップボードにコピーされました!
This procedure describes how to create a Kafka topic using a KafkaTopic
OpenShift resource.
Prerequisites
- A running Kafka cluster.
- A running Topic Operator.
Procedure
Prepare a file containing the
KafkaTopic
to be createdAn example
KafkaTopic
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteIt is recommended to use a topic name that is a valid OpenShift resource name. Doing this means that it is not necessary to set the
KafkaTopic.spec.topicName
property. In any case theKafkaTopic.spec.topicName
cannot be changed after creation.NoteThe
KafkaTopic.spec.partitions
cannot be decreased.Create the
KafkaTopic
resource in OpenShift.On OpenShift this can be done using
oc apply
:oc apply -f your-file
oc apply -f your-file
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Additional resources
-
For more information about the schema for
KafkaTopics
, seeKafkaTopic
schema reference. - For more information about deploying a Kafka cluster using the Cluster Operator, see Section 2.2, “Cluster Operator”.
- For more information about deploying the Topic Operator using the Cluster Operator, see Section 2.7.2, “Deploying the Topic Operator using the Cluster Operator”.
- For more information about deploying the standalone Topic Operator, see Section 4.2.5, “Deploying the standalone Topic Operator”.
5.3. Changing a topic リンクのコピーリンクがクリップボードにコピーされました!
This procedure describes how to change the configuration of an existing Kafka topic by using a KafkaTopic
OpenShift resource.
Prerequisites
- A running Kafka cluster.
- A running Topic Operator.
-
An existing
KafkaTopic
to be changed.
Procedure
Prepare a file containing the desired
KafkaTopic
An example
KafkaTopic
Copy to Clipboard Copied! Toggle word wrap Toggle overflow TipYou can get the current version of the resource using
oc get kafkatopic orders -o yaml
.NoteChanging topic names using the
KafkaTopic.spec.topicName
variable and decreasing partition size using theKafkaTopic.spec.partitions
variable is not supported by Kafka.ImportantIncreasing
spec.partitions
for topics with keys will change how records are partitioned, which can be particularly problematic when the topic uses semantic partitioning.Update the
KafkaTopic
resource in OpenShift.On OpenShift this can be done using
oc apply
:oc apply -f your-file
oc apply -f your-file
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Additional resources
-
For more information about the schema for
KafkaTopics
, seeKafkaTopic
schema reference. - For more information about deploying a Kafka cluster, see Section 2.2, “Cluster Operator”.
- For more information about deploying the Topic Operator using the Cluster Operator, see Section 2.7.2, “Deploying the Topic Operator using the Cluster Operator”.
- For more information about creating a topic using the Topic Operator, see Section 5.2, “Creating a topic”.
5.4. Deleting a topic リンクのコピーリンクがクリップボードにコピーされました!
This procedure describes how to delete a Kafka topic using a KafkaTopic
OpenShift resource.
Prerequisites
- A running Kafka cluster.
- A running Topic Operator.
-
An existing
KafkaTopic
to be deleted.
Procedure
Delete the
KafkaTopic
resource in OpenShift.On OpenShift this can be done using
oc
:oc delete kafkatopic your-topic-name
oc delete kafkatopic your-topic-name
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteWhether the topic can actually be deleted depends on the value of the
delete.topic.enable
Kafka broker configuration, specified in theKafka.spec.kafka.config
property.
Additional resources
- For more information about deploying a Kafka cluster using the Cluster Operator, see Section 2.2, “Cluster Operator”.
- For more information about deploying the Topic Operator using the Cluster Operator, see Section 2.7.2, “Deploying the Topic Operator using the Cluster Operator”.
- For more information about creating a topic using the Topic Operator, see Section 5.2, “Creating a topic”.