【Apache Pinot】Data upload jobtype 粗略分析

背景

目前我司大部分实时数据和离线数据都存储在 pinot 数据库中,离线数据需要通过脚本去生成对应的数据上传到数据库里面,但是其中 config 中有个 jobtype 让人有点迷惑,本文简单的做一个概念的整理

用处

先说一下流程,目前我以 hdfs 举例,我们的脚本会先把数据通过 hdfs 的 client 上传到 hadoop 集群里面,接下来通过 pinot-admin 的语法把数据上传给 pinot controller,这里脚本会用到一个文件,这个文件配置job的各种参数,其中 jobtype 是数据上传里面的一个参数,分别是 tar,URI和 metadata。配置文件如下:

executionFrameworkSpec:
  name: 'standalone'
  segmentGenerationJobRunnerClassName: 'org.apache.pinot.plugin.ingestion.batch.standalone.SegmentGenerationJobRunner'
  segmentTarPushJobRunnerClassName: 'org.apache.pinot.plugin.ingestion.batch.standalone.SegmentTarPushJobRunner'
  segmentUriPushJobRunnerClassName: 'org.apache.pinot.plugin.ingestion.batch.standalone.SegmentUriPushJobRunner'
jobType: SegmentCreationAndTarPush
inputDirURI: 'hdfs://${data_dir}'
includeFileNamePattern: 'glob:**/*.csv'
outputDirURI: 'hdfs:///pinot/controller/${table_name}/${segment_partition}/${segment_suffix}'
overwriteOutput: true
pinotFSSpecs:
  - scheme: file
    className: org.apache.pinot.spi.filesystem.LocalPinotFS
  - scheme: hdfs
    className: org.apache.pinot.plugin.filesystem.HadoopPinotFS
    configs:
      hadoop.conf.path: '/opt/hdfs'
recordReaderSpec:
  dataFormat: 'csv'
  className: 'org.apache.pinot.plugin.inputformat.csv.CSVRecordReader'
  configClassName: 'org.apache.pinot.plugin.inputformat.csv.CSVRecordReaderConfig'
  configs:
    fileFormat: 'default'
    delimiter: '^'
    multiValueDelimiter: ''
tableSpec:
  tableName: '${table_name}'
  schemaURI: '${controller_uri}/tables/${table_name}/schema'
  tableConfigURI: '${controller_uri}/tables/${table_name}'
pinotClusterSpecs:
  - controllerURI: '${controller_uri}'
segmentNameGeneratorSpec:
  type: fixed
  configs:
    segment.name: '${table_name}-${segment_partition}-${segment_suffix}'
pushJobSpec:
  pushParallelism: 2
  pushAttempts: 2
  pushRetryIntervalMillis: 1000
  segmentUriPrefix : 'hdfs://'
  segmentUriSuffix : ''

JobType

TAR

tar type 会把 segment 文件存储到本地,然后通过 stream 的方式把数据发送给 controller,controller 会把 segment 保存下来,然后解析 segment 里面的 metadata,接下来会把 segment 加到表中

URI

URI type 会把 segment 的 tar 文件存储到 deepstorage 中,并且有个可以全局访问的 tar 的 URI,这个 job 会把 URI 发送给 Pinot 的 Controller,controller 会把 segment 保存下来,然后解析 segment 里面的 metadata,接下来会把 segment 加到表中

metadata

metadata type 会把 segment 的 tar 文件存储到 deepstorage 中,并且有个可以全局访问的 tar 的 URI,job 会解析 segment 里面的 metadata,接下来会把 metadata 传给 controller,controller 会根据 metadata 把 segment 下载到 table 里面

总结

整体来看,Tar 的方式比较重,会把数据先给 controller,在给到 server。其他两种方式,client 都不需要传数据,只需要传 uri 等相关轻量的数据给到 controller,后面两者更适合生产使用。接下来就是 metadata 的方式会让 controller 做更少的事情,job 侧做的事情偏多。

引用

https://docs.pinot.apache.org/basics/data-import/batch-ingestion

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值