0

尝试使用 powershell cmdlet 创建 Azure HDInsight 群集时出现错误:

New-AzureRmHDInsightClusterConfig  `
    | Add-AzureRmHDInsightMetastore `
        -SqlAzureServerName "$sqlDatabaseServerName.database.windows.net" `
        -DatabaseName $hiveMetaStoreDBName `
        -Credential $sqlServerCred `
        -MetastoreType HiveMetaStore `
    | New-AzureRmHDInsightCluster `
        -ResourceGroupName $resourceGroupName `
        -HttpCredential $clusterCreds `         
        -ClusterName $clusterName `
        -Location $location `
        -ClusterType $clusterType `
        -OSType $OSType `
        -Version "$hdVersion" `
        -SshCredential $clusterCreds `
        -DefaultStorageAccountName "$storageAccountName.blob.core.windows.net" `
        -DefaultStorageAccountKey $storageAccountKey `
        -ClusterSizeInNodes $clusterNodes

看起来powershell无法识别参数,因为它要求输入它们(见下文)。我输入了所需的参数(Location、ClusterName、ClusterSizeInNodes),然后出现错误。

cmdlet New-AzureRmHDInsightCluster at command pipeline position 3
Supply values for the following parameters:
(Type !? for Help.)
Location: West Europe
ClusterName: xxxxxxxxx
ClusterSizeInNodes: 1
New-AzureRmHDInsightCluster : BadRequest: ParameterNullOrEmpty,Parameter 'ASVAccount.AccountName' cannot be null or 
empty.
At line:117 char:11
+         | New-AzureRmHDInsightCluster `
+           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [New-AzureRmHDInsightCluster], CloudException
+ FullyQualifiedErrorId : Hyak.Common.CloudException,Microsoft.Azure.Commands.HDInsight.NewAzureHDInsightClusterCom 
   mand

有人知道它为什么会发生或 smdlet 有什么问题吗?

4

2 回答 2

0

$storageAccountName从错误消息中,您的 cmdlet 参数似乎New-AzureRmHDInsightCluster是 Null 或 Empty,您可能需要对此进行进一步检查。

此外,我还强烈建议您也指定-DefaultStorageContainercmdlet New-AzureRmHDInsightCluster。这将确保 cmdlet 能够解析存储帐户 Uri 的 FQDN。

例如asv://YourDefaultContainer@YourDefaultStorageAccountName.blob.core.windows.net/

希望这可以帮助!

于 2015-12-22T21:46:25.763 回答
0
Use below command for Cluster with Hive Metastore.

Here is a working PowerShell script, to be used with Azure ARM PowerShell, 1.0.1 or later – you can install Azure RM PS via web platform installer or follow this blog https://azure.microsoft.com/en-us/blog/azps-1-0/ 


Add-AzureRmAccount
$MyClusterName = "clustername";
$MyClusterLocation = "East US 2";
$NumClusterNodes = 2;
$MyClusterVersion = "3.2";
$MyHDInsightUserName = ""
$MyHDInsightPwd = ""
$MySqlAzureUserName = ""
$MySqlAzurePwd = ""
$MySqlAzureServerName = "*.database.windows.net"
$MySqlAzureDbName = "Dbtest"
$MyDefaultContainerName = "tastoreps"
$clusterResourceGroupName = "dirg"
# Use the correct Azure Subscription!
$subid = ""
Select-AzureRmSubscription -SubscriptionId $subid
# Storage key
$primaryStorageAcctName = "toragesouth"
$primaryStorageResourceGroupName = "storagerg"
# you need to use an ARM based storage as the primary account , classic storage won’t work as a primary account, known issue
$storageAccountKey = Get-AzureRmStorageAccountKey -ResourceGroupName $primaryStorageResourceGroupName -Name $primaryStorageAcctName | %{ $_.Key1 }
# credentials
$HdInsightPwd = ConvertTo-SecureString $MyHDInsightPwd -AsPlainText -Force
$HdInsightCreds = New-Object System.Management.Automation.PSCredential ($MyHDInsightUserName, $HdInsightPwd)
$SqlAzurePwd = ConvertTo-SecureString $MySqlAzurePwd -AsPlainText -Force
$SqlAzureCreds = New-Object System.Management.Automation.PSCredential ($MySqlAzureUserName, $SqlAzurePwd)
$config = New-AzureRmHDInsightClusterConfig -ClusterType Hadoop | 
Add-AzureRmHDInsightMetastore -SqlAzureServerName $MySqlAzureServerName -DatabaseName $MySqlAzureDbName -Credential $SqlAzureCreds -MetastoreType HiveMetastore | 
Add-AzureRmHDInsightMetastore -SqlAzureServerName $MySqlAzureServerName -DatabaseName $MySqlAzureDbName -Credential $SqlAzureCreds -MetastoreType OozieMetastore 
$config.DefaultStorageAccountName="$StorageAcctName.blob.core.windows.net"
$config.DefaultStorageAccountKey=$storageAccountKey
#create cluster
New-AzureRmHDInsightCluster -config $config -OSType Windows -clustername $MyClusterName -HttpCredential $HdInsightCreds -DefaultStorageContainer $MyDefaultContainerName -Location $MyClusterLocation -ResourceGroupName $clusterResourceGroupName -ClusterSizeInNodes $NumClusterNodes -Version $MyClusterVersion
于 2015-12-23T19:22:32.947 回答