This article provides steps for one method to test avro ingestion locally using the Imply distribution. The example sends nested avro using parser type: avro_stream and avroBytesDecoder type: schema_registry.
1. Add extension "druid-avro-extensions" to the loadList in conf-quickstart/druid/_common/common.runtime.properties if running in quickstart mode, and conf/druid/_common/common.runtime.properties if running in cluster mode.
2. Download Confluent quickstart, install: https://docs.confluent.io/current/quickstart/cos-quickstart.html . We will be using Confluent's supplied Kafka and schema-registry, so make sure no other Kafka process is currently running (port :9092).
3. Start Confluent from the Confluent directory. Your terminal should look something like this:
{
"type": "record",
"name": "location",
"fields": [
{
"name": "hilltop",
"type": {
"type": "record",
"name": "anotherNameDescribingType",
"fields": [
{
"name": "timestamp",
"type": "string",
"doc": "Local time",
"default": ""
},
{
"name": "view",
"type": "string",
"doc": "doYouSeeWhatISee",
"default": ""
}
]
}
}
]
}
__confluent.support.metrics
__consumer_offsets
_confluent-ksql-default__command_topic
_schemas
avro-test
{"id":"location"}% <- the output id will be the name of the dataSource.
{
"type": "kafka",
"dataSchema": {
"dataSource": "location",
"parser": {
"type": "avro_stream",
"avroBytesDecoder": {
"type": "schema_registry",
"url": "http://localhost:8081",
"capacity": 100
},
"parseSpec": {
"format": "avro",
"timestampSpec": {
"column": "timestamp",
"format": "auto"
},
"dimensionsSpec": {
"dimensions": [
{ "name": "view", "type": "string" }
],
"dimensionExclusions": []
},
"flattenSpec": {
"useFieldDiscovery": true,
"fields": [
{
"type": "path",
"name": "timestamp",
"expr": "$.hilltop.timestamp"
},
{
"type": "path",
"name": "view",
"expr": "$.hilltop.view"
}
]
}
}
},
"metricsSpec": [],
"granularitySpec": {
"type": "uniform",
"segmentGranularity": "hour",
"queryGranularity": "NONE",
"rollup": false
}
},
"ioConfig": {
"topic": "avro-test",
"useEarliestOffset": true,
"consumerProperties": {
"bootstrap.servers": "localhost:9092"
}
},
"tuningConfig": {
"type": "kafka",
"reportParseExceptions": true
}
}
Welcome to dsql, the command-line client for Druid SQL.
Type "\h" for help.
dsql> \d
┌──────────────┬─────────────────────────┐
│ TABLE_SCHEMA │ TABLE_NAME │
├──────────────┼─────────────────────────┤
│ druid │ location │
│ druid │ wikipedia │
└──────────────┴─────────────────────────┘
Retrieved 4 rows in 0.03s.
│ __time │ view │
├──────────────────────────┼───────┤
│ 2018-06-21T18:00:00.000Z │ ocean │
└──────────────────────────┴───────┘
Retrieved 1 row in 0.14s.