调用InvokeShellCommand在指定的集群节点内执行交互命令。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
请求参数
名称 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
Action | String | 是 | InvokeShellCommand |
系统规定参数。取值:InvokeShellCommand |
ClusterId | String | 是 | ehpc-hz-FYUr32**** |
集群ID。 |
Command | String | 是 | echo "hello world" |
命令内容。长度为2~2048个字符。 |
Instance.N.Id | String | 否 | i-1d24**** |
第N个执行命令的节点实例ID。 说明 用于限定执行范围,不指定则默认在集群所有节点上执行。
|
WorkingDir | String | 否 | /root |
命令工作目录。默认值为/root。 |
Timeout | Integer | 否 | 3600 |
超时时间,超时将终止命令进程。单位:秒 最小值:60 默认值:3600 |
返回数据
名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
CommandId | String | c-f4682204a89949979d75e76700e**** |
命令ID,可用于后续查询命令执行情况。 |
InstanceIds | List | ["i-uf68t1zu3jkhs8w****"] |
执行命令的实例ID列表。 |
RequestId | String | 04F0F334-1335-436C-A1D7-6C044FE73368 |
请求ID。 |
示例
请求示例
https://ehpc.cn-hangzhou.aliyuncs.com/?Action=InvokeShellCommand
&ClusterId=ehpc-hz-FYUr32****
&Command=echo "hello world"
&<公共请求参数>
正常返回示例
XML
格式
<InvokeShellCommandResponse>
<RequestId>04F0F334-1335-436C-A1D7-6C044FE73368</RequestId>
<CommandId>c-f4682204a89949979d75e76700e0****</CommandId>
<InstanceIds>
<InstanceId>i-uf68t1zu3jkhs8w****</InstanceId>
<InstanceId>i-uf6abz34m2714bp****</InstanceId>
<InstanceId>i-uf65bh2113hlqvyx****</InstanceId>
<InstanceId>i-uf68t1zu3jkhs8wx****</InstanceId>
<InstanceId>i-uf6b0mtpx166fxxi****</InstanceId>
<InstanceId>i-uf6faknz4dy1bit7****</InstanceId>
</InstanceIds>
</InvokeShellCommandResponse>
JSON
格式
{
"RequestId": "04F0F334-1335-436C-A1D7-6C044FE73368",
"CommandId": "c-f4682204a89949979d75e76700e0****",
"InstanceIds": {
"InstanceId": [
"i-uf68t1zu3jkhs8w****",
"i-uf6abz34m2714bp****",
"i-uf65bh2113hlqvyx****",
"i-uf68t1zu3jkhs8wx****",
"i-uf6b0mtpx166fxxi****",
"i-uf6faknz4dy1bit7****"
]
}
}
错误码
HttpCode | 错误码 | 错误信息 | 描述 |
---|---|---|---|
503 | ServiceUnavailable | The request has failed due to a temporary failure of the server | 请求失败,服务暂时不可用 |
访问错误中心查看更多错误码。