Skip to content

TDengine 3 Sink ​

The tdengine (or tdengine3) sink enables writing stream processing outputs directly into TDengine 3.x instances using TDengine's native RESTful HTTP connector.

In rekuiper, the TDengine connector is a built-in component that connects to the TDengine REST service. It does not require libtaos.so.

Prerequisites ​

Ensure the TDengine REST service (taosAdapter or built-in REST service) is running and accessible (default port 6041).

Configuration Properties ​

Configure the tdengine or tdengine3 sink action using the following properties:

Property NameTypeRequiredDefaultDescription
databaseStringYes-Target TDengine database name.
tableStringYes-Target table name. Supports dynamic data templates (e.g. d_{{.deviceId}}).
hostStringNolocalhostTDengine REST server hostname or IP address.
portIntegerNo6041TDengine REST service port.
userStringNorootAuthentication username.
passwordStringNotaosdataAuthentication password.
sTableStringNo-Optional super table name. When specified, sub-tables are automatically created if they do not exist.
tagFieldsArrayNo-Field names used as tag columns when writing to a super table.
fieldsArrayNo-List of columns to project and insert. If omitted, all non-tag record fields are written.
provideTsBooleanNotrueIf true, the value from tsFieldName is inserted. If false, database server clock now is used.
tsFieldNameStringNotsName of the timestamp column in the input event stream.

Examples ​

Regular Table Insert ​

Writes sensor telemetry directly to table readings in database factory:

json
{
  "id": "rule_tdengine_regular",
  "sql": "SELECT deviceId, temperature, humidity, ts FROM sensorStream",
  "actions": [
    {
      "tdengine3": {
        "host": "127.0.0.1",
        "port": 6041,
        "database": "factory",
        "table": "readings",
        "user": "root",
        "password": "password",
        "fields": ["deviceId", "temperature", "humidity"],
        "tsFieldName": "ts",
        "provideTs": true
      }
    }
  ]
}

Super Table with Automatic Sub-Table Creation ​

Uses dynamic table naming (m_{{.deviceId}}) and automatically instantiates sub-tables from super table meters with tag deviceId:

json
{
  "id": "rule_tdengine_super_table",
  "sql": "SELECT deviceId, voltage, current, ts FROM powerStream",
  "actions": [
    {
      "tdengine3": {
        "host": "127.0.0.1",
        "port": 6041,
        "database": "power",
        "table": "m_{{.deviceId}}",
        "sTable": "meters",
        "tagFields": ["deviceId"],
        "fields": ["voltage", "current"],
        "tsFieldName": "ts",
        "provideTs": true
      }
    }
  ]
}

rekuiper is open source (Apache-2.0 / MIT) · For an all-in-one MQTT broker with embedded rekuiper rules, see IndraMQTT.