/data-messaging-skills:kafka-cluster-configurationfrom data-messaging-skills
Designs Apache Kafka broker configuration, topic/partition layout, replication factor, and cluster metadata mode (ZooKeeper vs. KRaft). Use when sizing a Kafka cluster, setting replication factor, designing topic partitions, configuring brokers, migrating to KRaft, or setting up a new cluster.
Ships in data-messaging-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Apache Kafka's durability, availability, and throughput are determined
almost entirely at configuration time — by how many partitions a topic
gets, what replication factor and min.insync.replicas it's given, and
whether the cluster's metadata is managed by ZooKeeper or Kafka's own
KRaft (Kafka Raft) controller quorum. Getting these choices wrong is
expensive to undo later: repartitioning an existing topic breaks key-based
ordering guarantees, and under-replicated topics silently risk data loss
until a broker actually fails. This skill covers designing that
configuration correctly the first time — validating it before rollout is
covered separately in
kafka-configuration-validation.
server.properties for durability gaps
(e.g. replication factor of 1, min.insync.replicas unset).process.roles.log.retention.hours (or .bytes) × expected topic
throughput × replication factor — replicated data multiplies raw disk
need by the replication factor.Decide ZooKeeper vs. KRaft for a new cluster. For any new Kafka deployment, prefer KRaft — it removes the operational burden of running and upgrading a separate ZooKeeper ensemble and has a higher practical ceiling on partition count per cluster since metadata isn't bottlenecked through ZooKeeper's znode model. Only choose ZooKeeper mode if the target Kafka distribution/version doesn't yet support KRaft for the required feature set, or if migrating an existing large ZooKeeper-mode cluster where the KRaft migration path isn't yet validated for that version.
Configure a KRaft controller quorum (3 dedicated controller nodes is the common baseline for production; combined broker+controller nodes are acceptable for smaller/dev clusters):
# controller node: controller.properties
process.roles=controller
node.id=1
controller.quorum.voters=1@kraft-ctrl-1:9093,2@kraft-ctrl-2:9093,3@kraft-ctrl-3:9093
listeners=CONTROLLER://kraft-ctrl-1:9093
controller.listener.names=CONTROLLER
# broker node: server.properties
process.roles=broker
node.id=101
controller.quorum.voters=1@kraft-ctrl-1:9093,2@kraft-ctrl-2:9093,3@kraft-ctrl-3:9093
listeners=PLAINTEXT://:9092
advertised.listeners=PLAINTEXT://broker-101.internal:9092
log.dirs=/var/kafka/data
An odd number of controller voters (3 or 5) is required so the Raft quorum can form a majority on a network partition.
For ZooKeeper mode, point brokers at the ensemble and give each a
stable broker.id:
# server.properties
broker.id=101
zookeeper.connect=zk-1:2181,zk-2:2181,zk-3:2181/kafka
listeners=PLAINTEXT://:9092
advertised.listeners=PLAINTEXT://broker-101.internal:9092
log.dirs=/var/kafka/data
The /kafka chroot path in zookeeper.connect keeps this cluster's
znodes isolated if the ensemble is shared with other systems.
Set cluster-wide durability defaults so individual topic creators don't have to remember to override an unsafe default:
default.replication.factor=3
min.insync.replicas=2
unclean.leader.election.enable=false
offsets.topic.replication.factor=3
transaction.state.log.replication.factor=3
transaction.state.log.min.isr=2
unclean.leader.election.enable=false is the important one — it
refuses to elect an out-of-sync replica as leader after the in-sync
set is empty, which prevents silent data loss at the cost of
unavailability until an in-sync replica returns.
Size partition count per topic from required consumer parallelism and target per-partition throughput, not a round number picked without reasoning:
kafka-topics.sh --bootstrap-server broker-101.internal:9092 \
--create --topic order-events \
--partitions 12 --replication-factor 3 \
--config min.insync.replicas=2 \
--config retention.ms=604800000
A partition count should be at least the maximum number of consumer instances that will ever run in the largest consumer group reading that topic (extra consumers beyond the partition count sit idle), and high enough that a single partition's throughput stays within one broker's practical per-partition write throughput. Over-partitioning has a real cost too — see the rebalance and metadata pitfalls in kafka-consumer-lag-and-partition-troubleshooting.
Enable rack awareness so Kafka spreads a topic's replicas across failure domains instead of colocating them:
# server.properties, one value per broker matching its physical AZ/rack
broker.rack=us-east-1a
With broker.rack set on every broker, Kafka's replica placement
algorithm guarantees no two replicas of the same partition land in the
same rack when enough racks exist — a single AZ outage then can't take
out both the leader and all in-sync replicas of a partition
simultaneously.
Tune log segment and retention settings deliberately per topic, overriding cluster defaults for topics with different retention needs:
kafka-configs.sh --bootstrap-server broker-101.internal:9092 \
--alter --entity-type topics --entity-name order-events \
--add-config retention.ms=604800000,segment.bytes=1073741824
Compacted topics (state/changelog topics) need cleanup.policy=compact
instead of time-based retention — see
kafka-configuration-validation
for validating that the right policy is applied before production
rollout.
min.insync.replicas=2 (with RF=3) with producers using acks=all
— min.insync.replicas alone does nothing to protect a producer that
doesn't wait for acknowledgment from the in-sync set.broker.rack (or the cloud-provider equivalent) on every broker
from day one — it's far more disruptive to add rack awareness to an
already-populated cluster (existing partitions don't automatically
reshuffle) than to configure it before any topics are created.Symptom: A broker goes down and an entire topic becomes
unavailable for writes, even though other brokers are healthy.
Fix: Check min.insync.replicas versus the topic's actual
replication factor and current in-sync replica count
(kafka-topics.sh --describe --topic <topic>). If RF=3 and
min.insync.replicas=2 but a second replica was already lagging before
this broker failure, the ISR set dropped below the minimum and
producers with acks=all are correctly refused rather than silently
under-protected — the fix is addressing why replicas were already
lagging (see under-replicated-partition causes in
kafka-consumer-lag-and-partition-troubleshooting),
not lowering min.insync.replicas.
Symptom: A topic created early in the cluster's life with 3 partitions can't keep up, and someone increases it to 50 partitions to "fix" throughput. Fix: Increasing partition count on an existing topic does not rebalance existing data and, critically, changes which partition a given key hashes to — messages for the same key produced before and after the partition increase can land in different partitions, breaking per-key ordering guarantees consumers may depend on. Size partition count correctly at topic-creation time based on projected peak throughput, and if a genuine increase is unavoidable, communicate the ordering-guarantee change to every consuming team first.
Symptom: After migrating a cluster from ZooKeeper to KRaft (or
after any broker.rack change), replica placement doesn't actually
spread across racks the way broker.rack implies.
Fix: broker.rack only affects placement decisions made after
it's set — existing partitions keep their existing replica assignment.
Run kafka-reassign-partitions.sh with a rack-aware generated
assignment to actually move existing replicas onto the intended racks;
simply setting the property on already-populated brokers changes
nothing for existing topics.
Symptom: A cluster with unclean.leader.election.enable=true (or
unset, defaulting to disabled in modern versions but historically
enabled in older ones) loses committed messages after a multi-broker
outage.
Fix: With unclean leader election enabled, Kafka will elect an
out-of-sync replica as leader rather than stay unavailable, silently
losing any messages the new leader hadn't yet replicated. Explicitly
set unclean.leader.election.enable=false for any topic where
correctness matters more than availability during a multi-broker
outage, and treat re-enabling it as an emergency-only, explicitly
reasoned-about action — not a standing configuration.
Scenario: A new 3-broker KRaft cluster, spread across three AWS AZs,
hosting an order-events topic for an order-processing pipeline that
needs strict ordering per customer_id and must survive a single AZ
outage without data loss.
Controller quorum (3 dedicated controller nodes):
process.roles=controller
node.id=1
controller.quorum.voters=1@kraft-ctrl-1:9093,2@kraft-ctrl-2:9093,3@kraft-ctrl-3:9093
listeners=CONTROLLER://kraft-ctrl-1:9093
controller.listener.names=CONTROLLER
Broker configuration (repeated per broker with unique node.id,
advertised.listeners, and broker.rack):
process.roles=broker
node.id=101
controller.quorum.voters=1@kraft-ctrl-1:9093,2@kraft-ctrl-2:9093,3@kraft-ctrl-3:9093
listeners=PLAINTEXT://:9092
advertised.listeners=PLAINTEXT://broker-101.us-east-1a.internal:9092
broker.rack=us-east-1a
log.dirs=/var/kafka/data
default.replication.factor=3
min.insync.replicas=2
unclean.leader.election.enable=false
offsets.topic.replication.factor=3
Topic creation, sized for a projected 40 MB/s peak and up to 12 concurrent consumer instances in the largest consumer group:
kafka-topics.sh --bootstrap-server broker-101.us-east-1a.internal:9092 \
--create --topic order-events \
--partitions 12 --replication-factor 3 \
--config min.insync.replicas=2 \
--config retention.ms=604800000 \
--config cleanup.policy=delete
Producers key on customer_id, so all 12 partitions carry a stable
per-key mapping from day one — no partition-count change is planned,
avoiding the ordering-break pitfall above. With broker.rack set on all
three brokers before this topic was created, Kafka's replica placement
spreads each partition's 3 replicas one-per-AZ, so losing any single AZ
still leaves 2 in-sync replicas — satisfying min.insync.replicas=2 and
keeping the topic writable throughout the outage.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub selvarajmurugesan90/ops-engineering-skills --plugin data-messaging-skills13 skills in this plugin
/airflow-dag-authoring-and-validationAuthors Apache Airflow DAGs — task dependencies, operator choice, sensors, idempotency — and validates them with `airflow dags test`, import-time checks, and DAG linting before they reach a production scheduler. Use when the user asks to "write an Airflow DAG," "add a task dependency," "use a sensor to wait for a file/table," "validate a DAG before deploying it," "lint an Airflow DAG," or reviews a DAG file for correctness before merge.
/airflow-scheduler-and-dag-troubleshootingDiagnoses a stuck or failed Airflow DAG run, scheduler-health problems (slow parsing, stuck queued tasks), and plans safe task-retry/backfill strategy. Use when the user reports "Airflow DAG is stuck," "task stuck in queued state," "scheduler seems unhealthy," "DAG run failed and I need to retry it," "should I backfill this DAG," or asks to troubleshoot a live Airflow production incident.
/dagster-and-prefect-pipeline-authoringAuthors data pipelines with Dagster's asset-based model or Prefect's Pythonic flow/task model as modern alternatives to Airflow, and gives a decision framework for when each fits better than task-based DAG orchestration. Use when the user asks to "write a Dagster asset," "define a Prefect flow," "should we use Dagster instead of Airflow," "asset-based vs. task-based orchestration," or is evaluating a data-orchestration tool for a new pipeline.
/kafka-configuration-validationValidates Kafka topic configuration (retention, cleanup policy, replication, min.insync.replicas) and consumer group settings before a production rollout. Use when the user asks to "review a Kafka topic config before deploying," "validate retention/compaction settings," "check consumer group config for a new service," or "audit Kafka topics for production readiness" prior to go-live.
/kafka-consumer-lag-and-partition-troubleshootingDiagnoses growing Kafka consumer lag, rebalance storms, and under-replicated partitions in a running cluster. Use when the user reports "consumer lag keeps growing," "consumer group stuck rebalancing," "under-replicated partitions," "Kafka consumers keep dropping out of the group," or asks to troubleshoot a Kafka production incident involving lag or partition health.
/kafka-schema-registry-and-compatibility-managementManages Avro/Protobuf/JSON Schema in a schema registry for Kafka topics, including compatibility mode selection (backward/forward/full) and schema evolution that doesn't break existing consumers. Use when the user asks to "register a Kafka schema," "change compatibility mode," "evolve an Avro schema without breaking consumers," "add a field to a Kafka message schema," or troubleshoots a schema-registry rejection or a consumer deserialization failure after a schema change.
Other plugins' skills for the same job