+1 (417) 281-3175

Upgrading to Apache Kafka 4.0: What Removal of ZooKeeper and Old Protocols Means for Your Clients

Kafka 4.0 is the first release with no ZooKeeper mode at all. That headline gets the attention, but the upgrades that go wrong are usually caused by the quieter changes: removed protocol versions, raised Java baselines, and old clients nobody remembered. This note is a pre-flight list and an upgrade order, written for teams on a 3.x cluster. Verify details against the release notes for the exact version you are targeting.

What actually changed

  • ZooKeeper mode is gone. A 4.0 broker only runs in KRaft mode. You cannot upgrade a ZooKeeper-based cluster directly to 4.0; it has to be on KRaft first. The 3.9 release is the last that supports ZooKeeper and the intended bridge.
  • Java baselines moved. Brokers and tools expect Java 17. Clients, Kafka Streams, and Connect expect Java 11. A fleet of services still on Java 8 will need runtime work before they can use the 4.0 client libraries.
  • Old protocol API versions were removed (KIP-896). Very old clients, roughly those older than 2.1, can no longer talk to a 4.0 broker. The same family of changes retired the oldest message formats.
  • Some tooling and components were removed or changed, including the original MirrorMaker (MM1) and certain deprecated configs. Check scripts and runbooks for the ones you actually call.

Step 1: Finish the KRaft move first

If you are still on ZooKeeper, the upgrade is two projects, not one. Do the migration (see our ZooKeeper-to-KRaft checklist), let it run on KRaft for a full operating cycle including a rolling restart and a controller failover, and only then plan the 4.0 move. Combining them removes your ability to tell which change caused a regression.

Step 2: Audit who is actually connecting

The cluster knows which clients it serves. Use broker-side metrics rather than a team survey:

  • kafka.server:type=BrokerTopicMetrics and request metrics tagged by API version show which request versions are in use. The RequestMetrics family, along with the client software name and version metrics (ClientSoftwareName, ClientSoftwareVersion on kafka.server:type=socket-server-metrics), identifies the long tail.
  • Group the results by client software version and principal. Map each principal to an owning team.
  • Anything older than 2.1, or any client library you cannot identify, is a blocker. Third-party agents, ETL tools, and embedded connectors are the usual surprises.

Budget real time for this step. It is normally the longest part of the project, and it is calendar time spent waiting on other teams rather than engineering effort.

Step 3: Check the non-broker components

  • Kafka Connect: confirm the worker JVM and each connector plugin support the new baseline. Plugins pinned to old converters or old client jars are common.
  • Kafka Streams: upgrade the library on its own schedule, with the usual rolling bounce. Streams apps have their own upgrade guidance for state and internal topic formats; read it per version.
  • Replication: if any pipeline still uses MM1, move it to MirrorMaker 2 first and verify offset translation, as covered in our MirrorMaker 2 note.
  • Operational tooling: Cruise Control, exporters, Kubernetes operators, and backup tools each have their own compatibility matrix with the broker version.

Step 4: Upgrade in an order that can be undone

The broker upgrade is two separate decisions, and the separation is what gives you a rollback.

  1. Rehearse on a non-production cluster that mirrors production's client mix, listener setup, and security configuration. Rehearse the rollback too.
  2. Roll the binaries one broker at a time, keeping the metadata and inter-broker protocol version at the old level. Wait for under-replicated partitions to return to zero before moving to the next broker. Do controllers first or follow the documented order for your deployment mode.
  3. Soak. Run for a few days on new binaries with the old feature level. Binary rollback is still straightforward in this window.
  4. Raise the feature level (kafka-features.sh upgrade --metadata <version>) as a separate, deliberate change. After this, downgrade is limited by what the new metadata features wrote, so treat it as the point of no return and schedule it accordingly.

Step 5: Know what you will watch

During each restart window, track under-replicated partitions, offline partitions, request latency at p99, produce and fetch error rates, and consumer-group lag by time rather than only by offset. Tie these to your existing SLOs (see Kafka monitoring that pages for the right reasons). Define the abort condition before you start: for example, "under-replicated partitions not at zero ten minutes after a broker rejoins".

Trade-offs worth stating plainly

  • Staying on 3.9 is a legitimate choice for a while, but support windows are finite, and the delay raises the eventual cost of the client audit.
  • Managed services stage this differently. On Amazon MSK or Confluent Cloud, the provider drives broker versions and KRaft timing, but the client-compatibility audit remains yours.
  • A fast upgrade is not the goal. The goal is a version change the on-call engineer barely notices.

A short pre-flight list

  1. Cluster is on KRaft and has been stable through a controller failover.
  2. Client inventory built from broker metrics; nothing older than the supported floor.
  3. Java versions confirmed for brokers, clients, Connect, and Streams.
  4. MM1 and removed tooling replaced in pipelines and runbooks.
  5. Rehearsal and rollback completed on a representative cluster.
  6. Feature-level raise scheduled as its own change, after a soak period.

If you are planning a 3.x-to-4.0 move and want a second set of eyes on the client audit or the rollout plan, describe the cluster and the client mix and we will reply with a concrete proposal.