Add-AzHDInsightScriptAction
语法
Default (默认值)
Add-AzHDInsightScriptAction
[-Config] <AzureHDInsightConfig>
[-NodeType] <ClusterNodeType>
[-Uri] <Uri>
[-Name] <String>
[[-Parameters] <String>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
说明
Add-AzHDInsightScriptAction cmdlet 将脚本作添加到由 New-AzHDInsightClusterConfig cmdlet 创建的 HDInsight 配置对象。
脚本作提供用于安装其他软件的功能,或者分别使用 Windows PowerShell 或 Bash 脚本(适用于 Windows 或 Linux 群集)更改 Hadoop 群集上运行的应用程序的配置。
部署 HDInsight 群集时,脚本作在群集节点上运行,并在群集中的节点完成 HDInsight 配置后运行。
脚本作在系统管理员帐户特权下运行,并提供对群集节点的完全访问权限。
可以为每个群集提供要在指定序列中运行的脚本作列表。
示例
示例 1:向群集配置对象添加脚本作
# Primary storage account info
$storageAccountResourceGroupName = "Group"
$storageAccountResourceId = "yourstorageaccountresourceid"
$storageAccountName = "yourstorageacct001"
$storageAccountKey = (Get-AzStorageAccountKey -ResourceGroupName $storageAccountResourceGroupName -Name $storageAccountName)[0].value
$storageContainer = "container001"
# Script action info
$scriptActionName = "<script action name>"
$scriptActionURI = "<script action URI>"
$scriptActionParameters = "<script action parameters>"
# 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
# Create the cluster
New-AzHDInsightClusterConfig `
| Add-AzHDInsightScriptAction `
-Name $scriptActionName `
-Uri $scriptActionURI `
-Parameters $scriptActionParameters `
-NodeType Worker `
| Add-AzHDInsightScriptAction `
-Name $scriptActionName `
-Uri $scriptActionURI `
-Parameters $scriptActionParameters `
-NodeType Head `
| New-AzHDInsightCluster `
-ClusterType Hadoop `
-OSType Windows `
-ClusterSizeInNodes 4 `
-ResourceGroupName $clusterResourceGroupName `
-ClusterName $clusterName `
-HttpCredential $clusterCreds `
-Location $location `
-StorageAccountResourceId $storageAccountResourceId `
-StorageAccountKey $storageAccountKey `
-StorageContainer $storageContainer
此命令为群集的头节点和辅助角色节点添加脚本作,以便在群集创建结束时运行。
参数
-Config
指定此 cmdlet 修改的 HDInsight 群集配置对象。
此对象由 New-AzHDInsightClusterConfig cmdlet 创建。
参数属性
参数集
(All)
| Position: | 0 |
| 必需: | True |
| 来自管道的值: | True |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-DefaultProfile
用于与 azure 通信的凭据、帐户、租户和订阅
参数属性
参数集
(All)
| Position: | Named |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-Name
指定脚本作的名称。
参数属性
| 类型: | String
|
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
(All)
| Position: | 3 |
| 必需: | True |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-NodeType
指定要对其运行脚本作的节点类型。
此参数的可接受值为:
- HeadNode
- WorkerNode
- ZookeeperNode
参数属性
| 类型: | ClusterNodeType
|
| 默认值: | None |
| 接受的值: | HeadNode, WorkerNode, ZookeeperNode, EdgeNode |
| 支持通配符: | False |
| 不显示: | False |
参数集
(All)
| Position: | 1 |
| 必需: | True |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-Parameters
指定脚本作的参数。
参数属性
| 类型: | String
|
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
(All)
| Position: | 4 |
| 必需: | False |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
-Uri
指定脚本作的公共 URI(PowerShell 或 Bash 脚本)。
参数属性
| 类型: | Uri
|
| 默认值: | None |
| 支持通配符: | False |
| 不显示: | False |
参数集
(All)
| Position: | 2 |
| 必需: | True |
| 来自管道的值: | False |
| 来自管道的值(按属性名称): | False |
| 来自剩余参数的值: | False |
CommonParameters
此 cmdlet 支持通用参数:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 有关详细信息,请参阅 about_CommonParameters。
输出