Line Protocol

openGeminiAbout 2 minAbout 489 words

Line protocol is a text-based format proposed by InfluxDB, and openGemini support the same line protocol to write data.

About line protocol, please see InfluxDB Line Protocolopen in new window

Write data

Use the ts-cli command to write data into the openGemini database, and place the Insert in front of the line procotol:

> INSERT h2o_feet,location=coyote_creek water_level=2.927,description="below 3 feet" 1566102600

Import Line protocol data from a file using the CLI,suppose the data is saved in the file data.txt in line protocol format

// data.txt
h2o_feet,location=coyote_creek water_level=2.927,description="below 3 feet" 1566102600
h2o_feet,location=coyote_creek water_level=2.831,description="below 3 feet" 1566102960
h2o_feet,location=coyote_creek water_level=2.743,description="below 3 feet" 1566103320
h2o_feet,location=coyote_creek water_level=2.667,description="below 3 feet" 1566103680
h2o_feet,location=coyote_creek water_level=2.589,description="below 3 feet" 1566104040
h2o_feet,location=coyote_creek water_level=2.523,description="below 3 feet" 1566104400
h2o_feet,location=coyote_creek water_level=2.464,description="below 3 feet" 1566104760
h2o_feet,location=coyote_creek water_level=2.408,description="below 3 feet" 1566105120
h2o_feet,location=coyote_creek water_level=2.379,description="below 3 feet" 1566105480
h2o_feet,location=coyote_creek water_level=2.352,description="below 3 feet" 1566105840
h2o_feet,location=coyote_creek water_level=2.343,description="below 3 feet" 1566106200
h2o_feet,location=coyote_creek water_level=2.346,description="below 3 feet" 1566106560

Run the following command

> ts-cli -import -path=data.txt -host= -port=8086 -precision=s