Learn how to develop applications with LindormTSDB, from selecting an SDK to writing and querying time series data.
Application development steps
To develop your application, complete the following steps.
1. Select a software development kit (SDK)
Lindorm provides several SQL-based interfaces for applications to access LindormTSDB.
-
For applications developed in Java: Lindorm provides the Java Native SDK and the Java Database Connectivity (JDBC) Driver.
The Java Native SDK is recommended. It provides connection management, batch data writing, and retries, and optimizes data transmission encoding for higher write efficiency.
-
For applications developed in other languages: Lindorm provides HTTP-based APIs and a line protocol for writing data.
Use the line protocol to write data and the SQL interface provided by the HTTP API to query data.
2. Data modeling
Create a database and time series data tables based on your business scenario. Define the tags, timestamps, and metric values for your tables, and set a PRIMARY KEY for data partitioning. For more information, see Data model.
LindormTSDB provides three schema constraint policies: strong, weak, and none. These policies correspond to schema and schemaless scenarios. For more information, see Schema constraints.
3. Write data
LindormTSDB supports several write methods, including the Java Native SDK, line protocol, and standard SQL. The Java Native SDK, line protocol, and multi-value writes compatible with the TSDB interface offer a weak schema constraint, which supports automatic table creation in schemaless scenarios. Choose a write method based on your requirements.
4. Query data
LindormTSDB provides standard SQL access and extends SQL with time series features to support downsampling, aggregation, and latest value queries.
5. Continuous queries
For big data query scenarios, continuous queries pre-aggregate new data, reducing the data volume for real-time queries and lowering query latency.
6. Pre-downsampling
Pre-downsampling stores raw data at a lower precision based on your rules as it is written. Downsampling queries against this low-precision data reduce the data volume and lower query latency for long time ranges.
Development steps for applications using OpenTSDB or Time Series Database (TSDB)
LindormTSDB is compatible with OpenTSDB and TSDB interfaces. To migrate an existing OpenTSDB or TSDB application, complete the following steps:
-
Adapt the application
-
Update the connection string in your application to point to LindormTSDB. For more information, see View endpoints.
-
Adapt your application to LindormTSDB features.
-
For applications developed with HTTP APIs: The HTTP APIs supported by LindormTSDB are highly compatible with TSDB APIs.
-
For Java applications developed with the TSDB SDK: LindormTSDB is compatible with over 90% of TSDB features, enabling a nearly seamless migration.
-
When writing with the multi-value model, data is written to the `default` database by default. The schema constraint policy defaults to `none`, so time series data tables are not automatically created. To query data with SQL, manually create the tables or set the schema constraint policy to `weak`. SQL is recommended because LindormTSDB provides more time series features and better performance with SQL.
-
When writing with the OpenTSDB or single-value model, the schema constraint policy is `none`. This means you cannot create time series data tables, and SQL queries are not supported.
-
-
Connect your application to LindormTSDB for testing. After the tests pass, deploy the application.
-
-
Migrate data
LindormTSDB supports full data migration from TSDB. For more information, see Full migration from TSDB to LindormTSDB.
Development steps for applications using Prometheus
LindormTSDB supports the `remote_write` and `remote_read` interfaces, serving as a remote storage backend for Prometheus. It also provides native Prometheus Query Language (PromQL) query capabilities. For more information, see Access LindormTSDB using Prometheus.
Development steps for applications using InfluxDB
LindormTSDB supports writing data using the InfluxDB-compatible line protocol. For more information, see Line protocol reference.