Skip to content
LogScale Self-Hosted Deployment
This is an archived version of the documentation downloaded from LogScale Documentation Archives. Up to date documentation, and documentation for later versions, is available on LogScale Documentation

### Switch Kafka using KRaft Mode

Methods for switching Kafka using KRaft Mode, including setting up a new Kafka cluster, deleting existing Kafka data, or creating new queues and topics with new names. Detailed instructions are provided for each approach, with specific emphasis on the restart process, verification steps, and important considerations when implementing the Kafka switch in a LogScale environment.

In the event of issues or the need to change your infrastructure, there are two main ways to switch LogScale to another Kafka cluster:

1. Set up a new Kafka cluster and re-configure LogScale to use the new cluster.

2. Reset Kafka.

Setting up a new Kafka cluster and pointing it to LogScale is the simplest method. Resetting Kafka is described in the following section.

### Note

In order to be able to reset Kafka for LogScale you need to first set the variable `ALLOW_KAFKA_RESET_UNTIL_TIMESTAMP_MS`, which is not set by default.

#### How to Reset Your Kafka Cluster

There are two ways to reset your Kafka cluster:

1. Delete the Kafka data and reuse the Kafka cluster

2. Create new Kafka queues/topics with new names in the Kafka Cluster

These are described in the following sections.

##### Delete Kafka Data and Re-Use Cluster

You could reset the current Kafka cluster by deleting the data directories on the filesystem on each node. This is the same as starting up a new and empty Kafka cluster. To do this, delete everything inside the Kafka data directory.

### Note

Make sure you set the Kafka cluster ID correctly, as described in the Kafka documentation.

##### Create New Kafka Queues/Topics with New Names in Kafka Cluster

Instead of resetting Kafka as described previously, you can alternatively let LogScale use a new set of queues in the existing Kafka cluster. When reusing the same Kafka cluster, LogScale must be configured with a new `HUMIO_KAFKA_TOPIC_PREFIX` to detect the changes.

It's important to note that it will not work to delete and recreate topics with the same names. In that case LogScale cannot detect the Kafka switch. If Kafka is managed by LogScale (`KAFKA_MANAGED_BY_HUMIO`), the new topics will be created automatically when LogScale starts up. Otherwise you must create topics externally before you start LogScale.

#### Restarting Kafka using KRaft and LogScale

Now you're ready to get the Kafka cluster started. Start all Kafka nodes, wait for them to be running and verify the Kafka cluster.

Once Kafka has started, start the LogScale nodes. It's important to start one LogScale node first. This node will detect the Kafka switch and create a new epoch in LogScale.

To verify that the Kafka switch was detected and handled, look for this line in the LogScale debug log:

    Switching epoch to=${epochKey} from=${latestEpoch.kafkaClusterId}
    - I'm the first cluster member to get here
      for this kafka. newEpoch=${newEpoch}

When the first node is up and running and the above logline confirms a new epoch has been created, the rest of the LogScale nodes can be started.

At that point, the LogScale cluster should be running again. Check the cluster nodes in the administrative section of the LogScale user interface: `http://$HUMIOHOST/system/administration/partitions/ingest`

#### Enter search term