共用方式為


Add-AzureHDInsightMetastore

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

注意

本檔中參考的 Cmdlet 用於管理使用服務管理 API 的舊版 Azure 資源。 如需管理 Azure Resource Manager 資源的 Cmdlet,請參閱 Az PowerShell 模組

Syntax

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 會將中繼存放區資訊新增至此參數所指定的組態物件。

Type:AzureHDInsightConfig
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Credential

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

Type:PSCredential
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-DatabaseName

指定要儲存 Hive 或 Oozie 中繼資料的資料庫名稱。

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-MetastoreType

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

Type:AzureHDInsightMetastoreType
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Profile

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

Type:AzureSMProfile
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-SqlAzureServerName

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

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False