【问题标题】:Upload Data to druid Incrementally增量上传数据到德鲁伊
【发布时间】:2018-06-29 16:31:04
【问题描述】:

我需要将数据上传到现有模型。这必须每天进行。我想需要在索引文件中进行一些更改,但我无法弄清楚。我尝试推送具有相同模型名称的数据,但父数据已被删除。

任何帮助将不胜感激。

这是摄取的 json 文件:

{
  "type" : "index",
  "spec" : {
    "dataSchema" : {
      "dataSource" : "mksales",
      "parser" : {
        "type" : "string",
        "parseSpec" : {
          "format" : "json",
          "dimensionsSpec" : {
            "dimensions" : ["Address",
"City",
"Contract Name",
"Contract Sub Type",
"Contract Type",
"Customer Name",
"Domain",
"Nation",
"Contract Start End Date",
"Zip",
"Sales Rep Name"
]
          },
          "timestampSpec" : {
            "format" : "auto",
            "column" : "time"
          }
        }
      },
      "metricsSpec" : [
{ "type" : "count", "name" : "count", "type" : "count" },
{"name" : "Price","type" : "doubleSum","fieldName" : "Price"},
{"name" : "Sales","type" : "doubleSum","fieldName" : "Sales"},
{"name" : "Units","type" : "longSum","fieldName" : "Units"}],
      "granularitySpec" : {
        "type" : "uniform",
        "segmentGranularity" : "day",
        "queryGranularity" : "none",
        "intervals" : ["2000-12-01T00:00:00Z/2030-06-30T00:00:00Z"],
        "rollup" : true
      }
    },
    "ioConfig" : {
      "type" : "index",
      "firehose" : {
        "type" : "local",
        "baseDir" : "mksales/",
        "filter" : "mksales.json"
      },
      "appendToExisting" : false
    },
    "tuningConfig" : {
      "type" : "index",
      "targetPartitionSize" : 10000000,
      "maxRowsInMemory" : 40000,
      "forceExtendableShardSpecs" : true
    }
  }
}

【问题讨论】:

  • 你能分享更多细节吗,例如。摄取任务 json?
  • 有一个属性——appendToExisting。我要让它成真吗??
  • 你确定间隔吗?它涵盖了巨大的时期?“intervals”:[“2000-12-01T00:00:00Z/2030-06-30T00:00:00Z”],您所有的摄取数据都在单个文件“mksales.json”中吗?
  • 我为间隔取了虚拟值。我希望这不会影响摄取任务。不,mksales.json 是增量数据

标签: druid


【解决方案1】:

您可以使用 2 种方法将数据附加/更新到现有细分。

重新索引和增量摄取

每次新数据进入特定段时,您都需要重新索引数据。(在您的情况下是当天)对于重新索引,您需要为所有文件提供当天的数据。

对于 Delta Ingestion,您需要使用 inputSpec type="multi"

您可以参考文档链接了解更多详情 - http://druid.io/docs/latest/ingestion/update-existing-data.html

【讨论】:

  • 我刚刚更新了这个属性 - "appendToExisting" : true。这似乎也有效。
  • 是的,这会在段中创建一个额外的分片,而不是将旧段覆盖到新段中。
  • @mdeora 我们如何重新索引其他文件?当我传递特定时间戳的相同数据但一列作为与其他文件不同的值时,它会被覆盖而不是与以前的数据一起汇总。
  • @NoobCoder 这是预期的行为。你想实现什么行为?
  • @mdeora 我只想实现,如果我从其他文件传递相同的数据,以前的数据和新数据必须汇总。不覆盖。这可能通过本地摄取吗?另外,如您在回答中提到的,我如何提供包含当天数据的多个文件?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2017-02-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-09-03
相关资源
最近更新 更多