集群操作接口
创建集群
接口描述
向BMR服务请求创建一个新的集群。
权限说明
请求发起人需要具有合法的AccessKeyID和SecretAccessKey才能发起请求,请参考 鉴权认证。
注意事项
如果请求中没有用户验证信息(即匿名访问),返回403 Forbidden
,错误信息:AccessDenied
。
请求结构
1POST /v{version}/cluster?clientToken={clientToken} HTTP/1.1
2accept-encoding: gzip, deflate
3x-bce-date: {utc-date-string}
4host: bmr.bj.baidubce.com
5connection: keep-alive
6accept: */*
7content-type: application/json
8authorization: {bce-authorization-string}
9{
10 "applications": [
11 {
12 "name": appilicationName,
13 "version": applicationVersion
14 },
15 {
16 "name": appilicationName,
17 "version": applicationVersion
18 }
19 ],
20 "securityGroup": securityGroupId,
21 "vpcId": vpcShortId,
22 "subnetId": subnetShortId,
23 "autoTerminate": false,
24 "imageType": imageType,
25 "imageVersion": imageVersion,
26 "serviceHaEnabled":serviceHaEnabled,
27 "safeModeEnabled":safeModeEnabled,
28 "instanceGroups": [
29 {
30 "instanceCount": instanceCount,
31 "instanceType": instanceType,
32 "type": instanceGroupType,
33 "rootDiskSizeInGB": rootDiskSizeInGB,
34 "rootDiskMediumType": rootDiskMediumType,
35 "cds": [
36 {
37 "sizeInGB": sizeInGB,
38 "mediumType": mediumType
39 },
40 {
41 "sizeInGB": sizeInGB,
42 "mediumType": mediumType
43 }
44 ]
45 }
46 ],
47 "logUri": logUri,
48 "name": clusterName,
49 "adminPassword": adminPassword,
50 "steps": [
51 {
52 "actionOnFailure": actionOnFailture,
53 "name": stepName,
54 "properties": {
55 "arguments": arguments,
56 "mapper": mapper,
57 "reducer": reducer,
58 "input": input,
59 "output": output
60 },
61 "type": stepType,
62 "additionalFiles":[]
63 }
64 ]
65}
请求头域
除公共头域外,无其它特殊头域。
售卖套餐请参考https://cloud.baidu.com/doc/BMR/s/6jwvxw85z
请求参数
名称 | 类型 | 是否必须 | 参数位置 | 参数描述 |
---|---|---|---|---|
version | String | 是 | URL参数 | API版本号,当前取值1 |
imageType | String | 是 | RequestBody参数 | 集群类型,比如 hadoop,参考BMR集群 |
imageVersion | String | 是 | RequestBody参数 | 集群版本,比如 2.2.2,参考BMR集群 |
instanceGroups | List<InstanceGroupConfig> | 是 | RequestBody参数 | 实例组配置 |
clientToken | String | 否 | Query参数 | 幂等性Token,是一个长度不超过64位的ASCII字符串 |
applications | List<ApplicationConfig> | 否 | RequestBody参数 | 需要安装的组件信息(如hive,pig,hbase) |
autoTerminate | Boolean | 否 | RequestBody参数 | 为true则在运行完所有作业后自动释放集群,默认为true |
logUri | String | 否 | RequestBody参数 | 用于上传运行日志的BOS路径,不提供则不上传日志 |
name | String | 否 | RequestBody参数 | 集群名称,默认为my-cluster |
steps | List<StepConfig> | 否 | RequestBody参数 | 需要运行的作业信息,参考添加作业协议 |
vpcId | String | 是 | RequestBody参数 | 设置vpc短ID信息 |
subnetId | String | 是 | RequestBody参数 | 设置子网短ID信息 |
securityGroup | String | 是 | RequestBody参数 | 设置安全组短ID |
adminPassword | String | 是 | RequestBody参数 | 设置集群密码,8-16位字符,英文,数字和符号必须同时存在,符号仅限!@#$%^*(),密码需要加密传输 |
响应头域
除公共头域外,无其它特殊头域。
响应参数
名称 | 类型 | 描述 |
---|---|---|
clusterId | String | 系统生成的集群唯一标识 |
请求示例
1POST /v1/cluster?clientToken=be31b98c-5e41-4838-9830-9be700de5a20 HTTP/1.1
2accept-encoding: gzip, deflate
3x-bce-date: 2022-01-26T13:02:00Z
4host: bmr.bj.baidubce.com
5connection: keep-alive
6accept: */*
7content-type: application/json
8authorization: bce-auth-v1/46bd9968a6194b4bbdf0341f2286ccce/2022-01-26T13:02:00Z/1800/host;x-bce-date/994014d96b0eb26578e039fa053a4f9003425da4bfedf33f4790882fb4c54903
9
10{
11 "applications": [
12 {
13 "name": "hive",
14 "version": "3.1.0"
15 },
16 {
17 "name": "tez",
18 "version": "0.9.1"
19 },
20 {
21 "name": "spark2",
22 "version": "2.4.4"
23 }
24 ],
25 "securityGroup": "g-ai3jzpiadv1x",
26 "vpcId": "d5465344-e783-41b1-9765-ec3ee4bec332",
27 "subnetId": "b35c3b60-18a0-42a6-87e7-e857dadd9ec3",
28 "autoTerminate": false,
29 "imageType": "hadoop",
30 "imageVersion": "2.2.2",
31 "serviceHaEnabled":true,
32 "safeModeEnabled":false,
33 "instanceGroups": [
34 {
35 "instanceCount": 1,
36 "instanceType": "bmr.g1.xlarge",
37 "type": "Master",
38 "rootDiskSizeInGB": 40,
39 "rootDiskMediumType": "ssd",
40 "cds": [
41 {
42 "sizeInGB": 50,
43 "mediumType": "ssd"
44 }
45 ]
46 },
47 {
48 "instanceCount": 3,
49 "instanceType": "bmr.g1.xlarge",
50 "type": "Core",
51 "rootDiskSizeInGB": 40,
52 "rootDiskMediumType": "ssd",
53 "cds": [
54 {
55 "sizeInGB": 50,
56 "mediumType": "ssd"
57 }
58 ]
59 }
60 ],
61 "logUri": "bos://data-wh-sdk-bigdata/clusterlog",
62 "name": "my-cluster",
63 "adminPassword": "7c658fefaaae7d4516d9305b27770a55",
64 "steps": [
65 {
66 "actionOnFailure": "Continue",
67 "name": "my-mapreduce-streaming",
68 "properties": {
69 "arguments": "-D mapreduce.job.reduces=20",
70 "mapper": "cat",
71 "reducer": "cat",
72 "input": "bos://mybucket/inputs/txt-1m",
73 "output": "bos://mybucket/outputs/streaming"
74 },
75 "type": "Streaming",
76 "additionalFiles":[
77 {
78 "remote":"bos://mybucket/i",
79 "local":""
80 },
81 {
82 "remote":"",
83 "local":""
84 }
85 ]
86 }
87 ]
88 }
响应示例
1HTTP/1.1 201 CREATED
2Transfer-Encoding: chunked
3x-bce-request-id: 73c4e74c-3101-4a00-bf44-fe246959c05e
4Cache-Control: no-cache
5Server: BWS
6Date: Wed, 26 Jan 2022 13:02:01 GMT
7Content-Type: application/json;charset=UTF-8
8{
9 "clusterId": "0181b994-576a-4a00-b04e-f6fa9d5eee48"
10}
查询集群列表
接口描述
查询所有集群的信息,支持分页查询。
权限说明
请求发起人需要具有合法的AccessKeyID和SecretAccessKey才能发起请求,请参考 鉴权认证。
注意事项
如果请求中没有用户验证信息(即匿名访问),返回403 Forbidden
,错误信息:AccessDenied
。
请求结构
1GET /v{version}/cluster?marker={marker}&maxKeys={maxKeys} HTTP/1.1
2accept-encoding: gzip, deflate
3x-bce-date: {utc-date-string}
4host: bmr.bj.baidubce.com
5connection: keep-alive
6accept: */*
7content-type: application/json
8authorization: {bce-authorization-string}
请求头域
除公共头域外,无其它特殊头域。
请求参数
参数名 | 参数类型 | 是否必须 | 参数位置 | 参数描述 |
---|---|---|---|---|
version | String | 是 | URL参数 | API版本号,当前取值1 |
marker | String | 否 | Query参数 | 批量获取列表的查询的起始位置,是一个由系统生成的字符串 |
maxKeys | Int | 否 | Query参数 | 每页包含的最大数量,最大数量不能超过1000。大于1000的会被修正为1000。缺省值为1000 |
响应头域
除公共头域外,无其它特殊头域。
响应参数
参数名 | 参数类型 | 参数描述 |
---|---|---|
marker | String | 标记查询的起始位置 |
isTruncated | Boolean | true表示后面还有数据,false表示已经是最后一页 |
clusters | List<Cluster> | 返回的集群列表 |
请求示例
1GET /v1/cluster?marker=9e0c8cf1-690c-444a-8727-04241f3beaa5&maxKeys=30 HTTP/1.1
2accept-encoding: gzip, deflate
3x-bce-date: 2022-01-26T13:02:00Z
4host: bmr.bj.baidubce.com
5connection: keep-alive
6accept: */*
7content-type: application/json
8authorization: bce-auth-v1/46bd9968a6194b4bbdf0341f2286ccce/2022-01-26T13:02:00Z/1800/host;x-bce-date/994014d96b0eb26578e039fa053a4f9003425da4bfedf33f4790882fb4c54903
响应示例
1HTTP/1.1 200 OK
2Transfer-Encoding: chunked
3x-bce-request-id: 73c4e74c-3101-4a00-bf44-fe246959c05e
4Cache-Control: no-cache
5Server: BWS
6Date: Wed, 26 Jan 2022 13:02:01 GMT
7Content-Type: application/json;charset=UTF-8
8{
9 "clusters": [
10 {
11 "id": "8fa594c8-665b-49cc-b1ec-743bf1bf5ca2",
12 "name": "test_name",
13 "payType": "postpay",
14 "status": {
15 "state": "Running",
16 "code": "",
17 "message": "",
18 "orderStatus": "",
19 "creationDateTime": "2022-01-25T06:03:42Z",
20 "endDateTime": "2022-01-26T11:14:20.26516422+08:00",
21 "readyDateTime": "2022-01-25T06:06:05Z",
22 "expireDateTime": "2022-01-25T06:03:41Z",
23 "expireDates": 0
24 },
25 "imageType": "hadoop",
26 "imageVersion": "2.3.0",
27 "enableAutoScale": true,
28 "createTime": "2022-01-25T06:03:42Z",
29 "tags": null,
30 "applications": [
31 {
32 "name": "hdfs",
33 "version": "3.1.1",
34 "properties": {}
35 },
36 {
37 "name": "yarn",
38 "version": "3.1.1",
39 "properties": {}
40 },
41 {
42 "name": "mapreduce2",
43 "version": "3.1.1",
44 "properties": {}
45 },
46 {
47 "name": "zookeeper",
48 "version": "3.4.6",
49 "properties": {}
50 },
51 {
52 "name": "hadoop-manager",
53 "version": "1.0.0",
54 "properties": {}
55 },
56 {
57 "name": "ldap",
58 "version": "2.4.48",
59 "properties": {}
60 }
61 ]
62 },
63 {
64 "id": "06a30746-ec2e-4f11-9bd1-643fd06d28d2",
65 "name": "hadoop_120_test",
66 "payType": "postpay",
67 "status": {
68 "state": "Starting",
69 "code": "",
70 "message": "",
71 "orderStatus": "",
72 "creationDateTime": "2022-01-26T03:14:52Z",
73 "endDateTime": "2022-01-26T11:17:21.453684987+08:00",
74 "readyDateTime": null,
75 "expireDateTime": "2022-01-26T03:14:51Z",
76 "expireDates": 0
77 },
78 "imageType": "hadoop",
79 "imageVersion": "1.2.0",
80 "enableAutoScale": true,
81 "createTime": "2022-01-26T03:14:52Z",
82 "tags": null,
83 "applications": [
84 {
85 "name": "hdfs",
86 "version": "2.7.1"
87 },
88 {
89 "name": "zookeeper",
90 "version": "3.4.6"
91 },
92 {
93 "name": "yarn",
94 "version": "2.7.1"
95 },
96 {
97 "name": "mapreduce2",
98 "version": "2.7.1"
99 },
100 {
101 "name": "hadoop-manager",
102 "version": "1.0.0"
103 },
104 {
105 "name": "spark2",
106 "version": "2.1.0"
107 },
108 {
109 "name": "hive",
110 "version": "1.2.0",
111 "properties": {}
112 },
113 {
114 "name": "pig",
115 "version": "0.15.1"
116 },
117 {
118 "name": "hue",
119 "version": "3.10.0"
120 },
121 {
122 "name": "hbase",
123 "version": "1.1.2"
124 },
125 {
126 "name": "ranger",
127 "version": "0.5.0"
128 },
129 {
130 "name": "tez",
131 "version": "0.7.0"
132 }
133 ]
134 }
135 ],
136 "isTruncated": false,
137 "marker": "9e0c8cf1-690c-444a-8727-04241f3beaa5"
138}
查询集群信息
接口描述
查询一个指定集群的信息。
权限说明
请求发起人需要具有合法的AccessKeyID和SecretAccessKey才能发起请求,请参考 鉴权认证。
注意事项
如果请求中没有用户验证信息(即匿名访问),返回403 Forbidden
,错误信息:AccessDenied
。
请求结构
1GET /v{version}/cluster/{clusterId} HTTP/1.1
2accept-encoding: gzip, deflate
3x-bce-date: {utc-date-string}
4host: bmr.bj.baidubce.com
5connection: keep-alive
6accept: */*
7content-type: application/json
8authorization: {bce-authorization-string}
请求头域
除公共头域外,无其它特殊头域。
请求参数
参数名 | 参数类型 | 是否必须 | 参数位置 | 参数描述 |
---|---|---|---|---|
version | String | 是 | URL参数 | API版本号,当前取值1 |
clusterId | String | 是 | URL参数 | 待查询的集群ID |
响应头域
除公共头域外,无其它特殊头域。
响应参数
参数名 | 参数类型 | 参数描述 |
---|---|---|
applications | List<Application> | 需要安装的组件信息(如hive,pig,hbase) |
orderId | String | 订单号 |
id | String | 集群ID,是一个定长字符串,只包含大小写字母、数字、连字号(-)和下划线(_) |
name | String | 集群名称 |
status | ClusterStatus | 集群状态信息 |
imageType | String | 集群类型,参考BMR集群 |
imageVersion | String | 集群版本,参考BMR集群 |
payType | String | 付费方式 |
logUri | String | 用于上传运行日志的BOS路径 |
availabilityZone | String | 集群所选可用区 |
vpcId | String | 集群所选VPC |
subnetId | String | 集群所选子网ID |
securityGroupId | String | 集群所选安全组ID |
serviceHaEnabled | Boolean | 是否开启高可用模式 |
safeModeEnabled | Boolean | 是否开启安全模式 |
enableAutoScale | Boolean | 是否支持弹性伸缩 |
instanceGroup | InstanceGroup | 实例组 |
请求示例
1GET /v1/cluster/d647cda9-b308-47e4-a2ab-0a4908e17643 HTTP/1.1
2accept-encoding: gzip, deflate
3x-bce-date: 2022-01-26T13:02:00Z
4host: bmr.bj.baidubce.com
5connection: keep-alive
6accept: */*
7content-type: application/json
8authorization: bce-auth-v1/46bd9968a6194b4bbdf0341f2286ccce/2022-01-26T13:02:00Z/1800/host;x-bce-date/994014d96b0eb26578e039fa053a4f9003425da4bfedf33f4790882fb4c54903
响应示例
1HTTP/1.1 200 OK
2Transfer-Encoding: chunked
3x-bce-request-id: 73c4e74c-3101-4a00-bf44-fe246959c05e
4Cache-Control: no-cache
5Server: BWS
6Date: Wed, 26 Jan 2022 13:02:01 GMT
7Content-Type: application/json;charset=UTF-8
8{
9 "id": "cf866824-f35b-4e2c-b5f5-6ee067806d7c",
10 "name": "test_hadoop_230_zzf",
11 "availabilityZone": "zoneA",
12 "payType": "postpay",
13 "status": {
14 "state": "TerminatedWithError",
15 "code": "",
16 "message": "openApi request[BatchCreateServer] get unexpected status code, code: 400, body: {\"requestId\":\"a3211ab4-672c-492c-5c24-3eafc8bb0b0c\",\"code\":\"Instance.BccExceedCapacity\",\"message\":\"Bcc capacity is not enough\"}",
17 "orderStatus": "",
18 "creationDateTime": "2022-01-24T02:47:12Z",
19 "endDateTime": "2022-01-26T11:19:10.434269608+08:00",
20 "readyDateTime": null,
21 "expireDateTime": "2022-01-24T02:47:12Z",
22 "expireDates": 0
23 },
24 "orderId": "",
25 "imageType": "hadoop",
26 "imageVersion": "2.3.0",
27 "applications": [
28 {
29 "name": "hdfs",
30 "version": "3.1.1",
31 "properties": {}
32 },
33 {
34 "name": "yarn",
35 "version": "3.1.1",
36 "properties": {}
37 },
38 {
39 "name": "mapreduce2",
40 "version": "3.1.1",
41 "properties": {}
42 },
43 {
44 "name": "zookeeper",
45 "version": "3.4.6",
46 "properties": {}
47 },
48 {
49 "name": "hadoop-manager",
50 "version": "1.0.0",
51 "properties": {}
52 },
53 {
54 "name": "ldap",
55 "version": "2.4.48",
56 "properties": {}
57 },
58 {
59 "name": "spark2",
60 "version": "2.4.4",
61 "properties": {}
62 },
63 {
64 "name": "hive",
65 "version": "3.1.0",
66 "properties": {
67 "metastore": "default"
68 }
69 },
70 {
71 "name": "tez",
72 "version": "0.9.1",
73 "properties": {}
74 },
75 {
76 "name": "azkaban",
77 "version": "3.58.0",
78 "properties": {}
79 },
80 {
81 "name": "flink",
82 "version": "1.12.4",
83 "properties": {}
84 },
85 {
86 "name": "presto",
87 "version": "0.219",
88 "properties": {}
89 },
90 {
91 "name": "pig",
92 "version": "0.17.0",
93 "properties": {}
94 },
95 {
96 "name": "zeppelin",
97 "version": "0.8.0",
98 "properties": {}
99 },
100 {
101 "name": "hbase",
102 "version": "2.2.7",
103 "properties": {
104 "backupEnabled": false,
105 "restoreEnabled": false
106 }
107 },
108 {
109 "name": "oozie",
110 "version": "5.1.0",
111 "properties": {}
112 },
113 {
114 "name": "hue",
115 "version": "4.8.0",
116 "properties": {}
117 }
118 ],
119 "vpcId": "d5465344-e783-41b1-9765-ec3ee4bec331",
120 "subnetId": "b35c3b60-18a0-42a6-87e7-e857dadd9eb2",
121 "securityGroupId": "g-ai3jzpiadv1q",
122 "serviceHaEnabled": true,
123 "safeModeEnabled": true,
124 "enableAutoScale": true,
125 "instanceGroups":[
126 {
127 id:"b35c3b60-18a0-42a6-87e7-e8355",
128 instanceType:"Master",
129 name:"",
130 type:"",
131 instanceCount:12,
132 rootDiskSizeInGB:1024,
133 rootDiskMediumType:"hdd",
134 cds:[
135 {
136 "sizeInGB":1024,
137 "mediumType":"hdd"
138 }
139 ]
140 }
141 ]
142}
释放集群
接口描述
释放集群,仅限单个集群释放。
权限说明
请求发起人需要具有合法的AccessKeyID和SecretAccessKey才能发起请求,请参考 鉴权认证。
注意事项
如果请求中没有用户验证信息(即匿名访问),返回403 Forbidden
,错误信息:AccessDenied
。
请求结构
1DELETE /v{version}/cluster/{clusterId} HTTP/1.1
2accept-encoding: gzip, deflate
3x-bce-date: {utc-date-string}
4host: bmr.bj.baidubce.com
5connection: keep-alive
6accept: */*
7content-type: application/json
8authorization: {bce-authorization-string}
请求头域
除公共头域外,无其它特殊头域。
请求参数
参数名 | 参数类型 | 是否必须 | 参数位置 | 参数描述 |
---|---|---|---|---|
version | String | 是 | URL参数 | API版本号,当前取值1 |
clusterId | String | 是 | URL参数 | 待释放的集群ID |
响应头域
除公共头域外,无其它特殊头域。
响应参数
无参数
请求示例
1DELETE /v1/cluster/0ce4f730-4af2-4f37-8fa2-b14f2f44e50e HTTP/1.1
2accept-encoding: gzip, deflate
3x-bce-date: 2022-01-26T13:02:00Z
4host: bmr.bj.baidubce.com
5connection: keep-alive
6accept: */*
7content-type: application/json
8authorization: bce-auth-v1/46bd9968a6194b4bbdf0341f2286ccce/2022-01-26T13:02:00Z/1800/host;x-bce-date/994014d96b0eb26578e039fa053a4f9003425da4bfedf33f4790882fb4c54903
响应示例
1HTTP/1.1 204 NO_CONTENT
2Transfer-Encoding: chunked
3x-bce-request-id: 73c4e74c-3101-4a00-bf44-fe246959c05e
4Cache-Control: no-cache
5Server: BWS
6Date: Wed, 26 Jan 2022 13:02:01 GMT
7Content-Type: application/json;charset=UTF-8