Skip to content

About

Run TDengine 3 in Docker and model devices with super tables, tags, and time-series queries.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

Arya Fatthurahman

TDengine Lab

Run TDengine 3 in Docker and model devices with super tables, tags, and time-series queries.

Database: TDengine Category: Time-series / IoT Runs in Docker License: MIT compose-check

What this lab is

TDengine is a time-series database designed for IoT and telemetry. Its super-table model groups many device tables under one schema, which keeps queries simple without sacrificing per-device storage. This lab creates a super table, two devices, and a few queries.

Quickstart

docker compose up -d
docker compose cp examples/01_schema.sql tdengine:/tmp/01_schema.sql
docker compose cp examples/02_queries.sql tdengine:/tmp/02_queries.sql
docker compose exec tdengine taos -f /tmp/01_schema.sql
docker compose exec tdengine taos -f /tmp/02_queries.sql

Connection details

Field Value
Native port 6030
REST port 6041
User root
Password taosdata
CLI docker compose exec tdengine taos
REST http://localhost:6041/rest/sql

Examples

File What it shows
docker-compose.yml Engine, ports, and persistent volume.
.github/workflows/compose-check.yml Validates the Compose file on every push.
examples/01_schema.sql Database, super table, and two device tables.
examples/02_queries.sql Aggregate the super table and inspect device tags.

Exercises

  1. Add a third device and query the last 10 readings across all devices.
  2. Use INTERVAL(1m) to bucket readings and compute the average current.
  3. Query the REST endpoint with curl and the root:taosdata credentials.
  4. Create a stream that writes a downsampled table.

Notes and limits

  • The default root password is taosdata. Change it before exposing the ports.
  • TDengine 3 uses super tables and tags instead of a traditional relational schema for devices.
  • The REST endpoint accepts SQL in the request body with Basic authentication.
  • Data persists in the tdengine-data volume.

Run it from anywhere

This lab publishes its ports on 127.0.0.1 only. To use it from another country, do not open the database port to the internet. Pick one:

  • VPS + private tunnel: run the lab on a small Ubuntu VPS, keep the port closed, and connect through WireGuard or ssh -L.
  • Managed service: use a managed free tier for this engine and point the same examples at its connection string.
  • HTTP UI only: if the engine has a web UI, put it behind Caddy with TLS and basic auth.

The shared checklist, provider map, and commands are in REMOTE-ACCESS.md.

Cleanup

docker compose down -v

-v also removes the named volume, so the next start is a clean slate.

References


Part of the database-labs collection: 26 database engines, one index.

License

MIT (c) 2026 Arya Fatthurahman. See LICENSE.

About

Run TDengine 3 in Docker and model devices with super tables, tags, and time-series queries.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors