Upload data for Apache Hadoop jobs in HDInsight
HDInsight provides a Hadoop distributed file system (HDFS) over Azure Storage, and Azure Data Lake Storage. This storage includes Gen2. Azure Storage and Data Lake Storage Gen2 are designed as HDFS extensions. They enable the full set of components in the Hadoop environment to operate directly on the data it manages. Azure Storage, Data Lake Storage Gen2 are distinct file systems. The systems are optimized for storage of data and computations on that data. For information about the benefits of using Azure Storage, see Use Azure Storage with HDInsight. See also, Use Data Lake Storage Gen2 with HDInsight.
Prerequisites
Note the following requirements before you begin:
- An Azure HDInsight cluster. For instructions, see Get started with Azure HDInsight.
- Knowledge of the following articles:
Upload data to Azure Storage
Utilities
Microsoft provides the following utilities to work with Azure Storage:
Tool | Linux | OS X | Windows |
---|---|---|---|
Azure portal | ✔ | ✔ | ✔ |
Azure CLI | ✔ | ✔ | ✔ |
Azure PowerShell | ✔ | ||
AzCopy | ✔ | ✔ | |
Hadoop command | ✔ | ✔ | ✔ |
Note
The Hadoop command is only available on the HDInsight cluster. The command only allows loading data from the local file system into Azure Storage.
Hadoop command line
The Hadoop command line is only useful for storing data into Azure storage blob when the data is already present on the cluster head node.
To use the Hadoop command, you must first connect to the headnode using SSH or PuTTY.
Once connected, you can use the following syntax to upload a file to storage.
hadoop fs -copyFromLocal <localFilePath> <storageFilePath>
For example, hadoop fs -copyFromLocal data.txt /example/data/data.txt
Because the default file system for HDInsight is in Azure Storage, /example/data/data.txt is actually in Azure Storage. You can also refer to the file as:
wasbs:///example/data/data.txt
Or
wasbs://<ContainerName>@<StorageAccountName>.blob.core.windows.net/example/data/davinci.txt
For a list of other Hadoop commands that work with files, see https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-common/FileSystemShell.html
Warning
On Apache HBase clusters, the default block size used when writing data is 256 KB. While this works fine when using HBase APIs or REST APIs, using the hadoop
or hdfs dfs
commands to write data larger than ~12 GB results in an error. For more information, see storage exception for write on blob.
Graphical clients
There are also several applications that provide a graphical interface for working with Azure Storage. The following table is a list of a few of these applications:
Client | Linux | OS X | Windows |
---|---|---|---|
Microsoft Visual Studio Tools for HDInsight | ✔ | ✔ | ✔ |
Azure Storage Explorer | ✔ | ✔ | ✔ |
Cerulea |
✔ | ||
CloudXplorer | ✔ | ||
CloudBerry Explorer for Microsoft Azure | ✔ | ||
Cyberduck | ✔ | ✔ |
Mount Azure Storage as Local Drive
See Mount Azure Storage as Local Drive.
Upload using services
Azure Data Factory
The Azure Data Factory service is a fully managed service for composing data: storage, processing, and movement services into streamlined, adaptable, and reliable data production pipelines.
Storage type | Documentation |
---|---|
Azure Blob storage | Copy data to or from Azure Blob storage by using Azure Data Factory |
(../data-factory/connector-azure-data-lake-store.md) | |
Azure Data Lake Storage Gen2 | Load data into Azure Data Lake Storage Gen2 with Azure Data Factory |
Apache Sqoop
Sqoop is a tool designed to transfer data between Hadoop and relational databases. Use it to import data from a relational database management system (RDBMS), such as SQL Server, MySQL, or Oracle. Then into the Hadoop distributed file system (HDFS). Transform the data in Hadoop with MapReduce or Hive, and then export the data back into an RDBMS.
For more information, see Use Sqoop with HDInsight.
Development SDKs
Azure Storage can also be accessed using an Azure SDK from the following programming languages:
- .NET
- Java
- Node.js
- PHP
- Python
- Ruby
For more information on installing the Azure SDKs, see Azure downloads
Next steps
Now that you understand how to get data into HDInsight, read the following articles to learn analysis: