Database Reference
In-Depth Information
//Cluster information
var clusterInfo = new ClusterCreateParameters()
{
Name = "AutomatedHDICluster",
Location = "North Europe",
DefaultStorageAccountName = Constants.storageAccount,
DefaultStorageAccountKey = Constants.storageAccountKey,
DefaultStorageContainer = Constants.container,
UserName = Constants.clusterUser,
Password = Constants.clusterPassword,
ClusterSizeInNodes = 2,
Version="2.1"
};
Console.Write("Creating cluster...");
var clusterDetails = client.CreateCluster(clusterInfo);
Console.Write("Done\n");
ListClusters();
}
//Delete an existing HDI cluster
public static void DeleteCluster()
{
var store = new X509Store();
store.Open(OpenFlags.ReadOnly);
var cert = store.Certificates.Cast<X509Certificate2>().First(item
=> item.Thumbprint == Constants.thumbprint);
var creds = new HDInsightCertificateCredential(Constants.subscriptionId, cert);
var client = HDInsightClient.Connect(creds);
Console.Write("Deleting cluster...");
client.DeleteCluster("AutomatedHDICluster");
Console.Write("Done\n");
ListClusters();
}
//Run Custom Map Reduce
public static void DoCustomMapReduce()
{
Console.WriteLine("Starting MapReduce job. Log in remotely to your Name Node " +
"and check progress from JobTracker portal with the returned JobID…");
IHadoop hadoop = Hadoop.Connect(Constants.azureClusterUri, Constants.clusterUser,
Constants.hadoopUser, Constants.clusterPassword, Constants.storageAccount,
Constants.storageAccountKey, Constants.container, true);
var output = hadoop.MapReduceJob.ExecuteJob<SquareRootJob>();
}
//Run Sample Map Reduce Job
public static void DoMapReduce()
{
// Define the MapReduce job
MapReduceJobCreateParameters mrJobDefinition = new MapReduceJobCreateParameters()
{
JarFile = "wasb:///example/jars/hadoop-examples.jar",
ClassName = "wordcount"
};
Search WWH ::




Custom Search