【问题标题】:GCP Dataproc has Druid available in alpha. How to load segments?GCP Dataproc 在 Alpha 版中提供了 Druid。如何加载段?
【发布时间】:2020-01-21 12:41:17
【问题描述】:

描述 druid 支持的 dataproc 页面没有关于如何将数据加载到集群中的部分。我一直在尝试使用 GC 存储来做到这一点,但不知道如何为它设置一个有效的规范。我希望“firehose”部分对存储桶有一些谷歌特定的引用,但没有示例如何执行此操作。

有什么方法可以将数据加载到 Druid 中,直接在 GCP dataproc 上运行?

【问题讨论】:

    标签: google-cloud-platform google-cloud-dataproc druid


    【解决方案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
    猜你喜欢
    • 1970-01-01
    • 2023-01-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-05-24
    • 2022-09-29
    • 1970-01-01
    • 2023-03-25
    相关资源
    最近更新 更多