02-influxdb-line.mdx 2.2 KB
Newer Older
D
dingbo 已提交
1
---
G
gccgdb1234 已提交
2
sidebar_label: InfluxDB Line Protocol
3
title: InfluxDB Line Protocol
D
dingbo 已提交
4 5 6 7 8 9 10 11 12 13 14 15
---

import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";
import JavaLine from "./_java_line.mdx";
import PyLine from "./_py_line.mdx";
import GoLine from "./_go_line.mdx";
import RustLine from "./_rust_line.mdx";
import NodeLine from "./_js_line.mdx";
import CsLine from "./_cs_line.mdx";
import CLine from "./_c_line.mdx";

G
gccgdb1234 已提交
16
## Introduction
D
dingbo 已提交
17

G
gccgdb1234 已提交
18
A single line of text is used in InfluxDB Line protocol format represents one row of data, each line contains 4 parts as shown below.
D
dingbo 已提交
19 20 21 22 23

```
measurement,tag_set field_set timestamp
```

G
gccgdb1234 已提交
24 25 26 27
- `measurement` will be used as the stable name
- `tag_set` will be used as tags, with format like `<tag_key>=<tag_value>,<tag_key>=<tag_value>`
- `field_set`will be used as data columns, with format like `<field_key>=<field_value>,<field_key>=<field_value>`
- `timestamp`  is the primary key timestamp corresponding to this row of data
D
dingbo 已提交
28

G
gccgdb1234 已提交
29
For example:
D
dingbo 已提交
30 31 32 33 34 35 36

```
meters,location=Beijing.Haidian,groupid=2 current=13.4,voltage=223,phase=0.29 1648432611249500
```

:::note

G
gccgdb1234 已提交
37 38 39
- All the data in `tag_set` will be converted to ncahr type automatically .
- Each data in `field_set` must be self-description for its data type. For example 1.2f32 means a value 1.2 of float type, it will be treated as double without the "f" type suffix.
- Multiple kinds of precision can be used for the `timestamp` field. Time precision can be from nanosecond (ns) to hour (h).
D
dingbo 已提交
40 41 42

:::

G
gccgdb1234 已提交
43
For more details please refer to [InfluxDB Line Protocol](https://docs.influxdata.com/influxdb/v2.0/reference/syntax/line-protocol/) and [TDengine Schemaless](/reference/schemaless/#Schemaless-Line-Protocol)
D
dingbo 已提交
44 45


G
gccgdb1234 已提交
46
## Examples
D
dingbo 已提交
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70

<Tabs defaultValue="java" groupId="lang">
  <TabItem label="Java" value="java">
    <JavaLine />
  </TabItem>
  <TabItem label="Python" value="Python">
    <PyLine />
  </TabItem>
  <TabItem label="Go" value="go">
    <GoLine />
  </TabItem>
  <TabItem label="Rust" value="rust">
    <RustLine />
  </TabItem>
  <TabItem label="Node.js" value="nodejs">
    <NodeLine />
  </TabItem>
  <TabItem label="C#" value="csharp">
    <CsLine />
  </TabItem>
  <TabItem label="C" value="c">
    <CLine />
  </TabItem>
</Tabs>