Advanced
Тема интерфейса

Creating an MRS Cluster

Scenario

This section describes how to create an MRS analysis cluster using APIs. For details on how to call APIs, see Making an API Request.

Constraints

  • A VPC and subnet have been created using the VPC service in the region where the cluster is to be created. For details about how to create a VPC, see VPC > Querying VPCs and VPC > Creating a VPC. For details about how to create a subnet, see Subnet > Querying Subnets and Subnet > Creating a Subnet.
  • You have obtained the region and AZ information of the cluster to be created. For details, see Endpoints.
  • You have obtained the project ID of the region where the cluster is to be created. For details, see Obtaining a Project ID.
  • You have determined the version of the cluster to be created and the components supported by the version.
  • In this example, an analysis cluster is created.

Procedure

  • API

    URI format: POST /v2/{project_id}/clusters

    For details, see Creating a Cluster.

  • Example request

    POST: https://{endpoint}/v2/{project_id}/clusters

    • For details about {endpoint}, see Endpoints.
    • For details about {project_id}, see Obtaining a Project ID.
    • Obtain the value of node_size from the cluster creation page on the MRS console.

    Request body:

    {
    "cluster_version": "MRS 3.2.0-LTS.1",
    "cluster_name": "mrs_Demo",
    "cluster_type": "ANALYSIS",
    "charge_info": {
    "charge_mode": "postPaid"
    },
    "region": "",
    "availability_zone": "",
    "vpc_name": "vpc-37cd",
    "subnet_name": "subnet-ed99",
    "components": "Hadoop,Spark2x,HBase,Hive,Hue,Flink,Oozie,Ranger,Tez",
    "safe_mode": "KERBEROS",
    "manager_admin_password": "xxx",
    "login_mode": "PASSWORD",
    "node_root_password": "xxx",
    "log_collection": 1,
    "mrs_ecs_default_agency": "MRS_ECS_DEFAULT_AGENCY",
    "tags": [
    {
    "key": "tag1",
    "value": "111"
    },
    {
    "key": "tag2",
    "value": "222"
    }
    ],
    "node_groups": [
    {
    "group_name": "master_node_default_group",
    "node_num": 2,
    "node_size": "rc3.4xlarge.4.linux.bigdata",
    "root_volume": {
    "type": "SAS",
    "size": 480
    },
    "data_volume": {
    "type": "SAS",
    "size": 600
    },
    "data_volume_count": 1
    },
    {
    "group_name": "core_node_analysis_group",
    "node_num": 3,
    "node_size": "rc3.4xlarge.4.linux.bigdata",
    "root_volume": {
    "type": "SAS",
    "size": 480
    },
    "data_volume": {
    "type": "SAS",
    "size": 600
    },
    "data_volume_count": 1
    },
    {
    "group_name": "task_node_analysis_group",
    "node_num": 3,
    "node_size": "rc3.4xlarge.4.linux.bigdata",
    "root_volume": {
    "type": "SAS",
    "size": 480
    },
    "data_volume": {
    "type": "SAS",
    "size": 600
    },
    "data_volume_count": 1,
    "auto_scaling_policy": {
    "auto_scaling_enable": true,
    "min_capacity": 0,
    "max_capacity": 1,
    "resources_plans": [],
    "exec_scripts": [],
    "rules": [
    {
    "name": "default-expand-1",
    "description": "",
    "adjustment_type": "scale_out",
    "cool_down_minutes": 5,
    "scaling_adjustment": "1",
    "trigger": {
    "metric_id": 2003,
    "metric_name": "StormSlotAvailablePercentage",
    "metric_value": 100,
    "comparison_operator_id": 2003,
    "comparison_operator": "LTOE",
    "evaluation_periods": "1"
    }
    }
    ]
    }
    }
    ]
    }

    For details about the parameters, see Creating a Cluster.

  • Example response
    {
    "cluster_id": "da1592c2-bb7e-468d-9ac9-83246e95447a"
    }