This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*1. Create a Visual studio 2012 Project. | |
2. Add HDInsight SDK NuGet to your project - | |
In Visual Studio 2012, Click on Tools -> library package manager -> Package Manager Console | |
PM> Install-Package Microsoft.WindowsAzure.Management.HDInsight | |
3. Use the following code, fill up the relevant info, then build and run - | |
*/ | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# An Example of using passing hadoop configurations for a job in HDInsight, via direct REST API | |
$MyHDInsightUserName = "YourClusterUserName" | |
$MyHDInsightPwd = "YourPwd" | |
$clusterName = "YourClusterName" | |
$storageAcctname = "YourStorageAcctname" | |
$containerName = "YourDefaultContainerName" | |
$HdInsightPwd = ConvertTo-SecureString $MyHDInsightPwd -AsPlainText -Force | |
$HdInsightCreds = New-Object System.Management.Automation.PSCredential ($MyHDInsightUserName, $HdInsightPwd) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mapReduceJob = new MapReduceJobCreateParameters() | |
{ | |
ClassName = "wordcount", // required | |
JobName = "MyWordCountJob", //optional | |
JarFile = "/example/jars/hadoop-examples.jar", // Required, alternative syntax: wasb://hdijobs@azimasv2.blob.core.windows.net/example/jar/hadoop-examples.jar | |
StatusFolder = "/AzimMRJobs/WordCountJobStatus" //Optional, but good to use to know where logs are uploaded in Azure Storage | |
}; | |
//WordCount progam needs two arguments | |
mapReduceJob.Arguments.Add("/example/data/gutenberg/davinci.txt"); //input file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# mapreduce example with hadoop job configurations | |
$clusterName = "YourClusterName" | |
$jobConfig = @{ "mapred.output.compress"="true"; "mapred.output.compression.codec"="org.apache.hadoop.io.compress.GzipCodec" } | |
$myWordCountJob = New-AzureHDInsightMapReduceJobDefinition -JarFile "/example/jars/hadoop-examples.jar" -ClassName "wordcount" -jobName "WordCountJob" -StatusFolder "/MyMRJobs/WordCountJobStatus" -Defines $jobConfig | |
$myWordCountJob.Arguments.Add("/example/data/gutenberg/davinci.txt") | |
$myWordCountJob.Arguments.Add("MyMRJobs/WordCountOutput") | |
$MyMRJob = Start-AzureHDInsightJob -Cluster $clusterName -JobDefinition $myWordCountJob | |
#Hive Job example with hadoop job configurations | |
$clusterName = "YourClusterName" |
NewerOlder