26.2. Downgrading KRaft-based Kafka clusters and client applications
Downgrade a KRaft-based Streams for Apache Kafka cluster to an earlier version. When downgrading a KRaft-based Streams for Apache Kafka cluster to a lower version, like moving from 3.7.0 to 3.6.0, ensure that the metadata version used by the Kafka cluster is a version supported by the Kafka version you want to downgrade to. The metadata version for the Kafka version you are downgrading from must not be higher than the version you are downgrading to.
Consult the Apache Kafka documentation for information regarding the support and limitations associated with KRaft-based downgrades.
Prerequisites
- The Cluster Operator is up and running.
Before you downgrade the Streams for Apache Kafka cluster, check the following for the
Kafkaresource:-
The
Kafkacustom resource does not contain options that are not supported by the Kafka version being downgraded to. -
spec.kafka.metadataVersionis set to a version that is supported by the Kafka version being downgraded to.
-
The
Procedure
Update the Kafka cluster configuration.
oc edit kafka <kafka_configuration_file>Change the
metadataVersionversion to a version supported by the Kafka version you are downgrading to; leave theKafka.spec.kafka.versionunchanged at the current Kafka version.For example, if downgrading from Kafka 3.7.0 to 3.6.0:
apiVersion: kafka.strimzi.io/v1beta2 kind: Kafka metadata: name: my-cluster spec: kafka: replicas: 3 metadataVersion: 3.6-IV21 version: 3.7.02 # ...注意The value of
metadataVersionmust be a string to prevent it from being interpreted as a floating point number.-
Save the change, and wait for Cluster Operator to update
.status.kafkaMetadataVersionfor theKafkaresource. Change the
Kafka.spec.kafka.versionto the previous version.For example, if downgrading from Kafka 3.7.0 to 3.6.0:
apiVersion: kafka.strimzi.io/v1beta2 kind: Kafka metadata: name: my-cluster spec: kafka: replicas: 3 metadataVersion: 3.6-IV21 version: 3.6.02 # ...If the image for the Kafka version is different from the image defined in
STRIMZI_KAFKA_IMAGESfor the Cluster Operator, updateKafka.spec.kafka.image.Wait for the Cluster Operator to update the cluster.
You can check the downgrade has completed successfully from the status of the
Kafkaresource.Downgrade all client applications (consumers) to use the previous version of the client binaries.
The Kafka cluster and clients are now using the previous Kafka version.