Last active
January 3, 2016 11:19
-
-
Save dharkum/8455459 to your computer and use it in GitHub Desktop.
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
param | |
( | |
############################################################################# | |
### Please edit the values of the parameters below for your configuration ### | |
############################################################################# | |
[string]$PrimarySubscriptionName="<Your Subscription Name>", # Replace <Your Subscription Name> with your Azure subscription name | |
[string]$HDInsightClusterLocation="West US", # This is the data center where you are going to provision this HDInsight cluster | |
[string]$HDInsightClusterName="MyHDICluster", # This is the name that you want for the HDInsight cluster | |
[int]$NumNodesInCluster = 4, # This is the number of data nodes that you want for this cluster | |
# The storage accounts and containers need to be created on the same data center as your HDInsight cluster prior to the execution of this PS script | |
[string]$PrimaryStorageAccount="myprimarystorage", # This is the name of your primary storage account | |
[string]$PrimaryStorageContainer="install", # This is the name of the primary storage container | |
[string]$HiveLibStorageAccount="myhivelibs", # This is the name of the additional WASB storage account that will hold the Hive libs. | |
[string]$HiveLibStorageContainer="hivecustomlibs", # This is the name of the default storage container for Hive libs. | |
# This is the SQL Azure Sever name that will host the metastore databases, this needs to be created on the same data center as your cluster prior to executing this PS script | |
[string]$SQLAzureServerName = "<Your SQL Azure Server>.database.windows.net", | |
# This is the SQL Azure Database that will host the Hive Metastore DB. Again, this needs to be created on the SQL Azure server above prior to executing this PS script. | |
[string]$HiveMetaStoreDB = "<Your Hive MetaStore DB Name>" | |
############################################################################ | |
### End Edits ### | |
############################################################################ | |
) | |
$PrimarySubscriptionID = (Get-AzureSubscription $PrimarySubscriptionName).SubscriptionId | |
Select-AzureSubscription -SubscriptionName $PrimarySubscriptionName | |
$PrimaryStorageAccountKey = Get-AzureStorageKey $PrimaryStorageAccount | %{ $_.Primary} | |
$HiveLibStorageAccountKey = Get-AzureStorageKey $HiveLibStorageAccount | %{ $_.Primary} | |
# This will be the credential used for the admin account of the HDInsight Cluster | |
$creds = Get-Credential -Message "Please enter the admin account credentials for your HDInsight Cluster" | |
######################################################### | |
### This section adds the new JAR to the Hive library ### | |
######################################################### | |
$configvalues = new-object 'Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.DataObjects.AzureHDInsightHiveConfiguration' | |
$configvalues.AdditionalLibraries = new-object 'Microsoft.WindowsAzure.Management.HDInsight.Cmdlet.DataObjects.AzureHDInsightDefaultStorageAccount' | |
$configvalues.AdditionalLibraries.StorageAccountName = "$HiveLibStorageAccount.blob.core.windows.net" | |
$configvalues.AdditionalLibraries.StorageAccountKey = Get-AzureStorageKey $HiveLibStorageAccount | %{ $_.Primary} | |
$configvalues.AdditionalLibraries.StorageContainerName = $HiveLibStorageContainer | |
# This will be the credential account used for accessing your SQL Azure Hive MetaStore Databases | |
$MetaStoreCreds = Get-Credential -Message "Please enter the credential for your Hive MetaStore database" | |
New-AzureHDInsightClusterConfig -ClusterSizeInNodes $NumNodesInCluster ` | |
| Set-AzureHDInsightDefaultStorage -StorageAccountName "$PrimaryStorageAccount.blob.core.windows.net" -StorageAccountKey $PrimaryStorageAccountKey -StorageContainerName $PrimaryStorageContainer ` | |
| Add-AzureHDInsightMetastore -SqlAzureServerName $SQLAzureServerName -DatabaseName $HiveMetaStoreDB -Credential $MetaStoreCreds -MetastoreType HiveMetastore ` | |
| Add-AzureHDInsightConfigValues -Hive $configvalues ` | |
| New-AzureHDInsightCluster -Subscription $PrimarySubscriptionID -Credential $creds -Name $HDInsightClusterName -Location $HDInsightClusterLocation |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment