NanoTDB is a lightweight, append-only time-series database tailored for long-running sensor data on modest hardware such as Raspberry Pi and IoT gateways. It requires no external dependencies and simplifies data management by storing everything in plain files within a single directory.
Release 1.3.0 adds web interface with web configurable dashboards with multi line charts.
NanoTDB is a lightweight, embedded time-series database tailored for resource-limited environments such as Raspberry Pi devices, edge computing nodes, and Internet of Things (IoT) gateways. Designed with simplicity in mind, NanoTDB operates with no external dependencies, ensuring that all data is stored in plain files within a single root directory.
The architecture of NanoTDB revolves around an efficient Engine, which is the single entry point for database operations. It manages multiple named databases, including:
Each database consists of three layers to ensure data integrity and performance:
Data ingestion is accomplished using the AddLine method, accepting data in a line-protocol format. Here’s a concise example of how data is added:
AddLine("prod/room.temp 21.5 1715000000000000000")
This method efficiently parses incoming data, updates the WAL, and compresses it into the appropriate data files, while adhering to strict timestamp rules that reject out-of-order data.
To retrieve data, this database implements a QueryRange function that scans specified partitions based on provided timestamps. A sample query might look like this:
QueryRange("prod", "room.temp", fromTS, toTS, stride, callback)
Using this functionality, users can efficiently access and analyze time-series data with high precision and accuracy.
NanoTDB uses a simple line protocol for recording and processing data, which is structured as follows:
DB/metric.name value [ts]
Notably, the database automatically creates the metric and assigns correct types based on initial data entries, streamlining the input process.
The configuration file engine.toml is automatically created upon the first start. It includes key settings that allow for customization of server behavior, such as:
NanoTDB provides two main utilities:
This command starts the server and exposes a small HTTP API, enabling integration with other systems.
This utility allows users to perform offline operations on the database, such as inspecting databases and importing or exporting data in line protocol.
nanocli inspect db --root <dir>
nanocli import --root <dir> --in <file.lp>
nanocli export --root <dir> --db <name> --out <file.lp>
For developers looking to embed the database engine, NanoTDB offers a simple API:
e, err := engine.OpenEngine("/data", 0)
def e.Close()
This functionality allows for the seamless integration of time-series data management within client applications.
In summary, NanoTDB is designed for effective time-series data handling in environments where performance and resource efficiency are critical. It stands as a robust solution suitable for various applications in the realm of sensor data management and beyond.
No comments yet.
Sign in to be the first to comment.