GCP Dataproc 在 Alpha 版中提供了 Druid。如何加载段?
Posted
技术标签:
【中文标题】GCP Dataproc 在 Alpha 版中提供了 Druid。如何加载段?【英文标题】:GCP Dataproc has Druid available in alpha. How to load segments? 【发布时间】:2020-01-21 12:41:17 【问题描述】:描述 druid 支持的 dataproc 页面没有关于如何将数据加载到集群中的部分。我一直在尝试使用 GC 存储来做到这一点,但不知道如何为它设置一个有效的规范。我希望“firehose”部分对存储桶有一些谷歌特定的引用,但没有示例如何执行此操作。
有什么方法可以将数据加载到 Druid 中,直接在 GCP dataproc 上运行?
【问题讨论】:
【参考方案1】:我没有使用过 Dataproc 版本的 Druid,但在 Google Compute VM 中运行了一个小型集群。我从 GCS 提取数据的方式是使用 Google Cloud Storage Druid 扩展 - https://druid.apache.org/docs/latest/development/extensions-core/google.html
要启用扩展,您需要将其添加到 Druid common.properties
文件中的扩展列表中:
druid.extensions.loadList=["druid-google-extensions", "postgresql-metadata-storage"]
为了从 GCS 获取数据,我将 HTTP POST 请求发送到 http://druid-overlord-host:8081/druid/indexer/v1/task
POST 请求正文包含带有摄取规范的 JSON 文件(请参阅 ["ioConfig"]["firehose"] 部分):
"type": "index_parallel",
"spec":
"dataSchema":
"dataSource": "daily_xport_test",
"granularitySpec":
"type": "uniform",
"segmentGranularity": "MONTH",
"queryGranularity": "NONE",
"rollup": false
,
"parser":
"type": "string",
"parseSpec":
"format": "json",
"timestampSpec":
"column": "dateday",
"format": "auto"
,
"dimensionsSpec":
"dimensions": [
"type": "string",
"name": "id",
"createBitmapIndex": true
,
"type": "long",
"name": "clicks_count_total"
,
"type": "long",
"name": "ctr"
,
"deleted",
"device_type",
"target_url"
]
,
"ioConfig":
"type": "index_parallel",
"firehose":
"type": "static-google-blobstore",
"blobs": [
"bucket": "data-test",
"path": "/sample_data/daily_export_18092019/000000000000.json.gz"
],
"filter": "*.json.gz$"
,
"appendToExisting": false
,
"tuningConfig":
"type": "index_parallel",
"maxNumSubTasks": 1,
"maxRowsInMemory": 1000000,
"pushTimeout": 0,
"maxRetry": 3,
"taskStatusCheckPeriodMs": 1000,
"chatHandlerTimeout": "PT10S",
"chatHandlerNumRetries": 5
在 Druid 中启动摄取任务的示例 cURL 命令(spec.json
包含上一节中的 JSON):
curl -X 'POST' -H 'Content-Type:application/json' -d @spec.json http://druid-overlord-host:8081/druid/indexer/v1/task
【讨论】:
index_parallel
的吞吐量有多好。如果 GCS 中存储了 2TB 数据,我应该选择 index_parallel
还是 hadoop
?以上是关于GCP Dataproc 在 Alpha 版中提供了 Druid。如何加载段?的主要内容,如果未能解决你的问题,请参考以下文章
如何在自动扩缩 GCP Dataproc 时了解初级工作者?
GCP Dataproc 节点中没有资源来启动新的 SparkSession