如何使用Powershell创建具有Hive Metastore的Azure HDInsight群集?

时间:2016-01-05 17:06:30

标签: powershell azure hadoop hive hdinsight

我正在尝试使用Hive Metastore创建HDInsight群集。群集已成功创建但没有Hive Metastore。还没有返回任何错误。我在下面使用了Powershell脚本。

$resourceGroupName = "ResourceGroup"
$storageAccountName = "myStorage"
$containerName="myContainer"

$clusterName = "myCluster"
$location = "West Europe"
$clusterNodes = 2
$clusterType = "Hadoop"
$OSType = "Windows"
$hdVersion = "3.2"

$hadoopUserName = "user"
$hadoopUserPassword = "password"
$hadoopUserPW = ConvertTo-SecureString -String $hadoopUserPassword -AsPlainText -Force
$clusterCreds = New-Object System.Management.Automation.PSCredential($hadoopUserName,$hadoopUserPW)

$sqlDatabaseServerName = "mydbserver"
$metaStoreDBName = "HiveMetaStoreDB"
$sqlDatabaseLogin = "myDBLogin"
$sqlDatabasePassword = "myDBPassword"
$sqlDatabaseSecurePassword = ConvertTo-SecureString -String $sqlDatabasePassword -AsPlainText -Force
$sqlServerCred = New-Object System.Management.Automation.PSCredential ($sqlDatabaseLogin, $sqlDatabaseSecurePassword)


# Create a new HDInsight cluster

    $config = New-AzureRmHDInsightClusterConfig -ClusterType Hadoop `
        | Add-AzureRmHDInsightMetastore `
            -SqlAzureServerName "$sqlDatabaseServerName.database.windows.net" `
            -DatabaseName $metaStoreDBName `
            -Credential $sqlServerCred `
            -MetastoreType HiveMetastore 

$config.DefaultStorageAccountName = "$storageAccountName.blob.core.windows.net"
$config.DefaultStorageAccountKey = $storageAccountKey           

New-AzureRmHDInsightCluster `
        -config $config `
        -OSType $OSType `
        -clustername $clusterName `
        -HttpCredential $clusterCreds `
        -DefaultStorageContainer $containerName `
        -Location $location `
        -ResourceGroupName $resourceGroupName `
        -ClusterSizeInNodes $clusterNodes `
        -Version $hdVersion             

有人可以告诉我为什么没有创建Hive Metastore吗?或者我应该怎么做才能创建它?

1 个答案:

答案 0 :(得分:0)

群集创建过程不会为您创建Azure数据库。您必须先创建数据库,然后才能将其用作Hive Metastore。