DEV Community

ANKUSH CHOUDHARY JOHAL
ANKUSH CHOUDHARY JOHAL

Posted on • Originally published at johal.in

Step-by-Step: Migrate from Apache Kafka 3.7 to Redpanda 2.5 for Real-Time Data Streams

Step-by-Step: Migrate from Apache Kafka 3.7 to Redpanda 2.5 for Real-Time Data Streams

Apache Kafka is the industry standard for real-time data streaming, but Redpanda has emerged as a high-performance, Kafka-compatible alternative with zero ZooKeeper dependency, lower operational overhead, and improved throughput. This guide walks you through migrating a production-ready Apache Kafka 3.7 cluster to Redpanda 2.5 with minimal downtime.

Why Migrate to Redpanda 2.5?

Redpanda 2.5 is fully wire-compatible with Kafka 3.7 workloads, meaning existing Kafka producers, consumers, and tools work without code changes. Key benefits include:

  • Built-in schema registry and HTTP proxy (no separate components required)
  • 50-90% lower write amplification than Kafka
  • Native support for Kafka ACLs, quotas, and consumer group offsets
  • Simplified operations with a single binary and no external dependencies

Prerequisites

Before starting the migration, ensure you have:

  • A running Apache Kafka 3.7 cluster with all topics, consumer groups, and ACLs documented
  • Separate infrastructure for Redpanda 2.5 (on-prem, cloud, or containerized) to avoid port conflicts with Kafka
  • Redpanda 2.5 installed on target nodes (follow official install guides)
  • Kafka tooling (kafka-topics.sh, kafka-acls.sh, kcat) and Redpanda’s rpk CLI available
  • Full backup of your Kafka cluster data and metadata

Step 1: Pre-Migration Assessment

Inventory all Kafka components to avoid missing critical configurations during migration:

  1. Export all topic configurations:

    kafka-topics.sh --bootstrap-server localhost:9092 --describe --all > kafka_topics_backup.txt
    
  2. Export consumer group offsets:

    kafka-consumer-groups.sh --bootstrap-server localhost:9092 --list > kafka_consumer_groups.txt
    kafka-consumer-groups.sh --bootstrap-server localhost:9092 --describe --all > kafka_offsets_backup.txt
    
  3. Export ACLs:

    kafka-acls.sh --bootstrap-server localhost:9092 --list > kafka_acls_backup.txt
    
  4. Verify client compatibility: Ensure all producers/consumers use Kafka client versions 2.8+ (Redpanda 2.5 supports all Kafka client versions, but older clients may lack required protocol features).

Step 2: Deploy Redpanda 2.5 Cluster

Initialize your Redpanda cluster with matching or improved configuration:

  1. Configure each Redpanda node’s redpanda.yaml (adjust paths, listeners, and replication settings to match your Kafka cluster):

    redpanda:
      data_directory: /var/lib/redpanda/data
      node_id: 0
      kafka_api:
        - address: 0.0.0.0
          port: 19092  # Use non-default port if Kafka is still running on 9092
      admin_api:
        - address: 0.0.0.0
          port: 9644
      rpc_server:
        address: 0.0.0.0
          port: 33145
    
  2. Start the Redpanda cluster:

    rpk cluster start --id 0 --self-contained
    
  3. Verify cluster health:

    rpk cluster info
    rpk broker list
    

Step 3: Migrate Metadata & Configuration

Recreate all Kafka metadata in Redpanda to ensure consistency:

  1. Recreate topics with matching partitions, replication factors, and configs (use the backup from Step 1):

    rpk topic create my-topic --partitions 6 --replicas 3 --config retention.ms=86400000
    
  2. Migrate ACLs to Redpanda (Redpanda supports Kafka-style ACLs natively):

    rpk acl create --allow-principal User:producer --operation Write --topic my-topic
    
  3. Sync consumer group offsets (use MirrorMaker 2 for automated offset sync, or manually import offsets from your Kafka backup).

Step 4: Replicate Data with MirrorMaker 2 (Zero Downtime)

For zero-downtime migration, use Kafka MirrorMaker 2 to replicate data from Kafka to Redpanda in real time:

  1. Create a MirrorMaker 2 configuration file (mm2.properties):

    clusters = kafka, redpanda
    kafka.bootstrap.servers = localhost:9092
    redpanda.bootstrap.servers = localhost:19092
    
    kafka->redpanda.enabled = true
    kafka->redpanda.topics = .*  # Replicate all topics
    kafka->redpanda.sync.group.offsets.enabled = true  # Sync consumer offsets
    kafka->redpanda.emit.checkpoints.enabled = true
    
  2. Start MirrorMaker 2:

    connect-mirror-maker.sh mm2.properties
    
  3. Verify replication: Use kcat to consume from both clusters and confirm data matches:

    kcat -b localhost:9092 -t my-topic -C -e
    kcat -b localhost:19092 -t my-topic -C -e
    

Step 5: Switch Clients to Redpanda

Roll clients over to Redpanda incrementally to avoid downtime:

  1. Update producer/consumer bootstrap server configs to point to Redpanda (e.g., localhost:19092).
  2. Switch a small subset of non-critical clients first, then monitor for errors.
  3. Once stable, switch all remaining clients, then stop MirrorMaker 2.

Step 6: Decommission Kafka Cluster

Only decommission Kafka once Redpanda is fully operational:

  1. Stop all Kafka brokers: kafka-server-stop.sh
  2. Verify no remaining traffic to Kafka (check broker logs for incoming connections).
  3. Take a final backup of Kafka data, then delete the cluster if all checks pass.

Step 7: Post-Migration Validation

Confirm the migration was successful:

  • Verify topics: rpk topic list and rpk topic describe my-topic
  • Verify consumer groups: rpk consumer group list and rpk consumer group describe my-group
  • Run load tests to confirm throughput and latency meet your requirements.
  • Monitor Redpanda metrics via rpk metrics or Prometheus integration.

Troubleshooting Common Issues

  • Port conflicts: Use non-default ports for Redpanda if Kafka is still running during migration.
  • Offset mismatch: Re-sync consumer offsets using MirrorMaker 2 or manually import from Kafka backups.
  • Client connection errors: Ensure clients use the correct bootstrap server address and Kafka protocol version (set api.version.request=true for older clients).

Conclusion

Migrating from Apache Kafka 3.7 to Redpanda 2.5 is straightforward thanks to full wire compatibility. You’ll gain a more efficient, easier-to-manage streaming platform without disrupting existing real-time data workflows. For more details, refer to the Redpanda Kafka migration docs.

Top comments (0)