Flushing Kafka topics

You must have kafka to avoid issues related to restore the specified flushed out topic.

Procedure

  1. Run the following command to get Kafka topics.
    oc get kafkatopic |grep file-scan-topic
    Example output:
    File-scan-topic			isd	10	1	True
  2. Run the following command to back up Kafka topic.
    oc get kafkatopic file-scan-topic -o yaml
    Example output:
    apiVersion: kafka.strimzi.io/v1beta2
    kind: KafkaTopic
    metadata:
      resourceVersion: '15457887'
      name: file-scan-topic
      namespace: ibm-data-cataloging
      ownerReferences:
        - apiVersion: spectrum-discover.ibm.com/v1alpha1
          kind: SpectrumDiscover
          name: discover-instance
          uid: 52fd9b6c-0823-4f88-b43d-525dd6992b1b
      labels:
        strimzi.io/cluster: isd-ssl
    spec:
      partitions: 10
      replicas: 1
    
  3. Run the following command to delete the Kafka topic to flush the data.
    oc delete kafkatopic file-scan-topic
  4. Run the following command to apply the backed-up YAML file on the cluster to recreate the topic until it deletes the Kafka topic.
    oc apply -f <topic.yaml>
    Example output:
    apiVersion: kafka.strimzi.io/v1beta2
    kind: KafkaTopic
    metadata:
      resourceVersion: '15457887'
      name: file-scan-topic
      namespace: ibm-data-cataloging
      ownerReferences:
        - apiVersion: spectrum-discover.ibm.com/v1alpha1
          kind: SpectrumDiscover
          name: discover-instance
          uid: 52fd9b6c-0823-4f88-b43d-525dd6992b1b
      labels:
        strimzi.io/cluster: isd-ssl
    spec:
      partitions: 10
      replicas: 1