Creating a Cluster and Executing a Job
Function
This API is used to create an MRS cluster and submit a job in the cluster. This API is incompatible with Sahara.
A maximum of 10 clusters can be concurrently created.
Before using the API, you need to obtain the resources listed in Table 1.
Resource |
How to Obtain |
---|---|
VPC |
See operation instructions in in the VPC API Reference. |
Subnet |
See operation instructions in in the VPC API Reference. |
Key Pair |
See operation instructions in in the ECS API Reference. |
Zone |
See Endpoints for details about regions and AZs. |
Version |
Currently, MRS 2.1.1, 3.0.5, and 3.1.0 are supported. |
Component |
|
URI
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
The project ID. For details about how to obtain the project ID, see Obtaining a Project ID. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
cluster_version |
Yes |
String |
The cluster version. Possible values:
|
cluster_name |
Yes |
String |
The cluster name, which must be unique. A cluster name can contain only 1 to 64 characters. Only letters, numbers, hyphens (-), and underscores (_) are allowed. |
master_node_num |
Yes |
Integer |
The number of master nodes. If cluster HA is enabled, set this parameter to 2. If cluster HA is disabled, set this parameter to 1. This parameter cannot be set to 1 in MRS 3.x. |
core_node_num |
Yes |
Integer |
The number of core nodes. Value range: 1 to 500 The default maximum number of core nodes is 500. If more than 500 core nodes are required, apply for a higher quota. |
billing_type |
Yes |
Integer |
The cluster billing mode. |
data_center |
Yes |
String |
The information about the region where the cluster is located. For details, see Endpoints. |
vpc |
Yes |
String |
The name of the VPC where the subnet is located. Obtain the VPC name by performing the following operations on the VPC management console:
On the Virtual Private Cloud page, obtain the VPC name from the list. |
master_node_size |
Yes |
String |
The instance specifications of master nodes, for example, c3.4xlarge.2.linux.bigdata. The host specifications supported by MRS are determined by CPU, memory, and disk space. You are advised to obtain the specifications supported by the corresponding version in the corresponding region from the cluster creation page on the MRS console. |
core_node_size |
Yes |
String |
The instance specifications of core nodes, for example, c3.4xlarge.2.linux.bigdata. You are advised to obtain the specifications supported by the corresponding version in the corresponding region from the cluster creation page on the MRS console. |
component_list |
Yes |
Array of component_list objects |
The list of service components to be installed. For details about the parameters, see Table 4. |
available_zone_id |
Yes |
String |
The AZ ID. |
vpc_id |
Yes |
String |
The ID of the VPC where the subnet is located. Obtain the VPC ID by performing the following operations on the VPC management console:
On the Virtual Private Cloud page, obtain the VPC ID from the list. |
subnet_id |
Yes |
String |
The subnet ID. Obtain the subnet ID by performing the following operations on the VPC management console:
At least one of subnet_id and subnet_name must be configured. If the two parameters are configured but do not match the same subnet, the cluster fails to create. subnet_id is recommended. |
subnet_name |
Yes |
String |
The subnet name. Obtain the subnet name by performing the following operations on the VPC management console:
At least one of subnet_id and subnet_name must be configured. If the two parameters are configured but do not match the same subnet, the cluster fails to create. If only subnet_name is configured and subnets with the same name exist in the VPC, the first subnet name in the VPC is used when a cluster is created. subnet_id is recommended. |
security_groups_id |
No |
String |
The ID of the security group configured for the cluster.
|
add_jobs |
No |
Array of add_jobs objects |
Jobs can be submitted when a cluster is created. Currently, only one job can be created. For details about the parameters, see Table 5. |
volume_size |
No |
Integer |
The data disk storage space of master and core nodes. To increase the data storage capacity, you can add disks when creating a cluster. Select a proper disk storage space based on the following application scenarios:
Value range: 100 GB to 32,000 GB. When assigning a value to this parameter, you only need to pass a number, without the unit. This parameter is not recommended. For details, see the description of the volume_type parameter. |
volume_type |
No |
String |
The data disk storage type of master and core nodes. Currently, SATA, SAS, SSD, and GPSSD are supported. Disk parameters can be represented by volume_type and volume_size, or multi-disk parameters. If the volume_type and volume_size parameters coexist with the multi-disk parameters, the system reads the volume_type and volume_size parameters first. You are advised to use the multi-disk parameters. Possible values:
|
master_data_volume_type |
No |
String |
This parameter is a multi-disk parameter, indicating the data disk storage type of the master node. Currently, SATA, SAS, SSD, and GPSSD are supported. |
master_data_volume_size |
No |
Integer |
This parameter is a multi-disk parameter, indicating the data disk storage space of master nodes. To increase the data storage capacity, you can add disks when creating a cluster. Value range: 100 GB to 32,000 GB. When assigning a value to this parameter, you only need to pass a number, without the unit. |
master_data_volume_count |
No |
Integer |
This parameter is a multi-disk parameter, indicating the number of data disks of the master nodes. The value can only be 1. |
core_data_volume_type |
No |
String |
This parameter is a multi-disk parameter, indicating the data disk storage type of core nodes. Currently, SATA, SAS, SSD, and GPSSD are supported. |
core_data_volume_size |
No |
Integer |
This parameter is a multi-disk parameter, indicating the data disk storage space of core nodes. To increase the data storage capacity, you can add disks when creating a cluster. Value range: 100 GB to 32,000 GB. When assigning a value to this parameter, you only need to pass a number, without the unit. |
core_data_volume_count |
No |
Integer |
This parameter is a multi-disk parameter, indicating the number of data disks of the core nodes. Value range: 1 to 10 |
task_node_groups |
No |
Array of task_node_groups objects |
The list of task nodes. For details about the parameters, see Table 6. |
bootstrap_scripts |
No |
Array of bootstrap_script objects |
The Bootstrap action script information. For details about the parameters, see Table 8. |
node_public_cert_name |
No |
String |
The name of a key pair. You can use a key pair to log in to a cluster node. If login_mode is set to 1, the request body contains the node_public_cert_name field. |
cluster_admin_secret |
No |
String |
The password of the MRS Manager administrator. A password must meet the following complexity requirements:
|
cluster_master_secret |
Yes |
String |
The password of user root for logging in to a cluster node. If login_mode is set to 0, the request body contains the cluster_master_secret field. A password must meet the following complexity requirements:
|
safe_mode |
Yes |
Integer |
The running mode of an MRS cluster. Possible values:
|
tags |
No |
Array of tag objects |
The cluster tags. For details about the parameters, see Table 9.
|
cluster_type |
No |
Integer |
The cluster type. Possible values:
The default value is 0. |
log_collection |
No |
Integer |
Whether to collect logs when cluster creation fails. The default value is 1, indicating that OBS buckets are created only for collecting logs when an MRS cluster fails to create. Possible values:
|
enterprise_project_id |
No |
String |
The enterprise project ID. When you create a cluster, associate the enterprise project ID with the cluster. The default value is 0, indicating the default enterprise project. |
login_mode |
No |
Integer |
The cluster login mode. The default value is 1.
Possible values:
|
node_groups |
No |
Array of NodeGroupV11 objects |
The list of nodes. For details about the parameters, see Table 10. Note: Configure either this parameter or the following parameters: master_node_num, master_node_size, core_node_num, core_node_size, master_data_volume_type, master_data_volume_size, master_data_volume_count, core_data_volume_type, core_data_volume_size, core_data_volume_count, volume_type, volume_size, task_node_groups |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
component_name |
Yes |
String |
The component name. For details, see the component information in Table 1. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
job_type |
Yes |
Integer |
The job type code. Possible values:
|
job_name |
Yes |
String |
The job name. The value can contain 1 to 64 characters. Only letters, numbers, hyphens (-), and underscores (_) are allowed.
NOTE:
Identical job names are allowed but not recommended. |
jar_path |
No |
String |
The path of the JAR or SQL file for program execution. The value must meet the following requirements:
|
arguments |
No |
String |
The key parameter for program execution. The parameter is specified by the function of the user's program. MRS is only responsible for loading the parameter. The parameter can contain 0 to 150,000 characters, but special characters (;|&>'<$) are not allowed. |
input |
No |
String |
The data input path.
Files can be stored in HDFS or OBS. The path varies depending on the file system.
The value can contain 0 to 1,023 characters, but special characters (;|&>'<$) are not allowed. |
output |
No |
String |
The data output path.
Files can be stored in HDFS or OBS. The path varies depending on the file system.
If the specified path does not exist, the system will automatically create it. The value can contain 0 to 1,023 characters, but special characters (;|&>'<$) are not allowed. |
job_log |
No |
String |
The path for storing job logs that record job running status.
Files can be stored in HDFS or OBS. The path varies depending on the file system.
The value can contain 0 to 1,023 characters, but special characters (;|&>'<$) are not allowed. |
shutdown_cluster |
No |
Boolean |
Whether to terminate the cluster after the job execution is complete.
|
file_action |
No |
String |
The action to be performed on a file. Possible values:
|
submit_job_once_cluster_run |
Yes |
Boolean |
Set this parameter to true in this example. |
hql |
No |
String |
The HQL script statement. |
hive_script_path |
Yes |
String |
The SQL program path. This parameter is required by Spark Script and Hive Script jobs only, and the value must meet the following requirements:
|
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
node_num |
Yes |
Integer |
The number of task nodes. The value ranges from 0 to 500, and the total number of core and task nodes cannot exceed 500. |
node_size |
Yes |
String |
The instance specifications of task nodes, for example, c6.4xlarge.4.linux.mrs. Obtain the instance specifications of the corresponding version in the corresponding region from the cluster createion page of the MRS management console. |
data_volume_type |
Yes |
String |
The data disk storage type of task nodes. Possible values:
|
data_volume_count |
Yes |
Integer |
The number of data disks of a task node. Value range: 0 to 10 |
data_volume_size |
Yes |
Integer |
The data disk storage space of a task node. Value range: 100 GB to 32,000 GB You only need to enter a number and do not need to enter the unit GB. |
auto_scaling_policy |
No |
auto_scaling_policy object |
The auto scaling policy. For details, see Table 7. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
auto_scaling_enable |
Yes |
Boolean |
Whether to enable the auto scaling policy. |
min_capacity |
Yes |
Integer |
The minimum number of nodes reserved in the node group. Value range: 0 to 500 |
max_capacity |
Yes |
Integer |
The maximum number of nodes in the node group. Value range: 0 to 500 |
resources_plans |
No |
Array of resources_plan objects |
The resource plan list. For details, see Table 12. If this parameter is left blank, the resource plan is disabled. When auto_scaling_enable is set to true, either this parameter or rules must be configured. |
exec_scripts |
No |
Array of scale_script objects |
The list of custom scaling automation scripts. For details, see Table 15. If this parameter is left blank, a hook script is disabled. |
rules |
No |
Array of rules objects |
The list of auto scaling rules. For details, see Table 13. When auto_scaling_enable is set to true, either this parameter or resources_plans must be configured. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
name |
Yes |
String |
The name of a bootstrap action script, which must be unique in a cluster. The value can contain only numbers, letters, spaces, hyphens (-), and underscores (_) and cannot start with a space. The value can contain 1 to 64 characters. |
uri |
Yes |
String |
The path of a Bootstrap action script. Set this parameter to an OBS bucket path or a local VM path.
|
parameters |
No |
String |
The bootstrap action script parameters. |
nodes |
Yes |
Array of strings |
The type of a node where the bootstrap action script is executed. The value can be Master, Core, or Task. The node type must be represented in lowercase letters. |
active_master |
No |
Boolean |
Whether the bootstrap action script runs only on active master nodes. The default value is false, indicating that the Bootstrap action script can run on all Master nodes. |
before_component_start |
No |
Boolean |
Time when the bootstrap action script is executed. Currently, the following two options are available: Before component start and After component start The default value is false, indicating that the bootstrap action script is executed after the component is started. |
fail_action |
Yes |
String |
Whether to continue executing subsequent scripts and creating a cluster after the Bootstrap action script fails to be executed.
The default value is errorout, indicating that the action is stopped.
NOTE:
You are advised to set this parameter to continue in the commissioning phase so that the cluster can continue to be installed and started no matter whether the bootstrap action is successful. |
action_stages |
No |
Array of strings |
Select the time when the bootstrap action script is executed.
|
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
key |
Yes |
String |
The tag key.
|
value |
Yes |
String |
The value.
|
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
group_name |
Yes |
String |
The node group name. Possible values:
|
node_num |
Yes |
Integer |
The number of nodes. The value ranges from 0 to 500, and the default value is 0. The total number of core and task nodes cannot exceed 500. |
node_size |
Yes |
String |
The instance specifications of cluster nodes, for example, . Obtain the instance specifications of the corresponding version in the corresponding region from the cluster createion page of the MRS management console. |
root_volume_size |
Yes |
String |
The system disk storage space of a node. |
root_volume_type |
Yes |
String |
The system disk storage type of a node. Possible values:
|
data_volume_type |
Yes |
String |
The data disk storage type of a node. Possible values:
|
data_volume_count |
Yes |
Integer |
The number of data disks of a node. Value range: 0 to 10 |
data_volume_size |
Yes |
Integer |
The data disk storage space of a node. Value range: 100 GB to 32,000 GB |
auto_scaling_policy |
No |
auto_scaling_policy object |
The auto scaling rule information. This parameter is available only when group_name is set to task_node_analysis_group or task_node_streaming_group. For details, see Table 11. For details about the parameters, see Table 7. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
master_node_num |
Yes |
Integer |
The number of master nodes. If cluster HA is enabled, set this parameter to 2. If cluster HA is disabled, set this parameter to 1. This parameter cannot be set to 1 in MRS 3.x. |
master_node_size |
Yes |
String |
The instance specifications of master nodes, for example, . The host specifications supported by MRS are determined by CPU, memory, and disk space. Obtain the instance specifications of the corresponding version in the corresponding region from the cluster createion page of the MRS management console. |
core_node_num |
Yes |
Integer |
The number of core nodes. Value range: 1 to 500 A maximum of 500 core nodes are supported by default. If more than 500 core nodes are required, . |
core_node_size |
Yes |
String |
The instance specifications of core nodes, for example, . Obtain the instance specifications of the corresponding version in the corresponding region from the cluster createion page of the MRS management console. |
master_data_volume_type |
No |
String |
This parameter is a multi-disk parameter, indicating the data disk storage type of master nodes. Currently, SATA, SAS, and SSD are supported. |
master_data_volume_size |
No |
Integer |
This parameter is a multi-disk parameter, indicating the data disk storage space of master nodes. To increase the data storage capacity, you can add disks when creating a cluster. Value range: 100 GB to 32,000 GB |
master_data_volume_count |
No |
Integer |
This parameter is a multi-disk parameter, indicating the number of data disks of the master nodes. The value can only be 1. |
core_data_volume_type |
No |
String |
This parameter is a multi-disk parameter, indicating the data disk storage type of core nodes. Currently, SATA, SAS, and SSD are supported. |
core_data_volume_size |
No |
Integer |
This parameter is a multi-disk parameter, indicating the data disk storage space of core nodes. To increase the data storage capacity, you can add disks when creating a cluster. Value range: 100 GB to 32,000 GB |
core_data_volume_count |
No |
Integer |
This parameter is a multi-disk parameter, indicating the number of data disks of core nodes. Value range: 1 to 10 |
volume_type |
No |
String |
The data disk storage type of the master and core nodes. Currently, SATA, SAS, and SSD are supported. Disk parameters can be represented by volume_type and volume_size, or multi-disk parameters. If the volume_type and volume_size parameters coexist with the multi-disk parameters, the system reads the volume_type and volume_size parameters first. You are advised to use the multi-disk parameters. Possible values:
|
volume_size |
No |
Integer |
The data disk storage space of master and core nodes. To increase the data storage capacity, you can add disks when creating a cluster. Value range: 100 GB to 32,000 GB This parameter is not recommended. For details, see the description of the volume_type parameter. |
task_node_groups |
No |
Array |
The list of task nodes. For more parameter description, see Table 6. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
period_type |
Yes |
String |
Cycle type of a resource plan. Currently, only the following cycle type is supported: daily |
start_time |
Yes |
String |
Start time of a resource plan. The value is in the format of hour:minute, indicating that the time ranges from 0:00 to 23:59. |
end_time |
Yes |
String |
End time of a resource plan. The value is in the same format as that of start_time. The interval between end_time and start_time must be greater than or equal to 30 minutes. |
min_capacity |
Yes |
Integer |
Minimum number of the preserved nodes in a node group in a resource plan. Value range: 0 to 500 |
max_capacity |
Yes |
Integer |
Maximum number of the preserved nodes in a node group in a resource plan. Value range: 0 to 500 |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
name |
Yes |
String |
Name of an auto scaling rule. It contains only 1 to 64 characters. Only letters, digits, hyphens (-), and underscores (_) are allowed. Rule names must be unique in a node group. |
description |
No |
String |
Description about an auto scaling rule. It contains a maximum of 1024 characters. |
adjustment_type |
Yes |
String |
Auto scaling rule adjustment type. Possible values:
|
cool_down_minutes |
Yes |
Integer |
Cluster cooling time after an auto scaling rule is triggered, when no auto scaling operation is performed. The unit is minute. Value range: 0 to 10,080. One week is equal to 10,080 minutes. |
scaling_adjustment |
Yes |
Integer |
Number of nodes that can be adjusted once. Value range: 1 to 100 |
trigger |
Yes |
trigger object |
Condition for triggering a rule. For details, see Table 14. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
metric_name |
Yes |
String |
Metric name. This triggering condition makes a judgment according to the value of the metric. A metric name contains a maximum of 64 characters. Table 16 lists the supported metric names. |
metric_value |
Yes |
String |
Metric threshold to trigger a rule The parameter value must be an integer or number with two decimal places only. Table 16 provides value types and ranges corresponding to metric_name. |
comparison_operator |
No |
String |
Metric judgment logic operator. Possible values:
|
evaluation_periods |
Yes |
Integer |
Number of consecutive five-minute periods, during which a metric threshold is reached Value range: 1 to 288 |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
name |
Yes |
String |
Name of a custom automation script. It must be unique in a same cluster. The value can contain only digits, letters, spaces, hyphens (-), and underscores (_) and cannot start with a space. The value can contain 1 to 64 characters. |
uri |
Yes |
String |
Path of a custom automation script. Set this parameter to an OBS bucket path or a local VM path.
|
parameters |
No |
String |
Parameters of a custom automation script.
|
nodes |
Yes |
Array of string |
Type of a node where the custom automation script is executed. The node type can be Master, Core, or Task. |
active_master |
No |
Boolean |
Whether the custom automation script runs only on the active Master node. The default value is false, indicating that the custom automation script can run on all Master nodes. |
action_stage |
Yes |
String |
Time when a script is executed. The following four options are supported:
|
fail_action |
Yes |
String |
Whether to continue to execute subsequent scripts and create a cluster after the custom automation script fails to be executed.
|
Cluster Type |
Metric Name |
Value Type |
Description |
---|---|---|---|
Streaming cluster |
StormSlotAvailable |
Integer |
Number of available Storm slots. Value range: 0 to 2147483646 |
StormSlotAvailablePercentage |
Percentage |
Percentage of available Storm slots, that is, the proportion of the available slots to total slots. Value range: 0 to 100 |
|
StormSlotUsed |
Integer |
Number of the used Storm slots. Value range: 0 to 2147483646 |
|
StormSlotUsedPercentage |
Percentage |
Percentage of the used Storm slots, that is, the proportion of the used slots to total slots. Value range: 0 to 100 |
|
StormSupervisorMemAverageUsage |
Integer |
Average memory usage of the Supervisor process of Storm. Value range: 0 to 2147483646 |
|
StormSupervisorMemAverageUsagePercentage |
Percentage |
Average percentage of the used memory of the Supervisor process of Storm to the total memory of the system. Value range: 0 to 100 |
|
StormSupervisorCPUAverageUsagePercentage |
Percentage |
Average percentage of the used CPUs of the Supervisor process of Storm to the total CPUs. Value range: 0 to 6000 |
|
Analysis cluster |
YARNAppPending |
Integer |
Number of pending tasks on Yarn. Value range: 0 to 2147483646 |
YARNAppPendingRatio |
Ratio |
Ratio of pending tasks on Yarn, that is, the ratio of pending tasks to running tasks on Yarn. Value range: 0 to 2147483646 |
|
YARNAppRunning |
Integer |
Number of running tasks on Yarn. Value range: 0 to 2147483646 |
|
YARNContainerAllocated |
Integer |
Number of containers allocated to Yarn. Value range: 0 to 2147483646 |
|
YARNContainerPending |
Integer |
Number of pending containers on Yarn. Value range: 0 to 2147483646 |
|
YARNContainerPendingRatio |
Ratio |
Ratio of pending containers on Yarn, that is, the ratio of pending containers to running containers on Yarn. Value range: 0 to 2147483646 |
|
YARNCPUAllocated |
Integer |
Number of virtual CPUs (vCPUs) allocated to Yarn Value range: 0 to 2147483646 |
|
YARNCPUAvailable |
Integer |
Number of available vCPUs on Yarn. Value range: 0 to 2147483646 |
|
YARNCPUAvailablePercentage |
Percentage |
Percentage of available vCPUs on Yarn, that is, the proportion of available vCPUs to total vCPUs. Value range: 0 to 100 |
|
YARNCPUPending |
Integer |
Number of pending vCPUs on Yarn. Value range: 0 to 2147483646 |
|
YARNMemoryAllocated |
Integer |
Memory allocated to Yarn. The unit is MB. Value range: 0 to 2147483646 |
|
YARNMemoryAvailable |
Integer |
Available memory on Yarn. The unit is MB. Value range: 0 to 2147483646 |
|
YARNMemoryAvailablePercentage |
Percentage |
Percentage of available memory on Yarn, that is, the proportion of available memory to total memory on Yarn. Value range: 0 to 100 |
|
YARNMemoryPending |
Integer |
Pending memory on Yarn. Value range: 0 to 2147483646 |
When the value type is percentage or ratio in Table 16, the valid value can be accurate to percentile. The percentage metric value is a decimal value with a percent sign (%) removed. For example, 16.80 represents 16.80%.
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
cluster_id |
String |
Cluster ID, which is returned by the system after the cluster is created. |
result |
Boolean |
Operation result.
|
msg |
String |
System message, which can be empty. |
Example Request
- Creating a cluster with Cluster HA enabled (using the node_groups parameter group)
POST https://{endpoint}/v1.1/{project_id}/run-job-flow { "billing_type": 12, "data_center": , "available_zone_id": , "cluster_name": "mrs_HEbK", "cluster_version": "MRS 3.1.0", "safe_mode": 0, "cluster_type": 0, "component_list": [ { "component_name": "Hadoop" }, { "component_name": "Spark2x" }, { "component_name": "HBase" }, { "component_name": "Hive" }, { "component_name": "Tez" }, { "component_name": "Hue" }, { "component_name": "Flink" } ], "vpc": "vpc-4b1c", "vpc_id": "4a365717-67be-4f33-80c5-98e98a813af8", "subnet_id": "67984709-e15e-4e86-9886-d76712d4e00a", "subnet_name": "subnet-4b44", "security_groups_id": "4820eace-66ad-4f2c-8d46-cf340e3029dd", "tags": [{ "key": "key1", "value": "value1" }, { "key": "key2", "value": "value2" }], "node_groups": [{ "group_name": "master_node_default_group", "node_num": 2, "node_size": "", "root_volume_size": 480, "root_volume_type": "SATA", "data_volume_type": "SATA", "data_volume_count": 1, "data_volume_size": 600 }, { "group_name": "core_node_analysis_group", "node_num": 3, "node_size": "", "root_volume_size": 480, "root_volume_type": "SATA", "data_volume_type": "SATA", "data_volume_count": 1, "data_volume_size": 600 }, { "group_name": "task_node_analysis_group", "node_num": 2, "node_size": "", "root_volume_size": 480, "root_volume_type": "SATA", "data_volume_type": "SATA", "data_volume_count": 0, "data_volume_size": 600, "auto_scaling_policy": { "auto_scaling_enable": true, "min_capacity": 1, "max_capacity": "3", "resources_plans": [{ "period_type": "daily", "start_time": "9:50", "end_time": "10:20", "min_capacity": 2, "max_capacity": 3 }, { "period_type ": "daily", "start_time ": "10:20", "end_time ": "12:30", "min_capacity ": 0, "max_capacity ": 2 }], "exec_scripts": [{ "name": "before_scale_out", "uri": "s3a://XXX/zeppelin_install.sh ", "parameters": "${mrs_scale_node_num} ${mrs_scale_type} xxx", "nodes": ["master", "core", "task"], "active_master": "true", "action_stage": "before_scale_out", "fail_sction": "continue" }, { "name": "after_scale_out", "uri": "s3a://XXX/storm_rebalance.sh", "parameters": "${mrs_scale_node_hostnames} ${mrs_scale_node_ips}", "nodes": ["master", "core", "task"], "active_master": "true", "action_stage": "after_scale_out", "fail_action": "continue" }], "rules": [{ "name": "default-expand-1", "adjustment_type": "scale_out", "cool_down_minutes": 5, "scaling_adjustment": 1, "trigger": { "metric_name": "YARNMemoryAvailablePercentage", "metric_value": "25", "comparison_operator": "LT", "evaluation_periods": 10 } }, { "name": "default-shrink-1", "adjustment_type": "scale_in", "cool_down_minutes": 5, "scaling_adjustment": 1, "trigger": { "metric_name": "YARNMemoryAvailablePercentage", "metric_value": "70", "comparison_operator": "GT", "evaluation_periods": 10 } }] } } ], "login_mode": 1, "cluster_master_secret": "", "cluster_admin_secret": "", "log_collection": 1, "add_jobs": [{ "job_type": 1, "job_name": "tenji111", "jar_path": "s3a://bigdata/program/hadoop-mapreduce-examples-xxx.jar", "arguments": "wordcount", "input": "s3a://bigdata/input/wd_1k/", "output": "s3a://bigdata/output/", "job_log": "s3a://bigdata/log/", "shutdown_cluster": true, "file_action": "", "submit_job_once_cluster_run": true, "hql": "", "hive_script_path": "" }], "bootstrap_scripts": [{ "name": "Modify os config", "uri": "s3a://XXX/modify_os_config.sh", "parameters": "param1 param2", "nodes": ["master", "core", "task"], "active_master": "false", "before_component_start": "true", "start_time" : "1667892101", "state" : "IN_PROGRESS", "fail_action": "continue" "action_stages" : [ "BEFORE_COMPONENT_FIRST_START", "BEFORE_SCALE_IN" ] }, { "name": "Install zepplin", "uri": "s3a://XXX/zeppelin_install.sh", "parameters": "", "nodes": ["master"], "active_master": "true", "before_component_start": "false", "start_time" : "1667892101", "state" : "IN_PROGRESS", "fail_action": "continue" "action_stages" : [ "AFTER_SCALE_IN", "AFTER_SCALE_OUT" ] }] }
- Creating a cluster with Cluster HA enabled (without using the node_groups parameter group)
POST https://{endpoint}/v1.1/{project_id}/run-job-flow { "billing_type": 12, "data_center": , "master_node_num": 2, "master_node_size": "", "core_node_num": 3, "core_node_size": "", "available_zone_id": , "cluster_name": "newcluster", "vpc": "vpc1", "vpc_id": "5b7db34d-3534-4a6e-ac94-023cd36aaf74", "subnet_id": "815bece0-fd22-4b65-8a6e-15788c99ee43", "subnet_name": "subnet", "security_groups_id": "845bece1-fd22-4b45-7a6e-14338c99ee43", "tags": [ { "key": "key1", "value": "value1" }, { "key": "key2", "value": "value2" } ], "cluster_version": "MRS 3.1.0", "cluster_type": 0, "master_data_volume_type": "SATA", "master_data_volume_size": 600, "master_data_volume_count": 1, "core_data_volume_type": "SATA", "core_data_volume_size": 600, "core_data_volume_count": 2, "node_public_cert_name": "SSHkey-bba1", "safe_mode": 0, "log_collection": 1, "task_node_groups": [ { "node_num": 2, "node_size": "", "data_volume_type": "SATA", "data_volume_count": 1, "data_volume_size": 600, "auto_scaling_policy": { "auto_scaling_enable": true, "min_capacity": "1", "max_capacity": "3", "resources_plans": [{ "period_type": "daily", "start_time": "9:50", "end_time": "10:20", "min_capacity": "2", "max_capacity": "3" },{ "period_type": "daily", "start_time": "10:20", "end_time": "12:30", "min_capacity": "0", "max_capacity": "2" }], "exec_scripts": [{ "name": "before_scale_out", "uri": "s3a://XXX/zeppelin_install.sh", "parameters": "${mrs_scale_node_num}${mrs_scale_type}xxx", "nodes": [ "master", "core", "task" ], "active_master": "true", "action_stage": "before_scale_out", "fail_action": "continue" },{ "name": "after_scale_out", "uri": "s3a://XXX/storm_rebalance.sh", "parameters": "${mrs_scale_node_hostnames}${mrs_scale_node_ips}", "nodes": [ "master", "core", "task" ], "active_master": "true", "action_stage": "after_scale_out", "fail_action": "continue" }], "rules": [ { "name": "default-expand-1", "adjustment_type": "scale_out", "cool_down_minutes": 5, "scaling_adjustment": 1, "trigger": { "metric_name": "YARNMemoryAvailablePercentage", "metric_value": "25", "comparison_operator": "LT", "evaluation_periods": 10 } }, { "name": "default-shrink-1", "adjustment_type": "scale_in", "cool_down_minutes": 5, "scaling_adjustment": 1, "trigger": { "metric_name": "YARNMemoryAvailablePercentage", "metric_value": "70", "comparison_operator": "GT", "evaluation_periods": 10 } } ] } } ], "component_list": [ { "component_name": "Hadoop" }, { "component_name": "Spark2x" }, { "component_name": "HBase" }, { "component_name": "Hive" }, { "component_name": "Presto" }, { "component_name": "Tez" }, { "component_name": "Hue" }, { "component_name": "Flink" } ], "add_jobs": [ { "job_type": 1, "job_name": "tenji111", "jar_path": "s3a://bigdata/program/hadoop-mapreduce-examples-XXX.jar", "arguments": "wordcount", "input": "s3a://bigdata/input/wd_1k/", "output": "s3a://bigdata/output/", "job_log": "s3a://bigdata/log/", "shutdown_cluster": false, "file_action": "", "submit_job_once_cluster_run": true, "hql": "", "hive_script_path": "" } ], "bootstrap_scripts": [ { "name":"Modifyosconfig", "uri":"s3a://XXX/modify_os_config.sh", "parameters":"param1 param2", "nodes":[ "master", "core", "task" ], "active_master":"false", "before_component_start":"true", "fail_action":"continue" }, { "name":"Install zepplin", "uri":"s3a://XXX/zeppelin_install.sh", "parameters":"", "nodes":[ "master" ], "active_master":"true", "before_component_start":"false", "fail_action":"continue" } ] }
- Disabling the Cluster HA function and creating a cluster with the minimum specifications (using the node_groups parameter group)
POST https://{endpoint}/v1.1/{project_id}/run-job-flow { "billing_type": 12, "data_center": , "available_zone_id": , "cluster_name": "mrs_HEbK", "cluster_version": "MRS 3.1.0", "safe_mode": 0, "cluster_type": 0, "component_list": [ { "component_name": "Hadoop" }, { "component_name": "Spark2x" }, { "component_name": "HBase" }, { "component_name": "Hive" }, { "component_name": "Tez" }, { "component_name": "Hue" }, { "component_name": "Flink" } ], "vpc": "vpc-4b1c", "vpc_id": "4a365717-67be-4f33-80c5-98e98a813af8", "subnet_id": "67984709-e15e-4e86-9886-d76712d4e00a", "subnet_name": "subnet-4b44", "security_groups_id": "4820eace-66ad-4f2c-8d46-cf340e3029dd", "tags": [{ "key": "key1", "value": "value1" }, { "key": "key2", "value": "value2" }], "node_groups": [{ "group_name": "master_node_default_group", "node_num": 1, "node_size": "", "root_volume_size": 480, "root_volume_type": "SATA", "data_volume_type": "SATA", "data_volume_count": 1, "data_volume_size": 600 }, { "group_name": "core_node_analysis_group", "node_num": 1, "node_size": "", "root_volume_size": 480, "root_volume_type": "SATA", "data_volume_type": "SATA", "data_volume_count": 1, "data_volume_size": 600 } ], "login_mode": 1, "cluster_master_secret": "", "cluster_admin_secret": "", "log_collection": 1, "add_jobs": [{ "job_type": 1, "job_name": "tenji111", "jar_path": "s3a://bigdata/program/hadoop-mapreduce-examples-xxx.jar", "arguments": "wordcount", "input": "s3a://bigdata/input/wd_1k/", "output": "s3a://bigdata/output/", "job_log": "s3a://bigdata/log/", "shutdown_cluster": true, "file_action": "", "submit_job_once_cluster_run": true, "hql": "", "hive_script_path": "" }], "bootstrap_scripts": [{ "name": "Modify os config", "uri": "s3a://XXX/modify_os_config.sh", "parameters": "param1 param2", "nodes": ["master", "core", "task"], "active_master": "false", "before_component_start": "true", "fail_action": "continue" }, { "name": "Install zepplin", "uri": "s3a://XXX/zeppelin_install.sh", "parameters": "", "nodes": ["master"], "active_master": "true", "before_component_start": "false", "fail_action": "continue" }] }
- Disabling the Cluster HA function and creating a cluster with the minimum specifications (without using the node_groups parameter group)
POST https://{endpoint}/v1.1/{project_id}/run-job-flow { "billing_type": 12, "data_center": , "master_node_num": 1 "master_node_size": "", "core_node_num": 1, "core_node_size": "", "available_zone_id": , "cluster_name": "newcluster", "vpc": "vpc1", "vpc_id": "5b7db34d-3534-4a6e-ac94-023cd36aaf74", "subnet_id": "815bece0-fd22-4b65-8a6e-15788c99ee43", "subnet_name": "subnet", "security_groups_id": "", "tags": [ { "key": "key1", "value":"value1" }, { "key": "key2", "value": "value2" } ], "cluster_version": "MRS 3.1.0", "cluster_type": 0, "master_data_volume_type": "SATA", "master_data_volume_size": 600, "master_data_volume_count": 1, "core_data_volume_type": "SATA", "core_data_volume_size": 600, "core_data_volume_count": 1, "login_mode": 1, "node_public_cert_name": "SSHkey-bba1", "safe_mode": 0, "cluster_admin_secret":"******", "log_collection": 1, "component_list": [ { "component_name": "Hadoop" }, { "component_name": "Spark2x" }, { "component_name": "HBase" }, { "component_name": "Hive" }, { "component_name": "Tez" }, { "component_name": "Hue" }, { "component_name": "Flink" } ], "add_jobs": [ { "job_type": 1, "job_name": "tenji111", "jar_path": "s3a://bigdata/program/hadoop-mapreduce-examples-XXX.jar", "arguments": "wordcount", "input": "s3a://bigdata/input/wd_1k/", "output": "s3a://bigdata/output/", "job_log": "s3a://bigdata/log/", "shutdown_cluster": false, "file_action": "", "submit_job_once_cluster_run": true, "hql": "", "hive_script_path": "" } ], "bootstrap_scripts": [ { "name":"Install zepplin", "uri":"s3a://XXX/zeppelin_install.sh", "parameters":"", "nodes":[ "master" ], "active_master":"false", "before_component_start":"false", "fail_action":"continue" } ] }
Example Response
Status code: 200
The cluster is created.
{ "cluster_id" : "da1592c2-bb7e-468d-9ac9-83246e95447a", "result" : true, "msg" : "" }
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot