4.1 HoodieClusteringJob
随着Hudi版本0.9.0的发布,我们可以在同一步骤中调度和执行Clustering
。我们只需要指定-mode
或-m
选项。有如下三种模式:
-
schedule(调度):制定一个Clustering计划。这提供了一个可以在执行模式下传递的
instant
。 -
execute(执行):在给定的
instant
执行Clustering计划,这意味着这里需要instant
。 -
scheduleAndExecute(调度并执行):首先制定Clustering计划并立即执行该计划。
请注意要在原始写入程序仍在运行时运行作业请启用多写入:
hoodie.write.concurrency.mode=optimistic_concurrency_control
hoodie.write.lock.provider=org.apache.hudi.client.transaction.lock.ZookeeperBasedLockProvider
使用spark submit
命令提交HoodieClusteringJob
示例如下:
spark-submit \
–class org.apache.hudi.utilities.HoodieClusteringJob \
/path/to/hudi-utilities-bundle/target/hudi-utilities-bundle_2.12-0.9.0-SNAPSHOT.jar \
–props /path/to/config/clusteringjob.properties \
–mode scheduleAndExecute \
–base-path /path/to/hudi_table/basePath \
–table-name hudi_table_schedule_clustering \
–spark-memory 1g
clusteringjob.properties
配置文件示例如下
hoodie.clustering.async.enabled=true
hoodie.clustering.async.max.commits=4
hoodie.clustering.plan.strategy.target.file.max.bytes=1073741824
hoodie.clustering.plan.strategy.small.file.limit=629145600
hoodie.clustering.execution.str