druid/docs/design/zookeeper.md
Kashif Faraz aa49be61ea
Do not create ZK paths if not needed (#16816)
Background:
ZK-based segment loading has been completely disabled in #15705 .
ZK `servedSegmentsPath` has been deprecated since Druid 0.7.1, #1182 .
This legacy path has been replaced by the `liveSegmentsPath` and is not used in the code anymore.

Changes:
- Never create ZK loadQueuePath as it is never used.
- Never create ZK servedSegmentsPath as it is never used.
- Do not create ZK liveSegmentsPath if announcement on ZK is disabled
- Fix up tests
2024-08-06 19:29:13 +05:30

2.6 KiB

id title
zookeeper ZooKeeper

Apache Druid uses Apache ZooKeeper (ZK) for management of current cluster state.

Minimum ZooKeeper versions

Apache Druid supports ZooKeeper versions 3.5.x and above.

:::info Note: Starting with Apache Druid 0.22.0, support for ZooKeeper 3.4.x has been removed Starting with Apache Druid 31.0.0, support for Zookeeper-based segment loading has been removed. :::

ZooKeeper Operations

The operations that happen over ZK are

  1. Coordinator leader election
  2. Segment "publishing" protocol from Historical
  3. Overlord leader election
  4. Overlord and MiddleManager task management

Coordinator Leader Election

We use the Curator LeaderLatch recipe to perform leader election at path

${druid.zk.paths.coordinatorPath}/_COORDINATOR

Segment "publishing" protocol from Historical and Realtime

The announcementsPath and liveSegmentsPath are used for this.

All Historical processes publish themselves on the announcementsPath, specifically, they will create an ephemeral znode at

${druid.zk.paths.announcementsPath}/${druid.host}

Which signifies that they exist. They will also subsequently create a permanent znode at

${druid.zk.paths.liveSegmentsPath}/${druid.host}

And as they load up segments, they will attach ephemeral znodes that look like

${druid.zk.paths.liveSegmentsPath}/${druid.host}/_segment_identifier_

Processes like the Coordinator and Broker can then watch these paths to see which processes are currently serving which segments.