Skip to content

Instantly share code, notes, and snippets.

@rmoff
Created January 22, 2020 17:34
Show Gist options
  • Save rmoff/cfa93f2d8b722f4e6bf96aedec5074ef to your computer and use it in GitHub Desktop.
Save rmoff/cfa93f2d8b722f4e6bf96aedec5074ef to your computer and use it in GitHub Desktop.
InfluxDB Sink connector example
kafkacat -b localhost:9092 -P -t testdata-json4 <<EOF
{ "schema": { "type": "struct", "fields": [ { "type": "map", "keys": { "type": "string", "optional": false }, "values": { "type": "string", "optional": false }, "optional": false, "field": "tags" }, { "field": "sn", "optional": false, "type": "string" }, { "field": "value", "optional": false, "type": "float" } ], "optional": false, "version": 1 }, "payload": { "tags": { "tagnum": "5" }, "sn": "FOO", "value": 500.0 } }
EOF
curl -i -X PUT -H "Accept:application/json" \
-H "Content-Type:application/json" http://localhost:8083/connectors/SINK_INFLUX_01/config \
-d '{
"connector.class" : "io.confluent.influxdb.InfluxDBSinkConnector",
"value.converter": "org.apache.kafka.connect.json.JsonConverter",
"value.converter.schemas.enable": "true",
"key.converter" : "org.apache.kafka.connect.storage.StringConverter",
"topics" : "testdata-json4",
"influxdb.url" : "http://influxdb:8086",
"influxdb.db" : "my_db",
"measurement.name.format" : "${topic}"
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment