HDFS

To use this Apache Druid extension, make sure to include druid-hdfs-storage as an extension.

Deep Storage

Configuration for HDFS

PropertyPossible ValuesDescriptionDefault
druid.storage.typehdfsMust be set.
druid.storage.storageDirectoryDirectory for storing segments.Must be set.
druid.hadoop.security.kerberos.principaldruid@EXAMPLE.COMPrincipal user nameempty
druid.hadoop.security.kerberos.keytab/etc/security/keytabs/druid.headlessUser.keytabPath to keytab fileempty

Besides the above settings, you also need to include all Hadoop configuration files (such as core-site.xml, hdfs-site.xml) in the Druid classpath. One way to do this is copying all those files under ${DRUID_HOME}/conf/_common.

If you are using the Hadoop ingestion, set your output directory to be a location on Hadoop and it will work. If you want to eagerly authenticate against a secured hadoop/hdfs cluster you must set druid.hadoop.security.kerberos.principal and druid.hadoop.security.kerberos.keytab, this is an alternative to the cron job method that runs kinit command periodically.

Configuration for Cloud Storage

You can also use the AWS S3 or the Google Cloud Storage as the deep storage via HDFS.

Configuration for AWS S3

To use the AWS S3 as the deep storage, you need to configure druid.storage.storageDirectory properly.

PropertyPossible ValuesDescriptionDefault
druid.storage.typehdfsMust be set.
druid.storage.storageDirectorys3a://bucket/example/directory or s3n://bucket/example/directoryPath to the deep storageMust be set.

You also need to include the Hadoop AWS module, especially the hadoop-aws.jar in the Druid classpath. Run the below command to install the hadoop-aws.jar file under ${DRUID_HOME}/extensions/druid-hdfs-storage in all nodes.

  1. java -classpath "${DRUID_HOME}lib/*" org.apache.druid.cli.Main tools pull-deps -h "org.apache.hadoop:hadoop-aws:${HADOOP_VERSION}";
  2. cp ${DRUID_HOME}/hadoop-dependencies/hadoop-aws/${HADOOP_VERSION}/hadoop-aws-${HADOOP_VERSION}.jar ${DRUID_HOME}/extensions/druid-hdfs-storage/

Finally, you need to add the below properties in the core-site.xml. For more configurations, see the Hadoop AWS module.

  1. <property>
  2. <name>fs.s3a.impl</name>
  3. <value>org.apache.hadoop.fs.s3a.S3AFileSystem</value>
  4. <description>The implementation class of the S3A Filesystem</description>
  5. </property>
  6. <property>
  7. <name>fs.AbstractFileSystem.s3a.impl</name>
  8. <value>org.apache.hadoop.fs.s3a.S3A</value>
  9. <description>The implementation class of the S3A AbstractFileSystem.</description>
  10. </property>
  11. <property>
  12. <name>fs.s3a.access.key</name>
  13. <description>AWS access key ID. Omit for IAM role-based or provider-based authentication.</description>
  14. <value>your access key</value>
  15. </property>
  16. <property>
  17. <name>fs.s3a.secret.key</name>
  18. <description>AWS secret key. Omit for IAM role-based or provider-based authentication.</description>
  19. <value>your secret key</value>
  20. </property>

Configuration for Google Cloud Storage

To use the Google Cloud Storage as the deep storage, you need to configure druid.storage.storageDirectory properly.

PropertyPossible ValuesDescriptionDefault
druid.storage.typehdfsMust be set.
druid.storage.storageDirectorygs://bucket/example/directoryPath to the deep storageMust be set.

All services that need to access GCS need to have the GCS connector jar in their class path. Please read the install instructions to properly set up the necessary libraries and configurations. One option is to place this jar in ${DRUID_HOME}/lib/ and ${DRUID_HOME}/extensions/druid-hdfs-storage/.

Finally, you need to configure the core-site.xml file with the filesystem and authentication properties needed for GCS. You may want to copy the below example properties. Please follow the instructions at https://github.com/GoogleCloudPlatform/bigdata-interop/blob/master/gcs/INSTALL.md for more details. For more configurations, GCS core default and GCS core template.

  1. <property>
  2. <name>fs.gs.impl</name>
  3. <value>com.google.cloud.hadoop.fs.gcs.GoogleHadoopFileSystem</value>
  4. <description>The FileSystem for gs: (GCS) uris.</description>
  5. </property>
  6. <property>
  7. <name>fs.AbstractFileSystem.gs.impl</name>
  8. <value>com.google.cloud.hadoop.fs.gcs.GoogleHadoopFS</value>
  9. <description>The AbstractFileSystem for gs: uris.</description>
  10. </property>
  11. <property>
  12. <name>google.cloud.auth.service.account.enable</name>
  13. <value>true</value>
  14. <description>
  15. Whether to use a service account for GCS authorization.
  16. Setting this property to `false` will disable use of service accounts for
  17. authentication.
  18. </description>
  19. </property>
  20. <property>
  21. <name>google.cloud.auth.service.account.json.keyfile</name>
  22. <value>/path/to/keyfile</value>
  23. <description>
  24. The JSON key file of the service account used for GCS
  25. access when google.cloud.auth.service.account.enable is true.
  26. </description>
  27. </property>

Tested with Druid 0.17.0, Hadoop 2.8.5 and gcs-connector jar 2.0.0-hadoop2.

Reading data from HDFS or Cloud Storage

Native batch ingestion

The HDFS input source is supported by the Parallel task to read files directly from the HDFS Storage. You may be able to read objects from cloud storage with the HDFS input source, but we highly recommend to use a proper Input Source instead if possible because it is simple to set up. For now, only the S3 input source and the Google Cloud Storage input source are supported for cloud storage types, and so you may still want to use the HDFS input source to read from cloud storage other than those two.

Hadoop-based ingestion

If you use the Hadoop ingestion, you can read data from HDFS by specifying the paths in your inputSpec. See the Static inputSpec for details.