If you already have applications or devices that send data in InfluxDB line protocol format, you can point them at LindormTSDB without any code changes. LindormTSDB exposes the same /api/v2/write endpoint, so existing InfluxDB-compatible collectors work out of the box.
Prerequisites
Before you begin, ensure that you have:
A running LindormTSDB instance
The LindormTSDB proxy endpoint URL and port (default: 8242)
(Optional) A username and password, if authentication is enabled on your instance
Write data points
Send line protocol data to the /api/v2/write endpoint using an HTTP POST request.
| Requirement | How to provide it |
|---|---|
| Endpoint | POST http://<endpoint>:8242/api/v2/write |
| Data | Line protocol text in the request body |
precision (optional) | Query parameter. Default: ns. Valid values: ns, us, ms, s, m, h |
db (optional) | Query parameter. Target database name |
schema_policy (optional) | Query parameter. Default: WEAK. Valid values: WEAK, STRONG, NONE |
Authorization (if auth is enabled) | HTTP request header. See Authentication |
Example
curl -X POST \
'http://<endpoint>:8242/api/v2/write?precision=ms&db=default' \
-d '
sensor7,device_id=F07A1260,region=north-cn temperature=12.1,humidity=45i 1619076780000000000
sensor7,device_id=F07A1260,region=north-cn temperature=13.2,humidity=47i 1619076790000000000
sensor7,device_id=F07A1260,region=north-cn temperature=10.6,humidity=46i 1619076800000000000
sensor7,device_id=F07A1260,region=north-cn temperature=18.1,humidity=44i 1619076780000000000
sensor7,device_id=F07A1260,region=north-cn temperature=19.7,humidity=44i 1619076790000000000
'Replace <endpoint> with your LindormTSDB proxy endpoint (for example, ld-bp1489gr5t*****-proxy-tsdb.lindorm.rds.aliyuncs.com).
Line protocol format
Each line represents one data point. Separate multiple data points with a line feed (\n).
// Syntax
<table_name>[,<tag_key>=<tag_value>[,<tag_key>=<tag_value>]] <field_key>=<field_value>[,<field_key>=<field_value>] [<timestamp>]
// Example
sensor7,device_id=F07A1260,region=north-cn temperature=12.1,humidity=45i 1619076780000000000| Element | Required | Description |
|---|---|---|
table_name | Yes | Name of the table to write data to |
| Tag set | No | Comma-delimited key=value pairs. Use tags for dimensions you want to filter or group by |
| Field set | Yes | Comma-delimited key=value pairs. At least one field is required |
timestamp | No | Unix timestamp for the data point. Defaults to the server's current time. Default unit: nanoseconds (ns) |
All timestamps are stored at millisecond precision, regardless of the precision parameter value. Data submitted at sub-millisecond precision loses precision during the write. To change the timestamp precision, set the precision parameter.
Supported data types
Float
The default data type. Numbers without a suffix are parsed as Float.
// Syntax
<field_key>=<value>
// Examples
temperature=12.1
ratio=1.0
count=1
large=1.e+10Integer
64-bit integers. Add a trailing i to the field value — without the suffix, the number is parsed as Float.
// Syntax
<field_key>=<value>i
// Examples
humidity=45i
count=101iString
Enclose string values in double quotation marks (").
// Syntax
<field_key>="<value>"
// Examples
status="healthy"
message="hello world"Boolean
Stores true or false values.
| Value | Accepted syntax |
|---|---|
| True | t, T, true, True, TRUE |
| False | f, F, false, False, FALSE |
// Examples
active=true
active=TRUE
active=t
enabled=false
enabled=FALSETimestamp
A Unix timestamp associated with the data point. If omitted, LindormTSDB uses the server's current time.
The default precision is nanoseconds (ns). Set the precision query parameter to change the unit. Valid values: ns, us, ms, s, m, h.
LindormTSDB stores all timestamps at millisecond precision. Timestamps with finer precision (for example, nanoseconds) lose precision during the write.
Authentication
If authentication is enabled on your LindormTSDB instance, include a Basic authentication header in every request.
Format:
Authorization: Basic <Base64-encoded credentials>The credentials string is <username>:<password>, Base64-encoded. For the default username root and password root:
Authorization: Basic cm9vdDpyb290For encoding credentials in your language of choice, refer to the Base64 encoding documentation for your runtime or standard library.
Schema policy
The schema_policy parameter controls how LindormTSDB handles writes to tables that do not yet exist or that receive new columns.
| Value | Behavior |
|---|---|
WEAK (default) | Time series tables are created automatically |
STRONG | Specify a strong constraint policy for the schema |
NONE | No schema constraint is applied |
For details, see Supported schema constraint policies.