ILP - Line Protocol

ILP - Line Protocol

📌

For smooth practice, the following query should be run to prepare tables and data.

CREATE TAG TABLE IF NOT EXISTS EXAMPLE (
    NAME VARCHAR(20) PRIMARY KEY,
    TIME DATETIME BASETIME,
    VALUE DOUBLE SUMMARIZED
);

How to insert data from Line Protocol

Machbase Neo provides a compatibility api that accepts messages in a format of influxdata lineprotocol for writing data. This api is convenient way to utilize existing client softwares that produce lineprotocol messages (e.g telegraf).

ℹī¸

Since Machbase is different scheme of database from influxdb, some translations will be automatically occurred.

Translation

Machbaseline protocol of influxdb
tabledb
tag namemeasurement + . + field name
timetimestamp
valuevalue of the field (if it is not a number type, will be ignored and not inserted)

Line protocol example

curl -o - -X POST "http://127.0.0.1:5654/metrics/write?db=example" \
    --data-binary 'my-car speed=87.6 167038034500000'

This example inserts data into table tagdata with name=‘my-car.speed’, value=87.6 and time=167038034500000

telegraf.conf example

As set telegraf’s output config to use http port of Machbase Neo, the metrics that collected by telegraf are directly inserted into Machbase Neo.

[[outputs.http]]
url = "http://127.0.0.1:5654/metrics/write?db=example"
data_format = "influx"
content_encoding = "gzip"
Last updated on