如何配置德鲁伊批量索引作业动态 EMR 集群以进行批量摄取?

How to configure druid batch indexing jobs dynamic EMR cluster for batch ingestion?

我正在尝试使用 Airflow 自动执行德鲁伊批量摄取。我的数据管道按需创建 EMR 集群,并在德鲁伊索引完成后将其关闭。但是对于德鲁伊,我们需要在德鲁伊服务器文件夹 ref 中进行 Hadoop 配置。这使我无法使用动态 EMR 集群。我们可以在作业配置中覆盖 Hadoop 连接详细信息吗?或者有没有办法支持多个索引作业以使用不同的 EMR 集群?

在研究如何做到这一点时,我在此处找到 hadoopDependencyCoordinates 属性:https://druid.apache.org/docs/0.22.1/ingestion/hadoop.html#task-syntax

这似乎是相关的。

我已经尝试将 core-site.xml,yarn-site.xml,mapred-site.xml,hdfs-site.xml 中的参数(Hadoop 配置)覆盖为德鲁伊索引工作中的 Job properties。有效。在这种情况下,无需在德鲁伊服务器中复制上述文件。

刚刚在 python 程序下面使用,将属性从 xml 文件转换为 json 键值对。可以对所有文件执行相同操作,并将所有内容作为索引作业负载传递。创建不同的 EMR 集群后,可以使用气流自动执行以下操作。

import json
import xmltodict
path = 'mypath'
file = 'yarn-site.xml'
with open(os.path.join(path,file)) as xml_file:
    data_dict = xmltodict.parse(xml_file.read())
    xml_file.close()
    druid_dict = {property.get('name'):property.get('value') for property in data_dict.get('configuration').get('property') }
    print(json.dumps(druid_dict)) ```