Kafka installation in the KRaft mode

Overview

The Kafka service in the KRaft mode is installed as a regular service during ADS cluster installation in the ADCM interface using additional actions:

  • adding an additional component Kafka Controller to create a controller quorum;

  • setting the Kafka quorum solution parameter to KRaft during configuration of the Kafka service to create an environment for the KRaft mode (parameters, metadata storage, etc.).

Below are the detailed steps to install the Kafka service with a description of additional actions.

CAUTION
  • Installation of the Kafka service in KRaft mode is available starting from the 3.6.2.2.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 option to migrate from KRaft to ZooKeeper.

  • For an ADS cluster where you plan to install the Kafka service in KRaft mode, installing the ZooKeeper service is not required.

Step 1. Add the service

  1. In the ADCM interface, open the Clusters page and click your ADS cluster name. On the cluster page that opens, switch to the Services tab and click Add services.

    Switch to adding services
    Switch to adding services
  2. In the opened dialog, select the Kafka service and click Add.

    Select the service
    Select the service

    As a result, the added service is displayed on the Services tab.

    The result of successful adding the service to the cluster
    The result of successful adding the service to the cluster

Step 2. Add components

  1. On the cluster page, open the Mapping tab to proceed to mapping service components to cluster hosts.

    Switch to mapping service components
    Switch to mapping service components
    Kafka service components
    Component Description

    Kafka Broker

    The broker, which is responsible for storing partitions of topics to which clients connect to write or read messages

    Kafka Controller

    The broker, which is responsible for storing the cluster metadata topic. It is a participant in the controller quorum

  2. Assign a host to each component of the Kafka service — click Add hosts and select the desired host in the pop-up window.

    Select a host for a component
    Select a host for a component
    CAUTION
    To install Kafka in KRaft mode, Kafka Controller is a required component, even if it is not highlighted in red. The recommended number of Kafka Controller instances per cluster is 3.
  3. After the distribution of components is completed, click Save.

    Save mapping of components
    Save mapping of components

Step 3. Configure the service

  1. Open the Services tab on the cluster page and click the Kafka service name in the Name column.

    Switch to the service configuration
    Switch to the service configuration
  2. On the Primary configuration page that opens:

    • change the value of the Kafka quorum solution parameter to KRaft;

    • if necessary, fill in the remaining service configuration parameters — descriptions of the parameters are given in the Kafka section of the ADS configuration parameters article.

      Configure the Kafka service
      Configure the Kafka service

      After specifying all necessary parameters, click Save.

  3. Switch to configure the Kafka Controller component. To do this, go to the Components tab from the Primary configuration tab and select the Kafka Controller component.

    Switch to the Kafka Controller component configuration
    Switch to the Kafka Controller component configuration
  4. In the window that opens, set the Show advanced switch to the active state and, if necessary, change the default values ​​​​set for the configuration parameters of the Kafka Controller component — descriptions of the parameters are given under the heading "Kafka Controller component configuration parameters" in the Kafka section of the ADS configuration parameters article.

    Configure the Kafka Controller component
    Configure the Kafka Controller component

    After specifying all necessary parameters, click Save.

Step 4. Install the service

  1. On the Services tab, click actions default dark actions default light for the Kafka service in the Actions column and run the Install action.

    Switch to the service installation
    Switch to the service installation
  2. Confirm the action in the opened window.

    Confirm the action
    Confirm the action
  3. Wait until the installation is complete. Then check that the service state has changed from created to installed.

    Installation is complete
    Installation is complete

    To view the service installation process and analyze errors if they occur, select Jobs in the left navigation menu and click the Install job name in the Jobs list.

    Install service job page
    Install service job page

Step 5. View results

Configuration files

During Kafka installation in the KRaft mode, all the necessary parameters for working with controller quorum are automatically installed via the ADCM interface in the configuration files for broker and controller servers. Below are examples of configuration files created using ADCM (in the directory /etc/kafka/conf/), which display the parameters that were defined on the Kafka service page in the corresponding section of the configuration parameters.

Kafka broker configuration file server.properties
node.id=1
auto.create.topics.enable=False
listeners=PLAINTEXT://:9092
log.dirs=/kafka-logs
default.replication.factor=1
num.partitions=1
delete.topic.enable=true
log.retention.hours=168
log.roll.hours=168
queued.max.requests=500
num.network.threads=3
num.io.threads=8
auto.leader.rebalance.enable=True
unclean.leader.election.enable=False
offsets.topic.replication.factor=1
transaction.state.log.replication.factor=1
transaction.state.log.min.isr=1

listener.security.protocol.map=PLAINTEXT:PLAINTEXT,CONTROLLER:PLAINTEXT

process.roles=broker
controller.listener.names=CONTROLLER
controller.quorum.voters=100001@sov-ads-test-4.ru-central1.internal:9093
log.cleaner.enable=True
log.cleanup.policy=delete
log.cleanup.interval.mins=10
log.cleaner.min.compaction.lag.ms=0
log.cleaner.delete.retention.ms=86400000

security.inter.broker.protocol=PLAINTEXT
Kafka Controller сonfiguration file kafka-controller.properties
process.roles=controller
node.id=100001
controller.listener.names=CONTROLLER
listeners=CONTROLLER://:9093
log.dirs=/kafka-meta
controller.quorum.voters=100001@sov-ads-test-4.ru-central1.internal:9093
listener.security.protocol.map=CONTROLLER:PLAINTEXT

security.inter.broker.protocol=PLAINTEXT
File for specifying environment variables kafka-controller-env.sh
export LOG_DIR=/var/log/kafka-controller
export PID_DIR=/var/run/kafka-controller

Metadata storage

When installing Kafka in KRaft mode, a storage space for each broker and controller (/kafka-meta folder) is automatically created in the ADCM interface using the script /usr/lib/kafka/bin/kafka-storage.sh, containing the following files:

  • bootstrap.checkpoint — a file containing a set of UserScramCredentialsRecords (checkpoint markers) that are used to bootstrap the cluster;

  • __cluster_metadata-0 — a directory containing files in which all changes to cluster metadata are saved;

  • meta.properties — a file containing information about the current server, version and cluster ID.

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