Implementation:4paradigm OpenMLDB init sh
| Knowledge Sources | |
|---|---|
| Domains | Deployment, DevOps |
| Last Updated | 2026-10-12 12:00 GMT |
Overview
Initialization script for starting an OpenMLDB cluster or standalone instance with demo data preparation.
Description
The init.sh script is the entry point for initializing an OpenMLDB environment in either cluster or standalone mode. It detects the installation layout (sbin/ for full deploy vs bin/ for basic), stops any existing processes, cleans previous state, starts ZooKeeper (cluster mode), and starts all OpenMLDB components. In standalone mode, it also converts demo data for the taxi-trip scenario. The script is called by Docker Compose during demo tests.
Usage
Use this script after setup_openmldb.sh has installed dependencies. Run with cluster (default) or standalone as the first argument. It is the standard way to initialize a demo or development environment.
Code Reference
Source Location
- Repository: OpenMLDB
- File: demo/init.sh
Signature
# Usage: init.sh [cluster|standalone]
# Default mode: cluster
init.sh [cluster|standalone]
Import
# Run from the demo directory
cd demo
bash init.sh cluster
# or
bash init.sh standalone
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| MODE | string | No | cluster (default) or standalone
|
| /work/openmldb | directory | Yes | Installed OpenMLDB from setup_openmldb.sh |
| /work/zookeeper-3.4.14 | directory | Yes (cluster) | ZooKeeper installation (cluster mode only) |
Outputs
| Name | Type | Description |
|---|---|---|
| Running cluster | processes | OpenMLDB tablet(s), nameserver(s), and ZooKeeper (cluster mode) |
| Demo data | files | Converted taxi_tour.csv (standalone mode) |
Usage Examples
Cluster Mode
# Initialize cluster mode (default)
cd /work
bash init.sh cluster
# This runs:
# 1. cd /work/zookeeper-3.4.14 && zkServer.sh stop && rm -rf /tmp/zookeeper && zkServer.sh start
# 2. cd /work/openmldb && ./bin/stop-all.sh && ./bin/start-all.sh
Standalone Mode
# Initialize standalone mode (no ZooKeeper)
bash init.sh standalone
# This runs:
# 1. python3 /work/taxi-trip/convert_data.py < .../taxi_tour_table_train_simple.csv > .../taxi_tour.csv
# 2. cd /work/openmldb && ./bin/stop-standalone.sh && ./bin/start-standalone.sh