Principle:4paradigm OpenMLDB Server Role Configuration
| Knowledge Sources | |
|---|---|
| Domains | Distributed_Systems, Deployment |
| Last Updated | 2026-10-12 12:00 GMT |
Overview
A role-based server configuration pattern where a single binary assumes different responsibilities (data serving, metadata management, client interface) based on a configuration flag.
Description
OpenMLDB uses a single-binary, multi-role architecture: the same openmldb binary can run as a tablet server, nameserver, or client depending on the --role flag. This pattern simplifies deployment and version management — only one binary needs to be built and distributed. The tablet role handles data storage and serving; the nameserver role manages metadata, partition assignment, and failover; the ns_client, client, and sql_client roles provide CLI interfaces for administration and SQL execution.
This pattern is analogous to how Google File System separates chunkservers from the master, but uses a single binary with role separation via configuration rather than separate binaries.
Usage
Use this principle when designing a distributed system where components share significant code but have distinct runtime responsibilities. It is particularly effective when deployment simplicity is important and when roles may need to run on the same host during development.
Theoretical Basis
The role configuration pattern separates identity from capability:
Where:
- Binary is the shared codebase
- Role determines which services and handlers are activated
- Configuration provides role-specific parameters (ports, paths, cluster addresses)
Role-based flag activation:
# Abstract algorithm (NOT real implementation)
role = flags.role # tablet | nameserver | client | ...
if role == "tablet":
activate_data_storage()
register_with_zookeeper(zk_cluster, zk_root_path, endpoint)
serve_rpc(endpoint)
elif role == "nameserver":
connect_to_zookeeper(zk_cluster, zk_root_path)
discover_tablets()
manage_metadata()
serve_rpc(endpoint)
Practical Guide
- Tablet servers need filesystem paths (
db_root_path,recycle_bin_root_path) for data - Nameservers need tablet connection info — either via ZooKeeper (cluster) or
--tabletflag (standalone) - The
--interactive=falseflag enables scriptable non-interactive mode for clients - Heartbeat timeout and check interval should be short for development, longer for production