Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,32 @@
import org.apache.hadoop.mapred.JobConf;

/**
* Word count example adapted to read from and write to Azure Cloud Storage
* Word count example adapted to read from and write to Azure Data Lake Gen 2
* using HDFS source and sink.
* <p>
* The job reads objects from the given container {@link #CONTAINER_NAME} and
* writes the word count results to a folder inside that container.
* <p>
* To be able to read from and write to Azure Cloud Storage, HDFS needs {@code
* To be able to read from and write to Azure Data Lake, HDFS needs {@code
* hadoop-azure} as dependency and an access key of a Storage Account.
*
* @see <a href="https://hadoop.apache.org/docs/r3.0.3/hadoop-azure/index.html">
* @see <a href="https://hadoop.apache.org/docs/r3.5.0/hadoop-azure/index.html">
* Hadoop Azure Support</a> for more information
*/
public class AzureCloudStorage {

private static final String ACCESS_KEY = "";
private static final String ACCOUNT_KEY = "";

private static final String ACCOUNT_NAME = "";
private static final String CONTAINER_NAME = "jet-azure-hdfs-example-container";

public static void main(String[] args) throws Exception {
Path inputPath = new Path("wasbs://" + CONTAINER_NAME + "@" + ACCOUNT_NAME + ".blob.core.windows.net/");
Path outputPath = new Path("wasbs://" + CONTAINER_NAME + "@" + ACCOUNT_NAME + ".blob.core.windows.net/results");
Path inputPath = new Path("abfs://" + CONTAINER_NAME + "@" + ACCOUNT_NAME + ".dfs.core.windows.net/");
Path outputPath = new Path("abfs://" + CONTAINER_NAME + "@" + ACCOUNT_NAME + ".dfs.core.windows.net/results");

JobConf jobConf = new JobConf();
jobConf.set("fs.azure.account.key." + ACCOUNT_NAME + ".blob.core.windows.net", ACCESS_KEY);
jobConf.set("fs.azure.account.auth.type." + ACCOUNT_NAME + ".dfs.core.windows.net", "SharedKey");
jobConf.set("fs.azure.account.key." + ACCOUNT_NAME + ".dfs.core.windows.net", ACCOUNT_KEY);

HadoopWordCount.executeSample(jobConf, inputPath, outputPath);
}
Expand Down
Loading