Skip to content

Apache IoTDB Sink ​

The iotdb sink enables writing stream processing outputs directly into Apache IoTDB time-series databases using IoTDB's native RESTful service.

In rekuiper, the Apache IoTDB connector is a built-in component that connects to the IoTDB REST service. It supports dynamic device templates and batch tablet insertions.

Prerequisites ​

Ensure the Apache IoTDB REST service is enabled in IoTDB configuration (iotdb-datanode.properties: enable_rest_service=true, default port 18080).

Configuration Properties ​

Configure the iotdb sink action using the following properties:

Property NameTypeRequiredDefaultDescription
deviceStringYes-Target IoTDB device path (e.g. root.factory.d1). Supports dynamic data templates (e.g. root.factory.{{.deviceId}}).
addrStringNohttp://127.0.0.1:18080IoTDB REST service address (host:port or URL).
usernameStringNorootAuthentication username.
passwordStringNorootAuthentication password.
measurementsArrayNo-List of measurement column names to insert. If omitted, all non-timestamp fields are included.
tsFieldNameStringNotsName of the timestamp column in milliseconds. If omitted or not present, server wall clock is used.

Examples ​

Static Device Path Insert ​

Writes high-frequency telemetry into device root.ln.wf01.wt01:

json
{
  "id": "rule_iotdb_static",
  "sql": "SELECT temperature, humidity, pressure, ts FROM sensorStream",
  "actions": [
    {
      "iotdb": {
        "addr": "http://127.0.0.1:18080",
        "username": "root",
        "password": "root",
        "device": "root.ln.wf01.wt01",
        "measurements": ["temperature", "humidity", "pressure"],
        "tsFieldName": "ts"
      }
    }
  ]
}

Dynamic Device Template ​

Uses Golang-style data template syntax to route telemetry dynamically to devices based on incoming deviceId:

json
{
  "id": "rule_iotdb_dynamic",
  "sql": "SELECT deviceId, voltage, current, ts FROM powerStream",
  "actions": [
    {
      "iotdb": {
        "addr": "http://127.0.0.1:18080",
        "username": "root",
        "password": "password",
        "device": "root.station.{{.deviceId}}",
        "measurements": ["voltage", "current"],
        "tsFieldName": "ts"
      }
    }
  ]
}

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