Environment:4paradigm OpenMLDB ZooKeeper 3 4 14
| Knowledge Sources | |
|---|---|
| Domains | Infrastructure, Distributed_Systems |
| Last Updated | 2026-10-12 16:00 GMT |
Overview
Apache ZooKeeper 3.4.14 coordination service required for OpenMLDB distributed cluster mode operation.
Description
ZooKeeper 3.4.14 is the mandatory coordination service for OpenMLDB cluster deployments. It provides service discovery, leader election for nameservers, and distributed locking for tablet servers. The OpenMLDB binary connects to ZooKeeper via the --zk_cluster flag (comma-separated ip:port list) and registers under --zk_root_path (default /openmldb). The demo and onebox setups use a single-node ZooKeeper at port 6181 or 2181. ZooKeeper is downloaded as a pre-built tarball from the Apache archive and configured with the bundled zoo_sample.cfg.
Usage
Use this environment for any cluster mode OpenMLDB deployment. It is the mandatory prerequisite for the Tablet_Server_Startup, Nameserver_Startup, ZooKeeper_Configuration, SQL_Deploy_Statement, and init_sh implementations. Standalone mode does NOT require ZooKeeper.
System Requirements
| Category | Requirement | Notes |
|---|---|---|
| OS | Linux (any) | JVM-based; requires Java runtime |
| Hardware | 1GB+ RAM | Single node for dev; 3+ nodes for production ensemble |
| Disk | 1GB+ | For ZooKeeper data directory and transaction logs |
| Java | JDK 8+ | ZooKeeper 3.4.14 requires Java 8 or later |
Dependencies
System Packages
java(JRE 8+) — ZooKeeper runs on JVMzookeeper= 3.4.14 — downloaded aszookeeper-3.4.14.tar.gz
Configuration
conf/zoo.cfg— copied fromzoo_sample.cfgin demo setup- Data directory:
/tmp/zookeeper(default, demo); configurable inzoo.cfg
Credentials
No credentials required for basic single-node setup. The following are optional for secured clusters:
zk_auth_schema— authentication schema (default:digest)zk_cert— application credentials for authenticated ZooKeeper access
Quick Install
# Download and extract ZooKeeper 3.4.14
curl -SLO https://archive.apache.org/dist/zookeeper/zookeeper-3.4.14/zookeeper-3.4.14.tar.gz
tar xzf zookeeper-3.4.14.tar.gz -C /work
cd /work/zookeeper-3.4.14
cp conf/zoo_sample.cfg conf/zoo.cfg
# Start ZooKeeper
./bin/zkServer.sh start
# Verify
echo "ruok" | nc localhost 2181
Code Evidence
ZooKeeper download from `demo/setup_openmldb.sh:25,33,42-45`:
ZK_TAR="zookeeper-3.4.14.tar.gz"
curl -SLO "https://archive.apache.org/dist/zookeeper/zookeeper-3.4.14/${ZK_TAR}"
tar xzf "${ZK_TAR}" -C "$WORKDIR"
pushd $WORKDIR/zookeeper-3.4.14/
cp conf/zoo_sample.cfg conf/zoo.cfg
popd
ZooKeeper startup in cluster init from `demo/init.sh:50-52`:
cd /work/zookeeper-3.4.14 && ./bin/zkServer.sh stop && rm -rf /tmp/zookeeper && ./bin/zkServer.sh start
sleep 1
cd /work/openmldb && ./bin/stop-all.sh && ./bin/start-all.sh
ZooKeeper cluster configuration flags from `src/flags.cc:30-37`:
DEFINE_int32(zk_session_timeout, 2000,
"config the zk session timeout of cli in milliseconds, apiserver, tablet or nameserver");
DEFINE_string(zk_cluster, "", "config the zookeeper cluster eg ip:2181,ip2:2181,ip3:2181");
DEFINE_string(zk_root_path, "/openmldb", "config the root path of zookeeper");
DEFINE_string(zk_auth_schema, "digest", "config the id of authentication schema");
DEFINE_string(zk_cert, "", "config the application credentials");
ZooKeeper in onebox cluster from `onebox/start_onebox.sh:92-97`:
"$OPENMLDB_BIN" \
--role="$role" \
--endpoint="$endpoint" \
--zk_cluster="$zk_end" \
--zk_root_path="$zk_path" \
$extra_opts
Common Errors
| Error Message | Cause | Solution |
|---|---|---|
zk client init failed |
ZooKeeper not running or unreachable | Start ZK: ./bin/zkServer.sh start; verify --zk_cluster address
|
session timeout |
ZK session expired (default 2000ms) | Increase --zk_session_timeout for slow networks
|
connection loss |
Network partition or ZK down | Restart ZK; use 3-node ensemble for HA |
| ZooKeeper data corruption | Unclean shutdown | rm -rf /tmp/zookeeper and restart (dev only)
|
Compatibility Notes
- Version 3.4.14: Pinned version; OpenMLDB has not been tested with ZooKeeper 3.5+.
- Single-node (dev): Default in demo and onebox setups; no HA for ZooKeeper itself.
- Multi-node (production): Use 3 or 5 node ensemble for ZooKeeper HA; set
server.Nentries inzoo.cfg. - gcc >= 9: Building ZooKeeper C client from source may fail; apply patch with
-DBUILD_ZOOKEEPER_PATH=ON. - Standalone mode: OpenMLDB standalone mode does NOT use ZooKeeper.