Migrate from ZooKeeper mode to KRaft mode for Kafka¶
This guide outlines the steps to migrate Kafka from ZooKeeper mode to KRaft mode. KRaft (Kafka Raft) is Apache Kafka's consensus protocol that removes the dependency on ZooKeeper for metadata management.
Tip
KRaft mode is supported starting with Privacera Platform version 9.0.32.1. For earlier versions, you must use ZooKeeper mode.
Note
Estimated Downtime: This migration will require downtime for Kafka and associated Discovery services. The duration depends on the completion of any active Discovery scans and the time needed to perform the upgrade steps, typically ranging from 20 minutes to 1 hour. Plan accordingly, and ensure that any critical Discovery tasks are paused or completed prior to the migration window.
Migration Steps¶
Step 1: Stop Active Discovery Scans¶
a. Stop existing offline Discovery scans:
- Log in to the Privacera Platform portal
- Navigate to Discovery Menu -> Scan Status.
- Stop, kill, or cancel any existing offline Discovery scans that are currently running, listing, or pending
Note
If you do not wish to cancel any existing offline scans, wait until they have completed before proceeding with the upgrade.
b. Stop the PKafka Pod to temporarily pause Real-Time Scans:
Bash | |
---|---|
Tip
Replace with your Kubernetes namespace. This is usually set using the DEPLOYMENT_ENV_NAME
environment variable.
Step 2: Wait for Active Scans to Complete¶
- Run the following command periodically and monitor its output. An output value of zero signifies that there are no active discovery scan executor pods remaining.
Bash | |
---|---|
- Wait until the output of the command is 0 before proceeding to the next step.
Step 3: Scale Down Privacera Services¶
Scale down the following services before proceeding with the upgrade:
-
Discovery Service:
Bash -
Discovery Consumer:
Bash -
Kafka Pod:
Bash
Step 4: Delete Existing Kafka StatefulSet¶
Once all services are scaled down, delete the existing Kafka StatefulSet.
Bash | |
---|---|
Step 5: Clean Up Existing Storage¶
Delete the existing PVC (Persistent Volume Claim):
Note
Run kubectl -n <name-space> get pvc | grep datadir-kafka
to list all Kafka PVCs. If your Kafka cluster has multiple replicas, you must delete each PVC.
Bash | |
---|---|
Step 6: Enable KRaft Mode¶
-
Edit the Kafka configuration file:
-
Add the KRaft mode property:
Step 7: Restart Privacera Services¶
Restart services and post install:
Run the following command to run the post install steps:
Step 8: Verify Kafka Migration¶
Check Kafka pods are running:
Bash | |
---|---|
Post-Migration Verification¶
Test Discovery functionality:
- Run a Discovery scan to confirm that Discovery works as expected.
- If Discovery functionality is not working, use the Privacera diagnostic tool for debugging and log analysis.
- Prev Advanced Configuration
- Next Troubleshooting