简体   繁体   中英

How to create Azure HDInsight cluster with Hive metastore using Powershell?

I was trying to create HDInsight cluster with Hive metastore. Cluster was created successfully but without Hive metastore. Also any error was not returned. I used Powershell script below.

$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             

Could somebody tell me the reason why Hive metastore was not created? Or what should I do to create it?

The cluster creation process doesn't create the Azure Database for you. You must create the database before you can use it as the Hive metastore.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM