<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ahmet Tortumlu on Medium]]></title>
        <description><![CDATA[Stories by Ahmet Tortumlu on Medium]]></description>
        <link>https://medium.com/@ahmettortumlu25?source=rss-f9e012646f91------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*9m4CAt3JdSj4X1LnTU2dSA.jpeg</url>
            <title>Stories by Ahmet Tortumlu on Medium</title>
            <link>https://medium.com/@ahmettortumlu25?source=rss-f9e012646f91------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 02:40:25 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ahmettortumlu25/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Mastering Dynamic KRaft Controllers in Kafka 4.1: Adding, Removing, and Surviving the Edge Cases]]></title>
            <link>https://medium.com/trendyol-tech/mastering-dynamic-kraft-controllers-in-kafka-4-1-adding-removing-and-surviving-the-edge-cases-0dddfcef03f1?source=rss-f9e012646f91------2</link>
            <guid isPermaLink="false">https://medium.com/p/0dddfcef03f1</guid>
            <category><![CDATA[dynamic-quorum]]></category>
            <category><![CDATA[data-streaming]]></category>
            <category><![CDATA[kafka-controller]]></category>
            <category><![CDATA[kraft]]></category>
            <category><![CDATA[apache-kafka]]></category>
            <dc:creator><![CDATA[Ahmet Tortumlu]]></dc:creator>
            <pubDate>Mon, 16 Nov 2026 07:05:51 GMT</pubDate>
            <atom:updated>2026-11-16T07:05:51.282Z</atom:updated>
            <content:encoded><![CDATA[<p>A while ago, I wrote an <a href="https://medium.com/trendyol-tech/node-replacement-in-kafka-lessons-from-a-kraft-controller-08dc5badb018">article</a> detailing our initial experiences with Kafka KRaft controller node replacement procedure for Apache Kafka 3.8 version. Since then, the Kafka ecosystem has evolved rapidly. While the foundation for dynamic voter management was introduced back in Kafka 3.9, the release of Apache Kafka 4.1 brought the true game-changer for enterprise environments: the ability to seamlessly migrate an existing static quorum to a dynamic one. Now, adding and removing KRaft controllers on the fly without cluster downtime is fully mature.</p><p>In my previous post, we used a ship formation analogy to explain KRaft controller node replacements, in which a failing ship was swapped out for a new one of the same type. Now, a direct replacement is no longer required. We have the flexibility to scale the existing formation by independently adding or removing ships at will(<em>dynamic quorum feature</em>).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*qmj5wpvhxnfr6ET-9t_dEg.jpeg" /><figcaption>Image by dzkk.tsk.tr</figcaption></figure><p>In this second installment, I want to share our latest field notes. We will walk through how to dynamically add and remove a KRaft controller using <a href="https://github.com/confluentinc/cp-ansible">cp-ansible</a>, and more importantly, how to troubleshoot the sneaky edge cases that can leave your nodes stuck or your cluster confused.</p><p>At Trendyol, the Data Streaming team operates a massive Kafka ecosystem, comprising over 500,000 partitions, more than 20,000 active consumer groups, 250 TB of total log size, and the ability to process 2.2 million requests per second. Operating at this extreme scale means we must strictly enforce security and high-availability best practices without compromising performance. Since our clusters run on virtual machines, routine infrastructure lifecycle events, such as OS upgrades, network changes, or rolling out new VM images, pose significant operational challenges. Rather than going through the heavy lifting of provisioning entirely new clusters for these updates, we utilize a seamless, node-by-node replacement strategy. This approach keeps our infrastructure clean and ensures zero downtime for the developers using our platform.</p><p>When the need for KRaft controller node replacement arose, two blockers stood between us and a clean add/remove workflow. First, controller removal only arrived with Apache Kafka 3.9 (Confluent Platform 7.9). Second, clusters deployed before that era still ran a static metadata quorum, so even after upgrading the binary, we could not simply remove existing quorum members and add replacements in their place. Converting a static quorum to a dynamic one required waiting for Apache Kafka 4.1 / Confluent Platform 8.1. That is exactly why, in the first article, we documented a manual, node-by-node replacement strategy built around DNS updates and <em>meta.properties</em>. With 4.1/8.1, that door finally opened, and the rest of this post is what we learned once we started using dynamic voters in the field.</p><h3>Adding a New Controller with cp-ansible</h3><p>When scaling out your controller quorum, preparation is everything. The most critical step happens before you even run an Ansible playbook: configuring your inventory correctly.</p><h4>The Importance of node_id</h4><p>In older configurations, we defined controller hosts with broker_id in our inventory, the variable cp-ansible historically used. When we started adding controllers dynamically after the CP 8.1 upgrade path, that habit bit us: the new node did not come up with the ID we expected.</p><p>This lines up with a deliberate change in Confluent Ansible 8.1.0: Kafka brokers (and the inventory model around them) now default to node_id instead of broker_id. Legacy inventories can keep broker_id only by setting enable_node_id: false, but for dedicated KRaft controllers we treat explicit node_id as the source of truth. If you let Ansible assign IDs from list indexing, or leave stale broker_id entries in place, you risk an ID mismatch that the quorum will reject.</p><p>Here is what your inventory should look like:</p><pre>kafka_controller:<br>  hosts:<br>    kafka-controller-1:<br>      node_id: 9991<br>    kafka-controller-2:<br>      node_id: 9992<br>    kafka-controller-3:<br>      node_id: 9993<br>    kafka-controller-4:<br>      node_id: 9994 <br>    kafka-controller-5:<br>      node_id: 9995<br>    # The newly added node:<br>    kafka-controller-6:<br>      node_id: 9996</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LFE88r8AvqhkSFYmMKwzgA.png" /><figcaption>Example of Kafka cluster architecture and KRaft controllers’ placements</figcaption></figure><h4>The Deployment Run</h4><p>When triggering your cp-ansible playbook to provision the new controller, you need to ensure the new node registers to the exact same cluster. Pass the cluster ID explicitly as an environment variable:</p><pre>ansible-playbook -i hosts.yml playbook.yml -e &quot;clusterid=MySuperDuperClusterId&quot;</pre><p>Once the playbook finishes, you can check the cluster state using the quorum tool:</p><pre>kafka-metadata-quorum - bootstrap-controller &lt;controller-host&gt;:&lt;controller-port&gt; \<br> - command-config &lt;client-properties-file-path&gt; \<br>describe - replication</pre><p>At this stage, you will likely observe that your new node (e.g., <em>9996</em>) appears under the Observers list rather than the active voter quorum. We will discuss how to transition it to a follower/leader shortly.</p><h3>Removing a KRaft Controller</h3><p>Once a cluster supports dynamic voter removal, taking a controller out of the quorum is surprisingly straightforward, provided you have zero metadata replication lag.</p><p>After stopping the controller service on the target node, you execute the remove-controller command from an active node:</p><pre>kafka-metadata-quorum - bootstrap-controller &lt;controller-host&gt;:&lt;controller-port&gt; \<br> - command-config &lt;command-properties-file-path&gt; \<br>remove-controller - controller-id 9995 - controller-directory-id &lt;directory_id&gt;</pre><p>While the command is simple, determining the correct parameters is where many engineers often stumble. Let’s look at what can go wrong.</p><h3>What Can Go Wrong? (Tales from the Trenches)</h3><p>Distributed systems often penalize small configuration mistakes. Here are the three most common pitfalls when managing KRaft controllers dynamically:</p><h3>1. broker_id vs node_id Confusion</h3><p>This was not a hypothetical for us. Our host files still carried <em>broker_id</em> for controllers from older cp-ansible templates. Starting with <a href="https://docs.confluent.io/ansible/8.1/ansible-release-notes.html#notable-enhancements">cp-ansible 8.1.0</a> version, Kafka inventories default to <em>node_id</em> instead of <em>broker_id</em> (legacy <em>broker_id</em> remains available only if you set “<em>enable_node_id: false”</em>). After we moved onto that 8.1 line, adding a controller produced an unexpected ID, and the node failed to join the quorum cleanly.</p><p>Avoid writing “<em>broker_id: 9996”</em> under the “<em>kafka_controller”</em> group and assuming it still maps the way it used to. For dedicated KRaft controllers, pin node_id explicitly in hosts.yml (as in the inventory example above). Migrating those inventory keys was a required lesson before dynamic add/remove felt safe in our pipelines.</p><h3>2. The “Forever Observer” Trap</h3><p>We added the new node, ran the playbook, but kafka-metadata-quorum insists our new node is just an “Observer”. Why isn’t it participating in the quorum?</p><p>By default, cp-ansible calculates the quorum voters list dynamically based on the host’s index in the inventory file. If you explicitly define node_ids to protect your cluster, the default template fails to pick up your static IDs. The cluster doesn’t recognize the new node as an official voter.</p><p><strong>The Fix:</strong> You must explicitly override the <em>kafka_controller_quorum_voters</em> variable in your Ansible variables (e.g., <em>group_vars/all.yml</em> or <em>component.yml</em>) to construct the voters string dynamically from your custom <em>node_ids</em>:</p><pre>kafka_controller_quorum_voters: &gt;-<br>{% for host in groups[&#39;kafka_controller&#39;] -%}<br>{{ hostvars[host][&#39;node_id&#39;] }}@{{ host }}:{{ kafka_controller_listeners[&#39;controller&#39;][&#39;port&#39;] | default(&#39;8090&#39;) }}<br>{%- if not loop.last %},{% endif -%}<br>{%- endfor %}</pre><p>Once applied, rolling your deployment will promote the node from an Observer to an active Follower/Leader.</p><h3>3. The Directory ID Deception</h3><p>When running the remove-controller command, you need the <em>controller-directory-id</em>.</p><p>It is highly tempting to simply copy this ID from the output of:</p><pre>kafka-metadata-quorum describe --replication</pre><p><strong>Do not trust that output</strong>. The directory ID returned by the quorum describe command can sometimes be outdated or incorrect, causing the removal command to fail silently or throw errors.</p><p><strong>The Fix:</strong> Always SSH into the node you are trying to remove and fetch the source of truth directly from the file system:</p><pre>cat /var/lib/controller/data/meta.properties | grep directory.id</pre><p>Use <em>that</em> value in your <em>remove-controller</em> command.</p><h3>Conclusion</h3><p>Managing Kafka’s metadata quorum dynamically represents a significant leap forward from the older Kraft version days, but it requires precision. By ensuring your <em>node_ids</em> are strictly defined, configuring your quorum voters template correctly, and relying on <em>meta.properties</em> for <em>directory IDs</em>, you can safely scale your KRaft controllers up and down with zero downtime.</p><p>At Trendyol, automating these edge cases into our deployment pipelines ensures our platform remains resilient, no matter how much load we throw at it.</p><p>As the Data Streaming Team, we enjoy applying up-to-date best practices and sharing our hands-on experiences. If you’re curious to learn more about how we approach distributed systems and streaming infrastructure, feel free to explore other articles written by our team, I’ve linked them below!</p><ul><li><a href="https://medium.com/trendyol-tech/node-replacement-in-kafka-lessons-from-a-kraft-controller-08dc5badb018">Node Replacement in Kafka: Lessons from a KRaft Controller</a></li><li><a href="https://medium.com/trendyol-tech/automated-kafka-broker-replacement-4376dc01e4d7">Changing Engines Mid-Flight: Automated Kafka Broker Replacements ✈️</a></li><li><a href="https://medium.com/trendyol-tech/optimizing-kafka-performance-through-data-compression-330fb31a0827">Optimizing Kafka Performance Through Data Compression</a></li></ul><h3>Join Us</h3><p>Do you want to be a part of our growing company? We’re hiring! Check out our open positions from the links below.</p><p><a href="https://careers.trendyol.com/">Home - Trendyol Careers</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0dddfcef03f1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/trendyol-tech/mastering-dynamic-kraft-controllers-in-kafka-4-1-adding-removing-and-surviving-the-edge-cases-0dddfcef03f1">Mastering Dynamic KRaft Controllers in Kafka 4.1: Adding, Removing, and Surviving the Edge Cases</a> was originally published in <a href="https://medium.com/trendyol-tech">Trendyol Tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Node Replacement in Kafka: Lessons from a KRaft Controller]]></title>
            <link>https://medium.com/trendyol-tech/node-replacement-in-kafka-lessons-from-a-kraft-controller-08dc5badb018?source=rss-f9e012646f91------2</link>
            <guid isPermaLink="false">https://medium.com/p/08dc5badb018</guid>
            <category><![CDATA[kafka-broker]]></category>
            <category><![CDATA[kafka]]></category>
            <category><![CDATA[kafka-controller]]></category>
            <category><![CDATA[data-streaming]]></category>
            <category><![CDATA[apache-kafka]]></category>
            <dc:creator><![CDATA[Ahmet Tortumlu]]></dc:creator>
            <pubDate>Mon, 18 Aug 2025 07:13:42 GMT</pubDate>
            <atom:updated>2025-08-18T07:13:42.104Z</atom:updated>
            <content:encoded><![CDATA[<p>When naval warships sail together, they move in a precise formation, each vessel maintaining constant communication and acting as a single, cohesive unit. Similarly, a Kafka cluster and its surrounding components operate in strict coordination. Each node plays a synchronized role in keeping the system healthy and responsive. But what happens when a ship in the formation, say a node, needs to be pulled out due to a fault or scheduled replacement? The transition must be seamless, with a new ship promptly joining the formation to maintain operational integrity.</p><p>In this post, I’ll walk you through how we safely replaced and rejoined nodes for a key component in our Kafka ecosystem: the <strong>KRaft Controller</strong>. While showing you how we kept the formation intact while swapping out critical parts, just like disciplined ships at sea, I’ll also share a real-life operational challenge we faced. You’ll learn how we troubleshooted a metadata fetch timeout issue that occurred during one of these operations and the steps we took to resolve it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TewXEabEWm3rjQyD" /><figcaption>Image by dzkk.tsk.tr</figcaption></figure><p>As the Trendyol Data Streaming team, we provide a data streaming platform powered by more than 40 Kafka clusters, serving over 2,000 developers. We ensure that this platform is used by teams following best practices in terms of security and availability. At Trendyol, we manage our Kafka clusters on virtual machines, which brings several operational challenges, particularly when infrastructure components such as the OS, network configurations, or VM images need to be updated. Instead of provisioning an entirely new Kafka cluster in such cases, we opt for a node-by-node replacement strategy. This minimizes disruptions for our internal software teams and helps keep the total number of managed clusters under control.</p><p>Previously, <a href="https://medium.com/u/8d6cd5ac1c37">Yalın Doğu Şahin</a> published a detailed <a href="https://medium.com/trendyol-tech/automated-kafka-broker-replacement-4376dc01e4d7">medium article</a> explaining how we replace Kafka brokers. As he pointed out, other Kafka components like Kraft Controller, Kafka Connect, KsqlDB and Schema Registry are designed to be stateless and replaceable. However, how can we be sure the replacement has been successful? This article explores in detail how we handle this process for KRaft controllers, with real-life insights from our operational experience.</p><h4>Replacing a KRaft Controller Node</h4><p>KRaft controllers are essential for maintaining metadata consistency and cluster coordination in modern Kafka clusters. When we need to replace a controller node, the process starts by stopping the controller service on the targeted VM.</p><p>Before terminating the VM, we back up the <strong>meta.properties</strong> file located at <em>/var/lib/kafka/data/controller/</em>, noting down the values of <em>node.id</em> and <em>cluster.id</em>. These values must match when provisioning the replacement node to ensure a smooth reintegration.</p><p>In our setup, all nodes are referred to via DNS hostnames rather than IP addresses. This allows us to easily update DNS A records, without requiring configuration changes on every broker node.</p><p>We use <a href="https://github.com/confluentinc/cp-ansible"><strong>cp-ansible</strong></a> to redeploy the controller node. By default, <em>node.id</em> is assigned based on the order of nodes defined in the <em>hosts.yml</em> file, while <em>cluster.id</em> can be specified explicitly using the <em>clusterid</em> variable.</p><p>⚠️ Although hardcoding <em>cluster.id </em>has been debated due to risks of accidentally joining the wrong cluster for the brokers, you can still set it dynamically:</p><pre>ansible-playbook -i hosts.yml confluent.platform.all \<br>- limit kraft-controller-new-node \<br>- tags kafka_controller \<br>-e &quot;clusterid=MySuperDuperClusterId&quot;</pre><p>After the replacement node joins the cluster, it will show up in the quorum list. Monitoring the quorum lag is essential. If everything is working as expected, the new node will have<em> Lag = 0</em>, and its Status will be Follower or Leader, depending on the current cluster state.</p><p>Example output from <em>kafka-metadata-quorum’s</em> describe command:</p><pre>NodeId LogEndOffset Lag Status<br>9991 88183624 0 Leader<br>9992 88183624 0 Follower<br>9993 88183624 0 Follower<br>9994 88183624 0 Follower<br>9995 88183624 0 Follower</pre><h3>Troubleshooting a KRaft Controller Node Join</h3><p>What happens if you encounter a problem with the metadata quorum? Let’s say the node you added didn’t join the cluster.</p><p>In this case, identifying the root cause of the problem is crucial. You’ll need to examine the logs to understand why the node failed to join the cluster. During one of our operational experiences, we encountered this exact situation with a single node in a cluster. To diagnose the issue, we elevated the log levels to DEBUG.</p><p>We discovered that the newly provisioned controller node was timing out while attempting to fetch metadata from the other controllers.</p><pre>[2025–07–24 11:44:16,615] DEBUG [RaftManager id=9995] Sending FETCH_SNAPSHOT request with header RequestHeader(apiKey=FETCH_SNAPSHOT, apiVersion=0, clientId=raft-client-9995, correlationId=2063, headerVersion=2) and timeout 2000 to node 9993: FetchSnapshotRequestData(clusterId=&#39;MySuperDuperClusterId&#39;, replicaId=9995, maxBytes=2147483647, topics=[TopicSnapshot(name=&#39;__cluster_metadata&#39;, partitions=[PartitionSnapshot(partition=0, currentLeaderEpoch=123371, snapshotId=SnapshotId(endOffset=89372885, epoch=123021), position=0)])]) (org.apache.kafka.clients.NetworkClient)</pre><p>⚠️ <strong>Important Note:</strong> A misbehaving node that cannot join the cluster poses a significant risk to the entire cluster. Its repeated attempts to join can negatively impact other controller nodes. We have observed instances in non-production environments where this behavior led to a complete Kafka cluster outage due to KRaft cluster quorum issues.</p><p>To solve this, we increased the <em>controller.quorum.request.timeout.ms</em> and <em>controller.quorum.fetch.timeout.ms</em> values from 2 seconds to 10 seconds. With this change, the new node was able to fetch the metadata and seamlessly join the cluster. We had missed it by just one second; our cluster could fetch the metadata in 3 seconds.</p><pre>[2025–07–24 12:04:40,782] DEBUG [RaftManager id=9995] Sending FETCH_SNAPSHOT request with header RequestHeader(apiKey=FETCH_SNAPSHOT, apiVersion=0, clientId=raft-client-9995, correlationId=29, headerVersion=2) and timeout 10000 to node 9991: FetchSnapshotRequestData(clusterId=&#39;MySuperDuperClusterId&#39;, replicaId=9995, maxBytes=2147483647, topics=[TopicSnapshot(name=&#39;__cluster_metadata&#39;, partitions=[PartitionSnapshot(partition=0, currentLeaderEpoch=123376, snapshotId=SnapshotId(endOffset=89372903, epoch=123021), position=0)])]) (org.apache.kafka.clients.NetworkClient)<br>[2025–07–24 12:04:43,952] DEBUG [RaftManager id=9995] Received FETCH_SNAPSHOT response from node 9991 for request with header RequestHeader(apiKey=FETCH_SNAPSHOT, apiVersion=0, clientId=raft-client-9995, correlationId=29, headerVersion=2): FetchSnapshotResponseData(throttleTimeMs=0, errorCode=0, topics=[TopicSnapshot(name=&#39;__cluster_metadata&#39;, partitions=[PartitionSnapshot(index=0, errorCode=0, snapshotId=SnapshotId(endOffset=89372903, epoch=123021), currentLeader=LeaderIdAndEpoch(leaderId=9991, leaderEpoch=123376), size=6606192, position=0, unalignedRecords=MemoryRecords(size=6606192, buffer=java.nio.HeapByteBuffer[pos=0 lim=6606192 cap=6606206]))])]) (org.apache.kafka.clients.NetworkClient)</pre><p><strong>Root Cause and Long-Term Solution</strong></p><p>Further investigation revealed that the size of the metadata snapshot was a key factor in these timeouts. To address this, a long-term solution was proposed to the community: enabling compression for metadata requests. This improvement would help alleviate timeout issues in environments with slower network connections. We’ve opened a support ticket to Confluent, and they’ve subsequently raised a bug and a feature request for the Kafka community:</p><ul><li>Apache Kafka<strong>:</strong><a href="https://issues.apache.org/jira/browse/KAFKA-19541"> KRaft should handle snapshot fetches under slow networks</a></li></ul><p>We confirmed that the controller node had fetched the metadata and was in sync with the quorum by using the <em>kafka-metadata-quorum</em> command. Additionally, we have the opportunity to directly read the metadata with the <em>kafka-metadata-shell</em> directory <em>/var/lib/controller/data/__cluster_metadata-0</em> command. For troubleshooting, it’s possible to check ACLs, brokers, controllers, metadata version, and topics from this directory as well.</p><pre>$ kafka-metadata-shell - directory /var/lib/controller/data/__cluster_metadata-0<br>Loading…<br>Starting…<br>[ Kafka Metadata Shell ]<br>&gt;&gt; tree .<br>image:<br>acls:<br>byId:<br>cells:<br>clientQuotas:<br>cluster:<br>brokers:<br>controllers:<br>…</pre><h4>Why Not Just Add and Remove Controllers Dynamically?</h4><p>You might be wondering, “But isn’t adding and removing controllers a new feature of Apache Kafka 3.9 and Confluent Kafka 7.9?” That’s a great question, and it’s a feature we’re eagerly waiting for.</p><p>At the time of this operation, we were running our clusters on <strong>Confluent Kafka 7.8.3</strong>. While <strong>Confluent Platform 7.9</strong> and later versions allow for a dynamic KRaft metadata quorum on <em>newly created clusters</em>, <a href="https://kafka.apache.org/39/documentation.html#kraft_reconfig:~:text=Note%3A%20Currently%20it%20is%20not%20possible%20to%20convert%20clusters%20using%20a%20static%20controller%20quorum%20to%20use%20a%20dynamic%20controller%20quorum.%20This%20function%20will%20be%20supported%20in%20the%20future%20release.">it doesn’t support</a> upgrading an existing static quorum to a dynamic one. This means we couldn’t simply use the dynamic controller removal feature.</p><p>We’ve been in touch with Confluent on this topic, and they’ve informed us that the ability to upgrade a static quorum to a dynamic one is planned for <strong>Confluent Platform 8.1</strong>. The corresponding fix is expected to be available in <a href="https://issues.apache.org/jira/browse/KAFKA-16538"><strong>Apache Kafka 4.1</strong></a>.</p><p>Since our KRaft cluster was being upgraded from 7.8.2 to 7.9.2, we couldn’t use the kafka-metadata-quorum command to remove controllers. This is precisely why we developed and documented the manual, node-by-node replacement strategy you just read about.</p><h4>Can process status be monitored through metrics?</h4><p>KRaft controller nodes obtain metadata from the leader. This process can be monitored using the fetch-records-rate metric within the raft-metrics group. Additionally, “last applied” metrics, detailed under<a href="https://kafka.apache.org/documentation/#kraft_quorum_monitoring"> Kraft quorum monitoring</a>, should consistently show progress.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/811/0*GqFhHZI70kWZCzDv" /><figcaption>Once a new controller is provisioned, it immediately begins fetching records.</figcaption></figure><h4>Conclusion</h4><p>Replacing components in a Kafka cluster, especially critical ones like KRaft controllers, doesn’t have to be risky or complex. With proper configuration management, metrics observability, and automation via tools like <strong>cp-ansible</strong>, <strong>AWX</strong> and <strong>Terraform</strong>, we’ve developed an approach that allows us to scale and upgrade with confidence.</p><p>The key is in understanding the statefulness of each component and monitoring the correct metrics during and after the replacement.</p><p>Before a controller upgrade, I recommend the following:</p><ul><li>Make sure your cluster is healthy (you can check values like misconfigured topic and Under replicated partitions).</li><li>Confirm that the follower lags in the metadata quorum are zero using the kafka-metadata-quorum command.</li><li>Review the controller.quorum.request.timeout.ms and controller.quorum.fetch.timeout.ms values based on your metadata size.</li></ul><p>At Trendyol, we view our infrastructure as a living system, capable of adapting and evolving without disruption. With every successful node replacement, we move closer to a platform that is as resilient as it is scalable.</p><p>At Trendyol, as the Data Streaming Team, we enjoy applying up-to-date best practices and sharing our hands-on experiences. If you’re curious to learn more about how we approach distributed systems and streaming infrastructure, feel free to explore other articles written by our team, I’ve linked them below!</p><ul><li><a href="https://medium.com/trendyol-tech/optimizing-kafka-performance-through-data-compression-330fb31a0827">Optimizing Kafka Performance Through Data Compression</a></li><li><a href="https://medium.com/trendyol-tech/enhancing-kafka-cluster-integrity-introducing-the-topic-creation-policy-145bb4a6ac61">Enhancing Kafka Cluster Integrity: Introducing the Topic Creation Policy</a></li><li><a href="https://medium.com/trendyol-tech/automated-kafka-broker-replacement-4376dc01e4d7">Changing Engines Mid-Flight: Automated Kafka Broker Replacements ✈️</a></li></ul><h3>Join Us</h3><p>Do you want to be a part of our growing company? We’re hiring! Check out our open positions from the links below.</p><p><a href="https://careers.trendyol.com/">Home - Trendyol Careers</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=08dc5badb018" width="1" height="1" alt=""><hr><p><a href="https://medium.com/trendyol-tech/node-replacement-in-kafka-lessons-from-a-kraft-controller-08dc5badb018">Node Replacement in Kafka: Lessons from a KRaft Controller</a> was originally published in <a href="https://medium.com/trendyol-tech">Trendyol Tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>