Kafka migration to KRaft

Overview

By default, in ADCM for an ADS cluster, metadata management of the Kafka service is performed via the ZooKeeper service, which provides quorum operation based on the ZAB consensus algorithm.

Also, Kafka service can be installed immediately in KRaft mode to use the Raft consensus algorithm.

For clusters where Kafka service is already used together with ZooKeeper, migration to KRaft mode can be performed.

CAUTION
  • Kafka migration to KRaft mode is available starting from the 3.7.2.1.b1 ADS version.

  • The KRaft protocol for Kafka is in technical preview and is not recommended for use in a production environment. Arenadata encourages you to explore this feature in non-production environments and provide feedback on your experience as appropriate.

  • There is no possibility of reverse migration from KRaft to ZooKeeper.

The migration process is semi-automated and divided into steps:

Enabling and disabling migration mode is performed using the Kafka service actions in the ADCM interface, the start time of each of them is determined by the user.

Prepare for migration

Check a cluster status

Before enabling migration, check the values of the Kafka quorum solution and KRaft migration mode parameters on the Kafka service configuration page.

Parameters before starting migration to KRaft
Parameters before starting migration to KRaft

Below are instructions for actions with different parameter values.

Kafka quorum solution KRaft migration mode Directions for action

KRaft

false

The cluster is already in KRaft quorum mode.

No further action is required

ZooKeeper

false

The cluster is in ZooKeeper quorum mode.

The cluster is allowed to enable KRaft migration mode.

Before enabling migration mode, install the Kafka Controller component

ZooKeeper

true

Migration mode is already enabled.

Install Kafka controllers

To switch to KRaft mode in a cluster, a new component must be installed for the Kafka service — Kafka Controller. The recommended number of Kafka Controller component instances per cluster is 3.

To add instances of a new Kafka service component in the ADCM interface, run the Add/Remove components action by clicking actions default dark actions default light in the Actions column.

Installing the Kafka Controller component
Installing the Kafka Controller component

Next, in the action confirmation form, select the parameter values ​​and hosts for installing instances of the new component.

Selecting hosts for the Kafka Controller component
Selecting hosts for the Kafka Controller component

After the action is successfully completed, the new component is displayed on the component configuration page.

Kafka Controller сomponent
Kafka Controller сomponent

Enable migration mode

To enable migration mode, ensure the following conditions are met:

  • State of the Kafka service parameters:

    • Kafka quorum solution value is ZooKeeper;

    • KRaft migration mode value is false.

  • The Kafka service has the Kafka Controller component installed as described above.

To start migration mode for the Kafka service in the ADCM interface, run the KRaft migration stage 1 action by clicking actions default dark actions default light in the Actions column.

Starting migration mode in Kafka
Starting migration mode in Kafka

The process of enabling migration mode automatically starts, including the following:

  • configuring Kafka controllers to enable and perform metadata migration from ZooKeeper;

  • configuring Kafka brokers to enable migration mode and interact with the KRaft quorum (while the brokers are still configured to work with ZooKeeper);

  • restarting Kafka brokers;

  • migrating cluster metadata from ZooKeeper to the Kafka controller.

CAUTION
  • After migration mode is enabled, Kafka controllers are fully functional and retrieve metadata from ZooKeeper, but Kafka brokers still use ZooKeeper as a quorum.

  • Only proceed to disabling migration mode after verifying data migration, otherwise a cluster failure may occur.

Below is the state of the parameters after successfully enabling migration mode:

  • Kafka quorum solution value is ZooKeeper;

  • KRaft migration mode value is true.

Check data migration

The Kafka controller log will show the corresponding messages during the metadata migration.

All messages can be viewed by accessing the /var/log/kafka-controller/server.log file on the host where the Kafka Controller component is located.

Data migration is complete when the following entry appears in the log:

Completed migration of metadata from ZooKeeper to KRaft.

Only if this message appears, it is permissible to proceed to disabling migration mode.

Disable migration mode and set KRaft mode for Kafka

To disable migration mode, ensure the following conditions are met:

  • The Kafka service parameters state:

    • Kafka quorum solution value is ZooKeeper;

    • KRaft migration mode value is true.

  • The Kafka controller log contains a message of completion of data migration from ZooKeeper to KRaft, as described above.

To disable migration mode for the Kafka service, in the ADCM interface, run the KRaft migration stage 2 action by clicking actions default dark actions default light in the Actions column.

Disabling migration mode
Disabling migration mode

The process of disabling migration mode automatically starts, including the following:

  • configuring Kafka controllers to remove all ZooKeeper related properties and complete the migration;

  • configuring Kafka brokers to point directly to the KRaft quorum instead of the ZooKeeper quorum, removing all ZooKeeper related properties, and completing the migration;

  • restarting Kafka brokers and controllers.

Below is the state of the parameters after successfully disabling migration mode:

  • Kafka quorum solution value is KRaft;

  • KRaft migration mode value is false.

Found a mistake? Seleсt text and press Ctrl+Enter to report it