百度智能云

All Product Document

          MapReduce

          Cluster Operation Interface

          Create Clusters

          Interface Description

          Request to the BMR services for creating a new cluster.

          Privileges Description

          The request is initiated with legal AccessKeyID and SecretAccessKey, and see the Authentication for more information.

          Notes

          If the request contains no user verification information (i.e., anonymous access), the 403 Forbidden is returned with the error message AccessDenied.

          Request Structure

          POST /v{version}/cluster?clientToken={clientToken} HTTP/1.1
          accept-encoding: gzip, deflate
          x-bce-date: {utc-date-string}
          host: bmr.bj.baidubce.com
          connection: keep-alive
          accept: */*
          content-type: application/json
          authorization: {bce-authorization-string}
          {
              "applications": [
                  {
                      "name": "hive",
                      "properties": {
                          "metastore": "default"
                      },
                      "version": "0.13.0"
                  }
              ],
              "autoTerminate": false,
              "imageType": "hadoop",
              "imageVersion": "1.2.0",
              "instanceGroups": [
                  {
                      "instanceCount": 1,
                      "instanceType": "bmr.g1.xlarge",
                      "name": "ig-master",
                      "type": "Master"
                  },
                  {
                      "instanceCount": 2,
                      "instanceType": "bmr.g1.xlarge",
                      "name": "ig-core",
                      "type": "Core"
                  }
              ],
              "logUri": "bos://mybucket/log",
              "name": "my-cluster",
              "steps": [
                  {
                      "actionOnFailure": "Continue",
                      "arguments": "-D mapreduce.job.reduces=20",
                      "name": "my-mapreduce-streaming",
                      "properties": {
                          "mapper": "cat",
                          "reducer": "cat",
                          "input": "bos://mybucket/inputs/txt-1m",
                          "output": "bos://mybucket/outputs/streaming"
                      },
                      "type": "Streaming"
                  }
              ]
          }

          Request Header Field

          There are no other special header fields except the common header field.

          Head Field Type Description Required
          Origin String Request source field, which is used to identify the cross-field request and only allows one method. Type: String. Default value: None. Not required
          Access-Control-Request-Method String The method is used in the actual request, and only one method is allowed. Type: String. The value is “PUT/GET/DELETE/POST/HEAD,” and no default value is set. Required
          Access-Control-Request-Headers String The Headers, which are used in the actual request, except the simple headers; multiple headers are separated with commas. Type: String. Default value: None. Not required

          Request Parameter

          Name Type Required Parameter Position Parameter Description
          version String Yes URI parameter API version number, and current number is 1
          imageType String Yes RequestBody parameter Image type, hadoop is recommended, and see BMR Image for more information
          imageVersion String Yes RequestBody parameter Image version, 1.2.0 is recommended, and see BMR Image for more information
          instanceGroups List<InstanceGroupConfig> Yes RequestBody parameter Instance group configuration
          clientToken String No Query parameter Idempotent Token is an ASCII string with a length not exceeding 64 bits.
          applications List<ApplicationConfig> No RequestBody parameter Information on component to install (e.g. hive, pig, and hbase)
          autoTerminate Boolean No RequestBody parameter If it is true, the cluster is automatically released after all steps are completed; it is true by default
          logUri String No RequestBody parameter BOS path used to upload the operating log, and the log is not uploaded if it is not provided
          name String No RequestBody parameter Cluster name (my-cluster by default)
          steps List<StepConfig> No RequestBody parameter Information on the step to run, and see step Addition Protocol for more information
          serviceHaEnabled Boolean No RequestBody parameter Whether to enable high availability
          safeModeEnabled Boolean No RequestBody parameter Whether to enable security mode

          Response Header Field

          There are no other special header fields except the common header field.

          Response Parameter

          Name Type Description
          clusterId String Unique cluster identification generated by the system

          Request Example

          POST /v1/cluster?clientToken=be31b98c-5e41-4838-9830-9be700de5a20 HTTP/1.1
          accept-encoding: gzip, deflate
          x-bce-date: 2015-03-24T13:02:00Z
          host: bmr.bj.baidubce.com
          connection: keep-alive
          accept: */*
          content-type: application/json
          authorization: bce-auth-v1/46bd9968a6194b4bbdf0341f2286ccce/2015-03-24T13:02:00Z/1800/host;x-bce-date/994014d96b0eb26578e039fa053a4f9003425da4bfedf33f4790882fb4c54903
          
          {
              "applications": [
                  {
                      "name": "hive",
                      "properties": {
                          "metastore": "default"
                      },
                      "version": "0.13.0"
                  }
              ],
              "autoTerminate": false,
              "imageType": "hadoop",
              "imageVersion": "1.2.0",
              "instanceGroups": [
                  {
                      "instanceCount": 1,
                      "instanceType": "bmr.g1.xlarge",
                      "name": "ig-master",
                      "type": "Master"
                  },
                  {
                      "instanceCount": 2,
                      "instanceType": "bmr.g1.xlarge",
                      "name": "ig-core",
                      "type": "Core"
                  }
              ],
              "logUri": "bos://mybucket/log",
              "name": "my-cluster",
              "steps": [
                  {
                      "actionOnFailure": "Continue",
                      "arguments": "-D mapreduce.job.reduces=20",
                      "name": "my-mapreduce-streaming",
                      "properties": {
                          "mapper": "cat",
                          "reducer": "cat",
                          "input": "bos://mybucket/inputs/txt-1m",
                          "output": "bos://mybucket/outputs/streaming"
                      },
                      "type": "Streaming"
                  }
              ]
          }

          Return Example

          HTTP/1.1 201 CREATED
          Transfer-Encoding: chunked
          x-bce-request-id: 73c4e74c-3101-4a00-bf44-fe246959c05e
          Cache-Control: no-cache
          Server: BWS
          Date: Tue, 24 Mar 2015 13:02:01 GMT
          Content-Type: application/json;charset=UTF-8
          {
              "clusterId": "0181b994-576a-4a00-b04e-f6fa9d5eee48"
          }

          Query Cluster Lists

          Interface Description

          Query the information on any cluster, and the paging query is available.

          Privileges Description

          The request is initiated with legal AccessKeyID and SecretAccessKey, and see the Authentication for more information.

          Notes

          If the request contains no user verification information (i.e., anonymous access), the 403 Forbidden is returned with the error message AccessDenied.

          Request Structure

          GET /v{version}/cluster?marker={marker}&maxKeys={maxKeys} HTTP/1.1
          accept-encoding: gzip, deflate
          x-bce-date: {utc-date-string}
          host: bmr.bj.baidubce.com
          connection: keep-alive
          accept: */*
          content-type: application/json
          authorization: {bce-authorization-string}

          Request Header Field

          There are no other special header fields except the common header field.

          Request Parameter

          Parameter Name Parameter Type Required Parameter Position Parameter Description
          version String Yes URI parameter API version number, and the current number is 1
          marker String No Query parameter Initial position of list query obtained in batch, which is a string generated by the system
          maxKeys Int No Query parameter The maximum number on every page is not more than 1000. The number of more than 1000 is modified as 1000. The default value is 1000

          Response Header Field

          There are no other special header fields except the common header field.

          Response Parameter

          Parameter Name Parameter Type Parameter Description
          marker String Mark the initial position of query
          isTruncated Boolean true means there is still data behind, and false means it is already the last page
          nextMarker String Get the marker value to pass on the next page. This field does not appear when isTruncated is false
          clusters List<[Cluster](BMR/API Reference/Data Type.md#Cluster)> Returned cluster list

          Request Example

          GET /v1/cluster?marker=9e0c8cf1-690c-444a-8727-04241f3beaa5&maxKeys=30 HTTP/1.1
          accept-encoding: gzip, deflate
          x-bce-date: 2015-03-24T13:02:00Z
          host: bmr.bj.baidubce.com
          connection: keep-alive
          accept: */*
          content-type: application/json
          authorization: bce-auth-v1/46bd9968a6194b4bbdf0341f2286ccce/2015-03-24T13:02:00Z/1800/host;x-bce-date/994014d96b0eb26578e039fa053a4f9003425da4bfedf33f4790882fb4c54903

          Return Example

          HTTP/1.1 200 OK
          Transfer-Encoding: chunked
          x-bce-request-id: 73c4e74c-3101-4a00-bf44-fe246959c05e
          Cache-Control: no-cache
          Server: BWS
          Date: Tue, 24 Mar 2015 13:02:01 GMT
          Content-Type: application/json;charset=UTF-8
          {
              "clusters": [
                  {
                      "applications": [
                          {
                              "name": "hive",
                              "properties": {
                                  "metastore": "default"
                              },
                              "version": "0.13.0"
                          }
                      ],
                      "autoTerminate": false,
                      "id": "d647cda9-b308-47e4-a2ab-0a4908e17643",
                      "imageType": "hadoop",
                      "imageVersion": "1.2.0",
                      "logUri": "bos://mybucket/log/hive-cluster",
                      "name": "my-hive-cluster",
                      "status": {
                          "code": null,
                          "creationDateTime": "2014-11-06T03:11:27Z",
                          "endDateTime": null,
                          "message": null,
                          "readyDateTime": null,
                          "state": "Starting"
                      }
                  },
                  {
                      "applications": [],
                      "autoTerminate": false,
                      "id": "479b9933-0b7a-403f-9553-388db551cbd0",
                      "imageType": "hadoop",
                      "imageVersion": "0.1.0",
                      "logUri": "bos://mybucket/log/hadoop-cluster",
                      "name": "my-hadoop-cluster",
                      "status": {
                          "code": null,
                          "creationDateTime": "2014-10-29T08:05:21Z",
                          "endDateTime": null,
                          "message": null,
                          "readyDateTime": "2014-10-29T08:08:09Z",
                          "state": "Running"
                      }
                  }
              ],
              "isTruncated": false,
              "marker": "9e0c8cf1-690c-444a-8727-04241f3beaa5"
          }

          Query Cluster Information

          Interface Description

          Query the information on a specified cluster.

          Privileges Description

          The request is initiated with legal AccessKeyID and SecretAccessKey, and see the Authentication for more information.

          Notes

          If the request contains no user verification information (i.e., anonymous access), the 403 Forbidden is returned with the error message AccessDenied.

          Request Structure

          GET /v{version}/cluster/{clusterId} HTTP/1.1
          accept-encoding: gzip, deflate
          x-bce-date: {utc-date-string}
          host: bmr.bj.baidubce.com
          connection: keep-alive
          accept: */*
          content-type: application/json
          authorization: {bce-authorization-string}

          Request Header Field

          There are no other special header fields except the common header field.

          Request Parameter

          Parameter Name Parameter Type Required Parameter Position Parameter Description
          version String Yes URI parameter API version number, and the current number is 1
          clusterId String Yes URI parameter Cluster ID to query

          Response Header Field

          There are no other special header fields except the common header field.

          Response Parameter

          Parameter Name Parameter Type Parameter Description
          applications List<[Application](BMR/API Reference/Data Type.md#Application)> Information on component to install (e.g., hive, pig, and hbase)
          autoTerminate Boolean Whether to automatically release the cluster after running all steps
          id String The cluster ID is a fixed-length string which only contains uppercase and lowercase letters, numbers, hyphens (-), and underlines (_)
          imageType String Image type, and see BMR Image for more information
          imageVersion String Image version, and see BMR Image for more information
          logUri String BOS path used to upload the operating log
          name String Cluster name
          status [ClusterStatus](BMR/API Reference/Data Type.md#ClusterStatus) Information on cluster status

          Request Example

          GET /v1/cluster/d647cda9-b308-47e4-a2ab-0a4908e17643 HTTP/1.1
          accept-encoding: gzip, deflate
          x-bce-date: 2015-03-24T13:02:00Z
          host: bmr.bj.baidubce.com
          connection: keep-alive
          accept: */*
          content-type: application/json
          authorization: bce-auth-v1/46bd9968a6194b4bbdf0341f2286ccce/2015-03-24T13:02:00Z/1800/host;x-bce-date/994014d96b0eb26578e039fa053a4f9003425da4bfedf33f4790882fb4c54903

          Return Example

          HTTP/1.1 200 OK
          Transfer-Encoding: chunked
          x-bce-request-id: 73c4e74c-3101-4a00-bf44-fe246959c05e
          Cache-Control: no-cache
          Server: BWS
          Date: Tue, 24 Mar 2015 13:02:01 GMT
          Content-Type: application/json;charset=UTF-8
          
          {
              "applications": [
                  {
                      "name": "hive",
                      "properties": {
                          "metastore": "default"
                      },
                      "version": "0.13.0"
                  }
              ],
              "autoTerminate": false,
              "id": "d647cda9-b308-47e4-a2ab-0a4908e17643",
              "imageType": "hadoop",
              "imageVersion": "1.2.0",
              "logUri": "bos://mybucket/log",
              "name": "my-cluster",
              "status": {
                  "code": null,
                  "creationDateTime": "2014-08-06T02:18:49Z",
                  "endDateTime": null,
                  "message": null,
                  "readyDateTime": "2014-08-06T02:20:14Z",
                  "state": "Running"
              }
          }

          Release Clusters

          Interface Description

          Release a single cluster only.

          Privileges Description

          The request is initiated with legal AccessKeyID and SecretAccessKey, and see the Authentication for more information.

          Notes

          If the request contains no user verification information (i.e., anonymous access), the 403 Forbidden is returned with the error message AccessDenied.

          Request Structure

          DELETE /v{version}/cluster/{clusterId} HTTP/1.1
          accept-encoding: gzip, deflate
          x-bce-date: {utc-date-string}
          host: bmr.bj.baidubce.com
          connection: keep-alive
          accept: */*
          content-type: application/json
          authorization: {bce-authorization-string}

          Request Header Field

          There are no other special header fields except the common header field.

          Request Parameter

          Parameter Name Parameter Type Required Parameter Position Parameter Description
          version String Yes URI parameter API version number, and the current number is 1
          clusterId String Yes URI parameter Cluster ID to release

          Response Header Field

          There are no other special header fields except the common header field.

          Response Parameter

          No parameter

          Request Example

          DELETE /v1/cluster/0ce4f730-4af2-4f37-8fa2-b14f2f44e50e HTTP/1.1
          accept-encoding: gzip, deflate
          x-bce-date: 2015-03-24T13:02:00Z
          host: bmr.bj.baidubce.com
          connection: keep-alive
          accept: */*
          content-type: application/json
          authorization: bce-auth-v1/46bd9968a6194b4bbdf0341f2286ccce/2015-03-24T13:02:00Z/1800/host;x-bce-date/994014d96b0eb26578e039fa053a4f9003425da4bfedf33f4790882fb4c54903

          Return Example

          HTTP/1.1 204 NO_CONTENT
          Transfer-Encoding: chunked
          x-bce-request-id: 73c4e74c-3101-4a00-bf44-fe246959c05e
          Cache-Control: no-cache
          Server: BWS
          Date: Tue, 24 Mar 2015 13:02:01 GMT
          Content-Type: application/json;charset=UTF-8
          Previous
          Error Code
          Next
          Instance Group Operation Interface