共用方式為


Set-AzureHDInsightDefaultStorage

設定 HDInsight 叢集的預設儲存體帳戶。

注意

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

Syntax

Set-AzureHDInsightDefaultStorage
   -Config <AzureHDInsightConfig>
   -StorageAccountKey <String>
   -StorageAccountName <String>
   -StorageContainerName <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

Set-AzureHDInsightDefaultStorage Cmdlet 會設定 HDInsight 叢集組態的預設儲存體帳戶。

範例

範例 1:設定預設儲存體帳戶

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 來取得目前訂用帳戶的認證,然後將認證儲存在$Creds、$OozieCreds和$HiveCreds變數中。

最後一個命令會使用這些 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

-Profile

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

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

-StorageAccountKey

指定用來存取預設儲存體帳戶的儲存體帳戶金鑰。

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

-StorageAccountName

指定預設儲存體帳戶的名稱。

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

-StorageContainerName

指定叢集的預設儲存體容器名稱。

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