Metadata that scales without a master
KalDB keeps cluster metadata in ZooKeeper or etcd as one small record per object, so changes stay small as the cluster grows, and indexing and search don't depend on a master node.
KalDB doesn’t have a master node that owns the cluster state. Metadata lives in an external store, ZooKeeper or etcd, as one small record per object. Each node watches only the records it needs, every change touches only a record or two, and indexing and search keep running when the cluster manager is down.
The problem
Elasticsearch and OpenSearch keep all cluster metadata in a single cluster state: every index, mapping, shard, and node. One elected master owns it. On every change, such as a new index, a mapping update, or a shard move, the master builds a new version and publishes it to every node in the cluster.
That works for small clusters and gets harder as they grow. The cluster state grows with every index, shard, and field, so each update takes longer to build and ship, and a busy master becomes the bottleneck for the whole cluster. While no master is elected, the cluster can’t create indexes or move shards. Teams split large deployments into many smaller clusters partly to keep the cluster state manageable.
How it works
- Metadata lives outside the data nodes. KalDB stores cluster metadata in ZooKeeper or etcd, which are replicated stores built for exactly this. No KalDB node owns it.
- One small record per object. Each dataset, partition, snapshot, replica, cache slot, recovery task, and search node is its own record. The largest sets, such as snapshots, replicas, and cache slots, are split across sub-paths so that no single listing grows too large.
- Nodes watch only what they need. Each node keeps a local, cached copy of the records it uses and is told when they change. The preprocessor watches datasets, a cache node watches its own slots, and query nodes watch the list of search nodes and snapshots.
- Changes are small and local. When an indexer uploads a snapshot to S3, it writes one snapshot record. When the cluster manager assigns that snapshot to a cache node, it writes one replica record, and only that cache node acts on it.
- The manager is off the critical path. The cluster manager creates and assigns replicas, assigns recovery tasks, and cleans up expired data. The preprocessor, indexers, and query nodes don’t go through it. Indexers write their own snapshot records, and indexer and cache nodes register themselves as searchable. If the manager is down, logs keep flowing and searches keep running.
Why it matters
- Updates stay small as the cluster grows. A change writes one record, not a new version of the whole cluster state, so update cost doesn’t grow with the number of datasets, snapshots, or nodes.
- No master bottleneck. There is no single node every change has to go through.
- Fewer, larger clusters. Metadata size isn’t the reason to split a deployment, which is part of how one KalDB cluster can serve many tenants. See Tenant isolation.
- Proven stores. ZooKeeper and etcd handle replication and leader election for the metadata, so KalDB doesn’t implement its own consensus.
Trade-offs
- One more system to run. You operate a ZooKeeper or etcd ensemble alongside KalDB, and it needs to be sized and monitored like any other critical dependency.
- Nodes restart if they lose their session. A short disconnect is retried and nodes keep using their cached
records. If a node’s ZooKeeper session expires (
zkSessionTimeoutMs, 5 seconds by default), the node exits and is restarted so it rejoins with a fresh view. - The manager still matters for new data in cache. While the cluster manager is down, new snapshots are not assigned to cache nodes, recovery tasks wait, and expired data isn’t cleaned up. Indexers keep recent data searchable in the meantime, and the manager catches up from the metadata store when it comes back.
Configuration
Choose the metadata store with metadataStoreConfig.mode. The two BOTH_* modes read from both stores while writing
to one, for migrating between ZooKeeper and etcd.
metadataStoreConfig:
# ZOOKEEPER_EXCLUSIVE, ETCD_EXCLUSIVE,
# BOTH_READ_ZOOKEEPER_WRITE, or BOTH_READ_ETCD_WRITE
mode: ZOOKEEPER_EXCLUSIVE
zookeeperConfig:
zkConnectString: localhost:2181
zkPathPrefix: ASTRA
zkSessionTimeoutMs: 5000
zkConnectionTimeoutMs: 500
zkCacheInitTimeoutMs: 30000
sleepBetweenRetriesMs: 100