Quick Start Guide
Build and evaluate MynaDB locally; the initial build can take several minutes. This guide covers building, running, writing data, and querying with MynaDB.
Prerequisites
- A recent stable Rust toolchain (this review uses 1.92.0) (install via rustup)
- C/C++ compiler, pkg-config, OpenSSL development files, and protoc (plus CMake if required by native dependencies)
- curl (for testing the API)
Step 1: Build and Run
# Clone the repository
git clone https://github.com/panbooks/mynadb.git
cd mynadb
# Build in release mode
cargo build --locked --profile fast-release
# Run the server
./target/fast-release/mynadb -c examples/quickstart.toml standalone
Keep the server running and check health in another terminal (expect HTTP 200 and OK):
curl --fail http://127.0.0.1:7000/health
Development status: Evaluate with disposable local data. The example binds to loopback and disables WAL and authentication; successfully call POST /flush before testing restart persistence. This does not establish WAL crash recovery. Validation scope
Step 2: Write Data
MynaDB accepts data in InfluxDB Line Protocol format:
<measurement>,<tag_key>=<tag_value> <field_key>=<field_value> [timestamp]
Write some sample data:
# Write CPU and memory metrics
curl -X POST http://localhost:7000/write/mydb -d '
cpu,host=server01,region=us-west usage=75.5,temp=45
cpu,host=server02,region=us-west usage=45.2,temp=38
cpu,host=server03,region=us-east usage=89.1,temp=52
memory,host=server01 used=16.5,total=32.0
memory,host=server02 used=24.8,total=64.0
memory,host=server03 used=12.2,total=32.0
'
The database (mydb) is automatically created when you first write to it. No need to create it explicitly!
Step 3: Query with SQL
No need to flush! MynaDB's Memtable provides immediate query visibility for fresh writes. The query engine automatically combines data from memory (unflushed) and Parquet files (flushed).
Now query your data using standard SQL:
Basic Select
# Select all CPU data
curl 'http://localhost:7000/query/mydb' -d 'SELECT * FROM cpu'
Aggregation
# Average CPU usage by host
curl 'http://localhost:7000/query/mydb' \
-d 'SELECT host, AVG(usage) as avg_cpu FROM cpu GROUP BY host'
Result:
[
{"host": "server01", "avg_cpu": 75.5},
{"host": "server02", "avg_cpu": 45.2},
{"host": "server03", "avg_cpu": 89.1}
]
Filtering
# High CPU usage servers
curl 'http://localhost:7000/query/mydb' \
-d 'SELECT host, usage FROM cpu WHERE usage > 70 ORDER BY usage DESC'
JOIN Queries
# Join CPU and memory data
curl 'http://localhost:7000/query/mydb' -d "
SELECT c.host, c.usage as cpu_usage, m.used as memory_used
FROM cpu c
JOIN memory m ON c.host = m.host
"
Step 4: List Tables
See what tables are available in your database:
curl http://localhost:7000/tables/mydb
Result:
{
"catalog": "mydb",
"tables": ["mydb.default.cpu", "mydb.default.memory"],
"count": 2
}
Step 5: Flush, Restart and Stop
This example disables WAL. Successfully flush before stopping and restarting, then repeat the SQL query above to check persisted data. This does not test recovery of unflushed writes after a crash.
curl --fail -X POST http://127.0.0.1:7000/flush
./target/fast-release/mynadb -c examples/quickstart.toml stop
./target/fast-release/mynadb -c examples/quickstart.toml standaloneStop with the same stop command or Ctrl+C when finished. Disposable example data and logs are under data/quickstart and logs/quickstart; clean up only your test files after the process exits.
Summary
You've successfully:
- ✓ Built and started MynaDB
- ✓ Written time series data using Line Protocol
- ✓ Queried data immediately (no flush needed!)
- ✓ Used SQL with aggregations and JOINs
- ✓ Listed available tables