共用方式為


Add-AzureHDInsightMetastore

將 SQL Server 資料庫帳戶新增至 HDInsight 叢集組態。

注意

本文件中參考的 Cmdlet 用於管理使用 Azure Service Manager(ASM) API 的舊版 Azure 資源。 建立新的資源時,不建議使用此舊版 PowerShell 模組,因為 ASM 已排定淘汰。 如需詳細資訊,請參閱 Azure Service Manager 淘汰

Az PowerShell 模組是使用 PowerShell 管理 Azure Resource Manager (ARM) 資源的建議 PowerShell 模組。

語法

Add-AzureHDInsightMetastore
   -Config <AzureHDInsightConfig>
   -Credential <PSCredential>
   -DatabaseName <String>
   -MetastoreType <AzureHDInsightMetastoreType>
   -SqlAzureServerName <String>
   [-Profile <AzureSMProfile>]
   [<CommonParameters>]

Description

此版本的 Azure PowerShell HDInsight 已被取代。 這些 Cmdlet 將於 2017 年 1 月 1 日移除。 請使用較新版本的 Azure PowerShell HDInsight。

如需如何使用新的 HDInsight 建立叢集的資訊,請參閱 使用 Azure PowerShell 在 HDInsight 中建立以 Linux 為基礎的叢集(https://azure.microsoft.com/en-us/documentation/articles/hdinsight-hadoop-create-linux-clusters-azure-powershell/)。 如需如何使用 Azure PowerShell 和其他方法提交作業的資訊,請參閱 在 HDInsight 中提交 Hadoop 作業 (https://azure.microsoft.com/en-us/documentation/articles/hdinsight-submit-hadoop-jobs-programmatically/)。 如需 Azure PowerShell HDInsight 的參考資訊,請參閱 Azure HDInsight Cmdlet

Add-AzureHDInsightMetastore Cmdlet 會將Microsoft SQL Server 資料庫新增至 New-AzureHDInsightClusterConfig Cmdlet 所建立的 Azure HDInsight 組態。 資料庫用來儲存Hive或 Oozie 的元數據,或兩者。

範例

範例 1:新增中繼存放區

PS C:\>$Metaconfig = Add-AzureHDInsightMetastore -Config $Config -SqlAzureServerName "ContosoSQLServer" -DatabaseName "DBname" -Credential (Get-Credential) -MetastoreType HiveMetaStore

此命令會新增名為 ContosoSQLServer 的 SQL Server 資料庫,做為 HDInsight 叢集的 Hive 中繼存放區。

範例 2:設定記憶體並新增中繼存放區

PS C:\>$SubId = (Get-AzureSubscription -Current).SubscriptionId
PS C:\> $Key1 = Get-AzureStorageKey -StorageAccountName "MyBlobStorage" | %{ $_.Primary }
PS C:\> $Key2 = Get-AzureStorageKey -StorageAccountName "MySecondBlobStorage" | %{ $_.Primary }
PS C:\> $Creds = Get-Credential
PS C:\> $OozieCreds = Get-Credential
PS C:\> $HiveCreds = Get-Credential
PS C:\> New-AzureHDInsightClusterConfig -ClusterSizeInNodes 4
    | Set-AzureHDInsightDefaultStorage -StorageAccountName "MyBlobStorage.blob.core.windows.net" -StorageAccountKey $Key1 -StorageContainerName "MyContainer"
    | Add-AzureHDInsightStorage -StorageAccountName "MySecondBlobStorage.blob.core.windows.net" -StorageAccountKey $Key2
    | Add-AzureHDInsightMetastore -SqlAzureServerName "MySqlServer.database.windows.net" -DatabaseName "MyOozieDatabaseName" -Credential $OozieCreds -MetastoreType OozieMetastore
    | Add-AzureHDInsightMetastore -SqlAzureServerName "MySqlServer.database.widows.net" -DatabaseName "MyHiveDatabaseName" -Credential $HiveCreds -MetastoreType HiveMetastore
    | New-AzureHDInsightCluster -Subscription $SubId -Credential $Creds

第一個命令會使用 Get-AzureSubscription Cmdlet 來取得目前的訂用帳戶標識符,然後將它儲存在$SubId變數中。

第二個和第三個命令會使用 Get-AzureStorageKey Cmdlet 來取得 MyBlobStorage 和 MySecondBlobStorage 的主要記憶體密鑰,然後將密鑰分別儲存在 $Key 1 和 $Key 2 變數中。

第四、第五和第六個命令會使用 Get-Credential Cmdlet 來取得目前訂用帳戶和 Oozie 和 Hive 的認證,然後將認證儲存在變數中。

最後一個命令會使用這些 Cmdlet 來執行一連串的作業:

  • New-AzureHDInsightClusterConfig 來建立 HDInsight 叢集組態。
  • Set-AzureHDInsightDefaultStorage ,將組態的默認記憶體帳戶設定為 MyBlobStorage.blob.core.windows.net。
  • Add-AzureHDInsightStorage ,將名為 MySecondBlobStorage.blob.core.windows.net 的第二個記憶體帳戶新增至組態。
  • Add-AzureHDInsightMetastore 將 Oozie 的中繼存放區和 Hive 的中繼存放區新增至組態。
  • New-AzureHDInsightCluster ,以使用新的組態建立 HDInsight 叢集。

參數

-Config

指定組態物件。 這個 Cmdlet 會將中繼存放區資訊新增至此參數所指定的組態物件。

類型:AzureHDInsightConfig
Position:Named
預設值:None
必要:True
接受管線輸入:True
接受萬用字元:False

-Credential

指定用來存取 SQL Server 資料庫的認證。

類型:PSCredential
Position:Named
預設值:None
必要:True
接受管線輸入:False
接受萬用字元:False

-DatabaseName

指定要儲存 Hive 或 Oozie 元數據的資料庫名稱。

類型:String
Position:Named
預設值:None
必要:True
接受管線輸入:False
接受萬用字元:False

-MetastoreType

指定中繼存放區類型。 此參數可接受的值為:HiveMetaStore 或 OozieMetaStore。

類型:AzureHDInsightMetastoreType
Position:Named
預設值:None
必要:True
接受管線輸入:False
接受萬用字元:False

-Profile

指定此 Cmdlet 從中讀取的 Azure 設定檔。 如果您未指定設定檔,此 Cmdlet 會從本機預設配置檔讀取。

類型:AzureSMProfile
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-SqlAzureServerName

指定包含要儲存元數據之資料庫之 SQL Server 的完整功能變數名稱 (FQDN)。

類型:String
Position:Named
預設值:None
必要:True
接受管線輸入:False
接受萬用字元:False