更新时间:2022-12-14 GMT+08:00

API概览

MRS提供的符合RESTful API的设计规范的接口,如表1表2所示。

MRS 版本演进过程中逐步废弃部分接口,具体请参见表3

表1 V2接口

接口

功能

API URI

集群管理接口

创建集群

POST /v2/{project_id}/clusters

作业对象接口

新增并执行作业

POST /v2/{project_id}/clusters/{cluster_id}/job-executions

查询单个作业信息

GET /v2/{project_id}/clusters/{cluster_id}/job-executions/{job_execution_id}

查询作业列表信息

GET /v2/{project_id}/clusters/{cluster_id}/job-executions

终止作业

POST /v2/{project_id}/clusters/{cluster_id}/job-executions/{job_execution_id}/kill

批量删除作业

POST /v2/{project_id}/clusters/{cluster_id}/job-executions/batch-delete

获取SQL结果

GET /v2/{project_id}/clusters/{cluster_id}/job-executions/{job_execution_id}/sql-result

SQL接口

提交SQL语句

POST /v2/{project_id}/clusters/{cluster_id}/sql-execution

查询SQL结果

GET /v2/{project_id}/clusters/{cluster_id}/sql-execution/{sql_id}

取消SQL执行任务

POST /v2/{project_id}/clusters/{cluster_id}/sql-execution/{sql_id}/cancel

集群HDFS文件接口(V2)

获取指定目录文件列表

GET /v2/{project_id}/clusters/{cluster_id}/files?path={directory}&offset={offset}&limit={limit}&sort_key={sort_key}&order={order}

委托管理(V2)

查询用户(组)与IAM委托的映射关系

GET /v2/{project_id}/clusters/{cluster_id}/agency-mapping

更新用户(组)与IAM委托的映射

PUT /v2/{project_id}/clusters/{cluster_id}/agency-mapping

表2 V1.1接口

接口

功能

API URI

集群管理接口

创建集群并执行作业

POST /v1.1/{project_id}/run-job-flow

调整集群节点

PUT /v1.1/{project_id}/cluster_infos/{cluster_id}

查询集群列表

GET /v1.1/{project_id}/cluster_infos

查询集群详情

GET /v1.1/{project_id}/cluster_infos/{cluster_id}

删除集群

DELETE /v1.1/{project_id}/clusters/{cluster_id}

查询主机列表

GET /v1.1/{project_id}/clusters/{cluster_id}/hosts

作业对象接口

新增作业并执行(废弃)

POST /v1.1/{project_id}/jobs/submit-job

查询作业exe对象列表(废弃)

GET /v1.1/{project_id}/job-exes

查询作业exe对象详情(废弃)

GET /v1.1/{project_id}/job-exes/{job_exe_id}

作业执行对象接口

删除作业执行对象(废弃)

DELETE /v1.1/{project_id}/job-executions/{job_execution_id}

弹性伸缩接口

配置弹性伸缩规则

POST /v1.1/{project_id}/autoscaling-policy/{cluster_id}

标签管理接口

给指定集群添加标签

POST /v1.1/{project_id}/clusters/{cluster_id}/tags

删除指定集群的标签

DELETE /v1.1/{project_id}/clusters/{cluster_id}/tags/{key}

查询指定集群的标签

GET /v1.1/{project_id}/clusters/{cluster_id}/tags

批量添加集群标签

POST /v1.1/{project_id}/clusters/{cluster_id}/tags/action

查询所有标签

GET /v1.1/{project_id}/clusters/tags

查询特定标签的集群列表

POST /v1.1/{project_id}/clusters/resource_instances/action

表3 历史API接口

接口

功能

API URI

V1.1 作业管理接口

新增作业并执行

POST /v1.1/{project_id}/jobs/submit-job

查询作业exe对象列表

GET /v1.1/{project_id}/job-exes

查询作业exe对象详情

GET /v1.1/{project_id}/job-exes/{job_exe_id}

删除作业执行对象

DELETE /v1.1/{project_id}/job-executions/{job_execution_id}