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 Gen1 and Gen2. Azure Storage and Data Lake Storage Gen1 and 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 Gen1, and 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 Gen1 with HDInsight, and Use Data Lake Storage Gen2 with HDInsight.
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
Microsoft provides the following utilities to work with Azure Storage:
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>
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:
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
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
hdfs dfs commands to write data larger than ~12 GB results in an error. For more information, see storage exception for write on blob.
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:
|Microsoft Visual Studio Tools for HDInsight||✔||✔||✔|
|Azure Storage Explorer||✔||✔||✔|
|CloudBerry Explorer for Microsoft Azure||✔|
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.
|Azure Blob storage||Copy data to or from Azure Blob storage by using Azure Data Factory|
|Azure Data Lake Storage Gen1||Copy data to or from Azure Data Lake Storage Gen1 by using Azure Data Factory|
|Azure Data Lake Storage Gen2||Load data into Azure Data Lake Storage Gen2 with Azure Data Factory|
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.
Azure Storage can also be accessed using an Azure SDK from the following programming languages:
For more information on installing the Azure SDKs, see Azure downloads
Now that you understand how to get data into HDInsight, read the following articles to learn analysis:
Indsend og få vist feedback om