Add-AzHDInsightMetastore
將 SQL Database 新增為 Hive 或 Oozie 中繼存放區至叢集組態物件。
語法
Add-AzHDInsightMetastore
[-Config] <AzureHDInsightConfig>
[-MetastoreType] <AzureHDInsightMetastoreType>
[-SqlAzureServerName] <String>
[-DatabaseName] <String>
[-Credential] <PSCredential>
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Description
Add-AzHDInsightMetastore Cmdlet 會將 Hive 或 Oozie 中繼存放區新增至 New-AzHDInsightClusterConfig Cmdlet 所建立的 HDInsight 組態物件。 中繼存放區是 SQL Database,可用來儲存 Hive、Oozie 或兩者的元數據。
範例
範例 1:將 SQL 資料庫中繼存放區新增至叢集組態物件
# Primary storage account info
$storageAccountResourceGroupName = "Group"
$storageAccountResourceId = "yourstorageaccountresourceid"
$storageAccountName = "yourstorageacct001"
$storageAccountKey = (Get-AzStorageAccountKey -ResourceGroupName $storageAccountResourceGroupName -Name $storageAccountName)[0].value
$storageContainer = "container001"
# Cluster configuration info
$location = "East US 2"
$clusterResourceGroupName = "Group"
$clusterName = "your-hadoop-001"
$clusterCreds = Get-Credential
# If the cluster's resource group doesn't exist yet, run:
# New-AzResourceGroup -Name $clusterResourceGroupName -Location $location
# Hive metastore info
$hiveSqlServer = "your-sqlserver-001"
$hiveDb = "your-sqldb-001"
$hiveCreds = Get-Credential
# Oozie metastore info
$oozieSqlServer = "your-sqlserver-001"
$oozieDb = "your-sqldb-002"
$oozieCreds = Get-Credential
# Create the cluster
New-AzHDInsightClusterConfig `
| Add-AzHDInsightMetastore `
-SqlAzureServerName "$oozieSqlServer.database.contoso.net" `
-DatabaseName $oozieDb `
-Credential $oozieCreds `
-MetastoreType OozieMetastore `
| Add-AzHDInsightMetastore `
-SqlAzureServerName "$hiveSqlServer.database.contoso.net" `
-DatabaseName $hiveDb `
-Credential $hiveCreds `
-MetastoreType HiveMetastore `
| New-AzHDInsightCluster `
-ClusterType Hadoop `
-OSType Windows `
-ClusterSizeInNodes 4 `
-ResourceGroupName $clusterResourceGroupName `
-ClusterName $clusterName `
-HttpCredential $clusterCreds `
-Location $location `
-StorageAccountResourceId $storageAccountResourceId `
-StorageAccountKey $storageAccountKey `
-StorageContainer $storageContainer
此命令會將 SQL 資料庫中繼存放區新增至名為 your-hadoop-001 的叢集。
範例 2:將自定義 Ambari 資料庫新增至叢集組態物件
# Primary storage account info
$storageAccountResourceGroupName = "Group"
$storageAccountResourceId = "yourstorageaccountresourceid"
$storageAccountName = "yourstorageacct001"
$storageAccountKey = (Get-AzStorageAccountKey -ResourceGroupName $storageAccountResourceGroupName -Name $storageAccountName)[0].value
$storageContainer = "container001"
# Cluster configuration info
$location = "East US 2"
$clusterResourceGroupName = "Group"
$clusterName = "your-hadoop-002"
$clusterCreds = Get-Credential
# If the cluster's resource group doesn't exist yet, run:
# New-AzResourceGroup -Name $clusterResourceGroupName -Location $location
# Custom Amari database info
$ambariSqlServer = "your-sqlserver-001"
$ambariDb = "your-sqldb-003"
$ambariCreds = Get-Credential
# Create the cluster
New-AzHDInsightClusterConfig `
| Add-AzHDInsightMetastore `
-SqlAzureServerName "$ambariSqlServer.database.contoso.net" `
-DatabaseName $ambariDb `
-Credential $ambariCreds `
-MetastoreType AmbariDatabase `
| New-AzHDInsightCluster `
-ClusterType Hadoop `
-OSType Windows `
-ClusterSizeInNodes 4 `
-ResourceGroupName $clusterResourceGroupName `
-ClusterName $clusterName `
-HttpCredential $clusterCreds `
-Location $location `
-StorageAccountResourceId $storageAccountResourceId `
-StorageAccountKey $storageAccountKey `
-StorageContainer $storageContainer
此命令會將自定義Ambari資料庫新增至名為your-hadoop-002的叢集。
參數
-Config
指定此 Cmdlet 修改的 HDInsight 叢集組態物件。 此物件是由 New-AzHDInsightClusterConfig Cmdlet 所建立。
類型: | AzureHDInsightConfig |
Position: | 0 |
預設值: | None |
必要: | True |
接受管線輸入: | True |
接受萬用字元: | False |
-Credential
指定要用於 AzureSQL Server 資料庫的認證。
類型: | PSCredential |
Position: | 4 |
預設值: | None |
必要: | True |
接受管線輸入: | False |
接受萬用字元: | False |
-DatabaseName
指定要用於此中繼存放區的 AzureSQL Server 實例上的資料庫。
類型: | String |
Position: | 3 |
預設值: | None |
必要: | True |
接受管線輸入: | False |
接受萬用字元: | False |
-DefaultProfile
用於與 azure 通訊的認證、帳戶、租用戶和訂用帳戶
類型: | IAzureContextContainer |
別名: | AzContext, AzureRmContext, AzureCredential |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-MetastoreType
指定中繼存放區的類型。 可能的值為 HiveMetastore 或 OozieMetastore。
類型: | AzureHDInsightMetastoreType |
接受的值: | HiveMetastore, OozieMetastore, AmbariDatabase |
Position: | 1 |
預設值: | None |
必要: | True |
接受管線輸入: | False |
接受萬用字元: | False |
-SqlAzureServerName
指定要用於此中繼存放區的 AzureSQL Server 實例。
類型: | String |
Position: | 2 |
預設值: | None |
必要: | True |
接受管線輸入: | False |
接受萬用字元: | False |