集群生命周期管理
更新时间:2026-07-23
接口总览
| 接口名称 | 说明 | openapi 方法 | openapi 路径 |
|---|---|---|---|
| CreateCluster | 创建集群 | POST | /v2/bcc/cluster/create |
| ListClusters | 查询集群列表 | POST | /v2/bcc/cluster/list |
| DescribeCluster | 查询集群详情 | POST | /v2/bcc/cluster/detail |
| TerminateCluster | 释放集群 | POST | /v2/bcc/cluster/terminate |
| RenameCluster | 修改集群名称 | POST | /v2/bcc/cluster/rename |
| ChangeClusterPassword | 修改集群服务密码 | POST | /v2/bcc/cluster/changePass |
CreateCluster
接口描述
创建 BMR BCC 集群
说明:hadoop/hadoop-bos 类型的集群,仅支持 3.7.4 及以上版本;其他类型集群暂无限制
请求结构
SQL
1POST /v2/bcc/cluster/create HTTP/1.1
2Content-Type: application/json
3
4{
5 "name": name,
6 "imageType": imageType,
7 "imageVersion": imageVersion,
8 "applications": [{"name": name, "properties": {}}],
9 "instanceGroups": [
10 {
11 "type": type,
12 "instanceType": instanceType,
13 "instanceCount": instanceCount,
14 "cds": [{"sizeInGB": sizeInGB, "mediumType": mediumType"}]
15 }
16 ],
17 "adminPassword": adminPassword,
18 "payType": payType,
19 "vpcId": vpcId,
20 "subnetId": subnetId,
21 "securityGroup": securityGroup,
22 "serviceHaEnabled": serviceHaEnabeled,
23 "safeModeEnabled": safeModeEnabeled,
24 "paymentMethod": [{"type": type, "values": []}]
25}
请求参数
| 名称 | 类型 | 是否必须 | 参数位置 | 参数描述 |
|---|---|---|---|---|
| imageType | String | 是 | RequestBody | 集群类型,比如 hadoop,参考BMR集群 |
| imageVersion | String | 是 | RequestBody | 集群版本,比如 2.2.2,参考BMR集群 |
| instanceGroups | List |
是 | RequestBody | 实例组配置 |
| applications | List |
否 | RequestBody | 需要安装的组件信息(如hive,pig,hbase) |
| logUri | String | 否 | RequestBody | 用于上传运行日志的BOS路径,不提供则不上传日志 |
| name | String | 是 | RequestBody | 集群名称,默认为my-cluster |
| vpcId | String | 是 | RequestBody | 设置vpc短ID信息 |
| subnetId | String | 是 | RequestBody | 设置子网短ID信息 |
| securityGroup | String | 是 | RequestBody | 设置安全组短ID |
| adminPassword | String | 是 | RequestBody | 设置集群密码,8-16位字符,英文,数字和符号必须同时存在,符号仅限!@#$%^*(),密码需要加密传输 |
| serviceHaEnabled | bool | 否 | RequestBody | 服务高可用;开启时 master 实例数须 为 3,默认 false |
| safeModeEnabled | bool | 否 | RequestBody | 安全模式,默认 false |
| enableAppInsight | bool | 否 | RequestBody | 应用洞察,默认 false |
| insightLocation | string | 否 | RequestBody | 洞察数据位置,BOS路径 |
| bosConfig | BosConfig | 否 | RequestBody | Starrocks 存算分离的 Bos 配置 |
| payType | string | 是 | RequestBody | 计费方式:prepay(预付费) / postpay(后付费) |
| purchaseLength | int | 否 | RequestBody | 预付费购买月数,范围 [1, 36];预付费必填 |
| paymentMethod | List |
否 | RequestBody | 订单级支付方式 ,不传则用默认账户支付 |
响应参数
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| clusterId | String | 创建的集群 ID |
请求示例
SQL
1{
2 "name": "wyz-cluster",
3 "imageType": "hadoop",
4 "imageVersion": "3.7.4",
5 "applications": [
6 {
7 "name": "hive",
8 "properties": {
9 "metastore": "mysql",
10 "host": "mysql57-wyz-default.rdsmi5hmwpw9eyg.rds.fwh.baidubce.com",
11 "port": "3306",
12 "database": "hive_default",
13 "userName": "bmr",
14 "password": "<encrypted password>"
15 }
16 },
17 {
18 "name": "tez"
19 },
20 {
21 "name": "spark"
22 }
23 ],
24 "instanceGroups": [
25 {
26 "type": "MASTER",
27 "instanceType": "bmr.g4.c8m32",
28 "instanceCount": 3,
29 "rootDiskSizeInGB": 100,
30 "rootDiskMediumType": "ssd",
31 "cds": [
32 {
33 "sizeInGB": 100,
34 "mediumType": "ssd"
35 }
36 ]
37 },
38 {
39 "type": "CORE",
40 "instanceType": "bmr.g4.c8m32",
41 "instanceCount": 3,
42 "rootDiskSizeInGB": 100,
43 "rootDiskMediumType": "ssd",
44 "cds": [
45 {
46 "sizeInGB": 200,
47 "mediumType": "ssd"
48 }
49 ]
50 }
51 ],
52 "adminPassword": "f03ab0749763170375d7627e91842330",
53 "payType": "postpay",
54 "vpcId": "vpc-b8nj2p7m91x1",
55 "subnetId": "sbn-3n4pagj47416",
56 "securityGroup": "g-g6xgmxh8hi9s",
57 "serviceHaEnabled": true,
58 "safeModeEnabled": true
59}
响应示例
SQL
1{
2 "clusterId": "0181b994-576a-4a00-b04e-f6fa9d5eee48"
3}
ListClusters
接口描述
分页查询集群摘要列表。
请求结构
Plain Text
1POST /v2/bcc/cluster/list HTTP/1.1
2Content-Type: application/json
3
4{
5 "keyword": keyword,
6 "keywordType": keywordType,
7 "pageNo": pageNo,
8 "pageSize": pageSize,
9 "orderBy": orderBy,
10 "order": order,
11 "clusterStates": []
12}
请求参数
| 名称 | 类型 | 是否必须 | 参数位置 | 参数描述 |
|---|---|---|---|---|
| keyword | String | 否 | RequestBody | 搜索关键字,为空时不过滤 |
| keywordType | String | 否 | RequestBody | 搜索类型:SEARCH_TAG、SEARCH_CLUSTER_ID、SEARCH_CLUSTER_NAME。 |
| pageNo | Int | 否 | RequestBody | 页码,默认为 1 |
| pageSize | Int | 否 | RequestBody | 每页数量,默认为 10 |
| orderBy | String | 否 | RequestBody | 排序字段 |
| order | String | 否 | RequestBody | 排序方向 |
| clusterStates | List |
否 | RequestBody | 集群状态过滤 |
响应参数
| 参数名 | 参数类型 | 参数描述 | 备注 |
|---|---|---|---|
| page.totalCount | Int | 集群总数 | |
| page.pageNo | Int | 当前页码 | |
| page.pageSize | Int | 每页数量 | |
| page.result | List |
集群摘要列表,集群密码和数据库等密码信息不返回 | 密码待屏蔽 |
请求示例
JSON
1{
2 "keyword": "my-cluster",
3 "keywordType": "SEARCH_CLUSTER_NAME",
4 "pageNo": 1,
5 "pageSize": 10,
6 "orderBy": "createTime",
7 "order": "desc",
8 "clusterStates": ["Active", "Starting"]
9}
响应示例
JSON
1{
2 "success": true,
3 "status": 200,
4 "page": {
5 "pageNo": 1,
6 "pageSize": 10,
7 "totalCount": 1,
8 "result": [
9 {
10 "id": "0181b994-576a-4a00-b04e-f6fa9d5eee48",
11 "name": "my-cluster",
12 "payType": "Postpaid",
13 "imageType": "hadoop",
14 "imageVersion": "3.7.4",
15 "status": {
16 "state": "Active",
17 "message": ""
18 },
19 "expired": false,
20 "enableAutoScale": false,
21 "createTime": "2026-06-20T10:30:00Z",
22 "tags": [
23 {
24 "tagKey": "env",
25 "tagValue": "test"
26 }
27 ],
28 "applications": [
29 {
30 "name": "hive",
31 "version": "3.1.3",
32 "properties": ""
33 },
34 {
35 "name": "spark3",
36 "version": "3.5.5",
37 "properties": ""
38 }
39 ],
40 "hmsUrl": "",
41 "kafkaUrl": "",
42 "logUri": "",
43 "serviceHaEnabled": true,
44 "safeModeEnabled": false
45 }
46 ]
47 }
48}
DescribeCluster
接口描述
查询单个集群的详情,包含实例组信息。
请求结构
Plain Text
1POST /v2/bcc/cluster/detail HTTP/1.1
2Content-Type: application/json
3
4{
5 "clusterId": clusterId
6}
请求参数
| 名称 | 类型 | 是否必须 | 参数位置 | 参数描述 |
|---|---|---|---|---|
| clusterId | String | 是 | RequestBody | 集群 ID |
响应参数
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| result | ClusterDetail | 集群详情 |
请求示例
JSON
1{
2 "clusterId": "0181b994-576a-4a00-b04e-f6fa9d5eee48"
3}
响应示例
JSON
1{
2 "success": true,
3 "status": 200,
4 "result": {
5 "id": "f95f2069-4005-4fa1-a02f-8af7283af68a",
6 "name": "test",
7 "availabilityZone": "zoneA",
8 "payType": "postpay",
9 "status": {
10 "state": "Running",
11 "code": "",
12 "message": "",
13 "orderStatus": "",
14 "creationDateTime": "2026-06-26T07:16:01Z",
15 "endDateTime": "2026-06-29T18:52:42+08:00",
16 "readyDateTime": "2026-06-26T07:38:51Z",
17 "expireDateTime": "2026-06-26T07:16:00Z",
18 "expireDates": 0
19 },
20 "orderId": "",
21 "imageType": "hadoop",
22 "imageVersion": "3.7.4",
23 "applications": [
24 {
25 "name": "hive",
26 "version": "3.1.3",
27 "internal": false,
28 "properties": {
29 "metastore": "default",
30 "user_name": ""
31 },
32 "resource_locator": "HIVE/3.1.3.73"
33 },
34 {
35 "name": "spark",
36 "version": "3.5.5",
37 "internal": false,
38 "properties": {},
39 "resource_locator": "SPARK/3.5.5.9"
40 }
41 ],
42 "vpcId": "0ea307ba-1892-4099-a9e7-4fab33d4c65a",
43 "subnetId": "48edfd10-f216-4433-9bda-f34bcb1325bc",
44 "securityGroupId": [
45 "g-g6xgmxh8hi9s"
46 ],
47 "serviceHaEnabled": false,
48 "safeModeEnabled": false,
49 "enableAutoScale": true,
50 "isAutoRenew": false,
51 "source": "console",
52 "reminder": {
53 "duration": 30,
54 "enabled": false,
55 "action": "",
56 "media": [
57 "SMS",
58 "MAIL"
59 ],
60 "lastDateTime": "0001-01-01T00:00:00Z"
61 },
62 "autoTerminate": false,
63 "terminationProtected": false,
64 "logsearchEnabled": false,
65 "quotaEnabled": true,
66 "privateZoneEnabled": false,
67 "alarmEnabled": false,
68 "vpnEnabled": true,
69 "sendMessage": true,
70 "canOperate": true,
71 "is_bcc_opened": false,
72 "new_control": true,
73 "enableAppInsight": false,
74 "insightLocation": "",
75 "yarnUrl": "https://bmrfwh.bce.baidu.com/bmr-portal-proxy/eecae43d-4eca-4307-89ed-296ff29d4e33/8088/cluster",
76 "instanceGroups": [
77 {
78 "id": "4ad7e487-56cd-48ac-b1a2-30929de38dce",
79 "name": "MASTER",
80 "type": "Master",
81 "cds": [
82 {
83 "sizeInGB": 1024,
84 "mediumType": "ssd",
85 "attributes": null
86 }
87 ],
88 "rootDiskSizeInGB": 100,
89 "rootDiskMediumType": "ssd",
90 "instanceType": "bmr.g4.c4m16",
91 "instanceCount": 1,
92 "bccInstanceType": "BCC",
93 "ebcDiskInfo": ""
94 },
95 {
96 "id": "38fc2e65-abfe-4b99-9c1e-4ab86980dfa6",
97 "name": "CORE",
98 "type": "Core",
99 "cds": [
100 {
101 "sizeInGB": 500,
102 "mediumType": "ssd",
103 "attributes": null
104 }
105 ],
106 "rootDiskSizeInGB": 100,
107 "rootDiskMediumType": "ssd",
108 "instanceType": "bmr.g4.c4m16",
109 "instanceCount": 3,
110 "bccInstanceType": "BCC",
111 "ebcDiskInfo": ""
112 }
113 ]
114 }
115}
TerminateCluster
接口描述
释放(销毁)指定集群。
请求结构
Plain Text
1POST /api/bmr/v2/cluster/terminate HTTP/1.1
2Content-Type: application/json
3
4{
5 "clusterId": clusterId
6}
请求参数
| 名称 | 类型 | 是否必须 | 参数位置 | 参数描述 |
|---|---|---|---|---|
| clusterId | String | 是 | RequestBody | 集群 ID |
响应参数
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| result | Null | 成功时为空 |
请求示例
JSON
1{
2 "clusterId": "0181b994-576a-4a00-b04e-f6fa9d5eee48"
3}
响应示例
JSON
1{
2 "success": true,
3 "status": 200,
4 "result": null
5}
RenameCluster
接口描述
重命名指定集群。
请求结构
Plain Text
1POST /v2/bcc/cluster/rename HTTP/1.1
2Content-Type: application/json
3
4{
5 "clusterId": clusterId,
6 "newName": newName
7}
请求参数
| 名称 | 类型 | 是否必须 | 参数位置 | 参数描述 |
|---|---|---|---|---|
| clusterId | String | 是 | RequestBody | 集群 ID |
| newName | String | 是 | RequestBody | 新集群名称 |
响应参数
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| result | Null | 成功时为空 |
请求示例
JSON
1{
2 "clusterId": "0181b994-576a-4a00-b04e-f6fa9d5eee48",
3 "newName": "new-cluster-name"
4}
响应示例
JSON
1{
2 "success": true,
3 "status": 200,
4 "result": null
5}
ChangeClusterPassword
接口描述
修改集群密码,仅修改新建 bcc 的登录密码以及集群 UI 访问密码
请求结构
Plain Text
1POST /v2/bcc/cluster/changePass HTTP/1.1
2Content-Type: application/json
3
4{
5 "clusterId": clusterId,
6 "adminClusterPass": <encryptedPassword>
7}
请求参数
| 名称 | 类型 | 是否必须 | 参数位置 | 参数描述 |
|---|---|---|---|---|
| clusterId | String | 是 | RequestBody | 集群 ID |
| adminClusterPass | String | 是 | RequestBody | 新密码,需要加密传输 |
响应参数
| 参数名 | 参数类型 | 参数描述 |
|---|---|---|
| result | Null | 成功时为空 |
请求示例
JSON
1{
2 "clusterId": "0181b994-576a-4a00-b04e-f6fa9d5eee48",
3 "adminClusterPass": "<encryptedPassword>"
4}
响应示例
JSON
1{
2 "success": true,
3 "status": 200,
4 "result": null
5}
错误返回码
| HTTP Status | Code | Message | 触发场景 | 适用接口 |
|---|---|---|---|---|
| 404 | ClusterNotFound | The cluster not found | clusterId 在当前租户下不存在 | DescribeCluster, TerminateCluster, ModifyCluster, ChangePassword |
| 400 | InvalidClusterName | The cluster name is invalid | 集群名称不合法 | ModifyCluster |
| 400 | InvalidPassword | The password format does not meet the requirements | 密码格式不满足要求或 RSA 解密失败 | CreateCluster, ChangePassword |
| 400 | PasswordSameAsOld | The new password cannot be the same as the old one | 新密码与原密码相同 | ChangePassword |
| 400 | InvalidImageType | The image type is not supported | imageType 不存在 | CreateCluster |
| 400 | InvalidImageVersion | The image version is not supported | imageVersion 与 imageType 不匹配 | CreateCluster |
| 400 | SubnetNotFound | The subnet not found | subnetId 不存在 | CreateCluster |
| 400 | VpcSubnetMismatch | The subnet does not belong to the specified VPC | subnetId 与 vpcId 不匹配 | CreateCluster |
评价此篇文章
