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 Tablet Server Startup

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

Overview

Configuration pattern for starting OpenMLDB tablet server processes using gflags command-line flags.

Description

The Tablet Server is the core data-serving component of OpenMLDB. It stores table data in memory or on disk, handles read/write requests, manages binlogs for replication, and registers itself with ZooKeeper for cluster coordination. The tablet server is started by invoking the openmldb binary with --role=tablet and a set of gflags defined in src/flags.cc. The cluster_start_component function in onebox/start_onebox.sh demonstrates the exact flag usage for both tablet and nameserver roles.

Usage

Use this pattern when starting tablet servers as part of a cluster deployment. Each tablet needs a unique endpoint, access to the ZooKeeper cluster, and filesystem paths for data and binlog storage. Multiple tablets can run on the same host for development (onebox mode).

Code Reference

Source Location

  • Repository: OpenMLDB
  • File: onebox/start_onebox.sh (cluster_start_component at L47-95), src/flags.cc (flag definitions at L19-107)

Signature

openmldb \
    --role=tablet \
    --endpoint=<ip:port> \
    --zk_cluster=<zk_endpoints> \
    --zk_root_path=<zk_path> \
    --db_root_path=<data_path> \
    --recycle_bin_root_path=<recycle_path> \
    --binlog_notify_on_put=true \
    --openmldb_log_dir=<log_dir> \
    [--enable_status_service=true] \
    [--hdd_root_path=<hdd_path>] \
    [--recycle_bin_hdd_root_path=<hdd_recycle_path>]

Key gflags (from src/flags.cc)

DEFINE_string(endpoint, "", "ip:port, config the ip and port that openmldb serves for");  // L19
DEFINE_string(role, "", "Set the openmldb role for start: tablet | nameserver | ...");     // L25-26
DEFINE_string(zk_cluster, "", "config the zookeeper cluster eg ip:2181,ip2:2181,ip3:2181"); // L34
DEFINE_string(zk_root_path, "/openmldb", "config the root path of zookeeper");               // L35
DEFINE_string(db_root_path, "/tmp/", "the root path of db");                                 // L107
DEFINE_bool(binlog_notify_on_put, false, "config the sync log to follower strategy");        // L91
DEFINE_string(recycle_bin_root_path, "/tmp/recycle", "specify the root path of recycle bin"); // L148

I/O Contract

Inputs

Name Type Required Description
endpoint string Yes ip:port for tablet service (e.g. 127.0.0.1:9520)
zk_cluster string Yes ZooKeeper cluster address (e.g. 127.0.0.1:6181)
zk_root_path string Yes ZK root path (e.g. /onebox or /openmldb)
db_root_path string Yes Filesystem path for table data storage
recycle_bin_root_path string Yes Filesystem path for recycled data
binlog_notify_on_put bool No Sync log to follower on put (default: false, onebox uses true)
openmldb_log_dir string No Log directory (default: ./logs)

Outputs

Name Type Description
Running tablet process process Tablet server registered in ZooKeeper, accepting RPC requests
Binlog files files Write-ahead log files in db_root_path for replication
Data files files Table data stored in memory or on disk (RocksDB)

Usage Examples

Onebox Cluster Tablet

# Start a tablet server for onebox development (from start_onebox.sh)
OPENMLDB_BIN=build/bin/openmldb
$OPENMLDB_BIN \
    --role=tablet \
    --endpoint=127.0.0.1:9520 \
    --zk_cluster=127.0.0.1:6181 \
    --zk_root_path=/onebox \
    --db_root_path="/work/onebox/tablet0-binlogs" \
    --recycle_bin_root_path="/work/onebox/recycle_bin0" \
    --hdd_root_path="/work/onebox/tablet0-binlogs" \
    --recycle_bin_hdd_root_path="/work/onebox/recycle_bin0" \
    --binlog_notify_on_put=true \
    --zk_keep_alive_check_interval=60000 \
    --enable_status_service=true \
    --openmldb_log_dir="/work/onebox/logs/tablet0"

Multiple Tablets for HA

# Start 3 tablets for high availability (from start_onebox.sh)
for i in 0 1 2; do
    PORT=$((9520 + i))
    $OPENMLDB_BIN \
        --role=tablet \
        --endpoint=127.0.0.1:$PORT \
        --zk_cluster=127.0.0.1:6181 \
        --zk_root_path=/onebox \
        --db_root_path="/work/tablet${i}-binlogs" \
        --recycle_bin_root_path="/work/recycle_bin${i}" \
        --binlog_notify_on_put=true \
        --openmldb_log_dir="/work/logs/tablet${i}" &
    sleep 2
done

Related Pages

Implements Principle

Uses Heuristic

Requires Environment

Page Connections

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