Add-AzureRmHDInsightMetastore
將 SQL 資料庫 新增為Hive或 Oozie 中繼存放區至叢集組態物件。
警告
自 2024 年 2 月 29 日起,AzureRM PowerShell 模組已正式淘汰。 建議使用者從 AzureRM 遷移至 Az PowerShell 模組,以確保持續支援和更新。
雖然 AzureRM 模組可能仍可運作,但不再維護或支援它,但會根據用戶的判斷權和風險放置任何繼續使用。 如需轉換至 Az 模組的指引,請參閱我們的 移轉資源 。
語法
Add-AzureRmHDInsightMetastore
[-Config] <AzureHDInsightConfig>
[-MetastoreType] <AzureHDInsightMetastoreType>
[-SqlAzureServerName] <String>
[-DatabaseName] <String>
[-Credential] <PSCredential>
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Description
Add-AzureRmHDInsightMetastore Cmdlet 會將 Hive 或 Oozie 中繼存放區新增至 New-AzureRmHDInsightClusterConfig Cmdlet 所建立的 HDInsight 組態物件。 中繼存放區是 SQL 資料庫,可用來儲存 Hive、Oozie 或兩者的元數據。
範例
範例 1:將 SQL 資料庫中繼存放區新增至叢集組態物件
PS C:\># Primary storage account info
PS C:\> $storageAccountResourceGroupName = "Group"
PS C:\> $storageAccountName = "yourstorageacct001"
PS C:\> $storageAccountKey = (Get-AzureRmStorageAccountKey -ResourceGroupName $storageAccountResourceGroupName -Name $storageAccountName)[0].value
PS C:\> $storageContainer = "container001"
# Cluster configuration info
PS C:\> $location = "East US 2"
PS C:\> $clusterResourceGroupName = "Group"
PS C:\> $clusterName = "your-hadoop-001"
PS C:\> $clusterCreds = Get-Credential
# If the cluster's resource group doesn't exist yet, run:
# New-AzureRmResourceGroup -Name $clusterResourceGroupName -Location $location
# Hive metastore info
PS C:\> $hiveSqlServer = "your-sqlserver-001"
PS C:\> $hiveDb = "your-sqldb-001"
PS C:\> $hiveCreds = Get-Credential
# Oozie metastore info
PS C:\> $oozieSqlServer = "your-sqlserver-001"
PS C:\> $oozieDb = "your-sqldb-002"
PS C:\> $oozieCreds = Get-Credential
# Create the cluster
PS C:\> New-AzureRmHDInsightClusterConfig `
| Add-AzureRmHDInsightMetastore `
-SqlAzureServerName "$oozieSqlServer.database.contoso.net" `
-DatabaseName $oozieDb `
-Credential $oozieCreds `
-MetastoreType OozieMetastore `
| Add-AzureRmHDInsightMetastore `
-SqlAzureServerName "$hiveSqlServer.database.contoso.net" `
-DatabaseName $hiveDb `
-Credential $hiveCreds `
-MetastoreType HiveMetastore `
| New-AzureRmHDInsightCluster `
-ClusterType Hadoop `
-OSType Windows `
-ClusterSizeInNodes 4 `
-ResourceGroupName $clusterResourceGroupName `
-ClusterName $clusterName `
-HttpCredential $clusterCreds `
-Location $location `
-DefaultStorageAccountName "$storageAccountName.blob.core.contoso.net" `
-DefaultStorageAccountKey $storageAccountKey `
-DefaultStorageContainer $storageContainer
此命令會將 SQL 資料庫中繼存放區新增至名為 your-hadoop-001 的叢集。
參數
-Config
指定此 Cmdlet 修改的 HDInsight 叢集組態物件。 此物件是由 New-AzureRmHDInsightClusterConfig 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 |
別名: | AzureRmContext, AzureCredential |
Position: | Named |
預設值: | None |
必要: | False |
接受管線輸入: | False |
接受萬用字元: | False |
-MetastoreType
指定中繼存放區的類型。 可能的值為 HiveMetastore 或 OozieMetastore。
類型: | AzureHDInsightMetastoreType |
接受的值: | HiveMetastore, OozieMetastore |
Position: | 1 |
預設值: | None |
必要: | True |
接受管線輸入: | False |
接受萬用字元: | False |
-SqlAzureServerName
指定要用於此中繼存放區的 AzureSQL Server 實例。
類型: | String |
Position: | 2 |
預設值: | None |
必要: | True |
接受管線輸入: | False |
接受萬用字元: | False |
輸入
參數:設定(ByValue)