Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:4paradigm OpenMLDB ZooKeeper Configuration

From Leeroopedia
Knowledge Sources
Domains Deployment, Distributed_Systems
Last Updated 2026-10-12 12:00 GMT

Overview

Configuration tool for setting up ZooKeeper as the distributed coordination service for an OpenMLDB cluster.

Description

OpenMLDB relies on Apache ZooKeeper for cluster coordination — service discovery, leader election, and metadata storage. The ZooKeeper_Configuration implementation covers the steps to prepare a ZooKeeper instance from a tarball: copying the sample configuration file to zoo.cfg, starting the ZooKeeper server via zkServer.sh start, and configuring the zk_cluster and zk_root_path parameters that OpenMLDB components use to connect.

Usage

Use this implementation when deploying an OpenMLDB cluster (not standalone mode). ZooKeeper must be running before any tablet or nameserver processes start. For development, a single ZooKeeper node suffices; for production, a ZooKeeper ensemble of 3 or 5 nodes is recommended.

Code Reference

Source Location

  • Repository: OpenMLDB
  • File: demo/setup_openmldb.sh (zoo.cfg setup at L42-45), demo/init.sh (zkServer.sh at L50), onebox/start_onebox.sh (ZK_CLUSTER at L97)

Signature

# 1. Configure ZooKeeper
cp conf/zoo_sample.cfg conf/zoo.cfg

# 2. Start ZooKeeper
bin/zkServer.sh start

# 3. OpenMLDB components connect via:
--zk_cluster=<ip:port>[,<ip:port>...]  # e.g. 127.0.0.1:6181
--zk_root_path=<path>                   # e.g. /openmldb or /onebox

Import

# ZooKeeper is an external dependency, started via its own scripts
cd /work/zookeeper-3.4.14
cp conf/zoo_sample.cfg conf/zoo.cfg
bin/zkServer.sh start

I/O Contract

Inputs

Name Type Required Description
zoo_sample.cfg file Yes Template config included in ZooKeeper tarball
ZK port int No Default port 2181 (onebox uses 6181 via custom config)
dataDir path No Default /tmp/zookeeper (may need cleanup on restart)

Outputs

Name Type Description
Running ZK instance process ZooKeeper server accessible at configured endpoint
zoo.cfg file ZooKeeper configuration file copied from sample

Usage Examples

Onebox Development Setup

# Start ZooKeeper for onebox development (port 6181)
cd /work/zookeeper-3.4.14
cp conf/zoo_sample.cfg conf/zoo.cfg

# Clean previous state if needed
rm -rf /tmp/zookeeper
bin/zkServer.sh start
sleep 1

# Verify it's running
echo ruok | nc 127.0.0.1 6181
# Expected: imok

Production Ensemble (Conceptual)

# For production, configure a 3-node ZooKeeper ensemble
# In each node's zoo.cfg:
#   server.1=node1:2888:3888
#   server.2=node2:2888:3888
#   server.3=node3:2888:3888
# Then start each node:
bin/zkServer.sh start

# OpenMLDB connects to the ensemble:
# --zk_cluster=node1:2181,node2:2181,node3:2181
# --zk_root_path=/openmldb

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment