ALIYUN::EMR::Cluster类型用于创建一个E-MapReduce集群。

语法

{
  "Type": "ALIYUN::EMR::Cluster",
  "Properties": {
    "SshEnable": Boolean,
    "EasEnable": Boolean,
    "WhiteListType": String,
    "InitCustomHiveMetaDB": Boolean,
    "IoOptimized": Boolean,
    "HostGroup": List,
    "Config": List,
    "KeyPairName": String,
    "VpcId": String,
    "AutoRenew": Boolean,
    "RelatedClusterId": String,
    "BootstrapAction": List,
    "InstanceGeneration": String,
    "DepositType": String,
    "VSwitchId": String,
    "NetType": String,
    "UserDefinedEmrEcsRole": String,
    "Name": String,
    "ClusterType": String,
    "ZoneId": String,
    "IsOpenPublicIp": Boolean,
    "OptionSoftWareList": List,
    "Configurations": String,
    "MasterPwd": String,
    "MachineType": String,
    "EmrVer": String,
    "SecurityGroupName": String,
    "MetaStoreConf": String,
    "SecurityGroupId": String,
    "LogPath": String,
    "Period": Integer,
    "HighAvailabilityEnable": Boolean,
    "UseCustomHiveMetaDB": Boolean,
    "UserInfo": List,
    "ChargeType": String,
    "MetaStoreType": String,
    "AuthorizeContent": String,
    "UseLocalMetaDb": Boolean,
    "ClickHouseConf": Map,
    "ResourceGroupId": String,
    "Tags": List
  }
}

属性

属性名称 类型 必须 允许更新 描述 约束
SshEnable Boolean 是否开启SSH。 取值:
  • true:开启。
  • false:关闭。
EasEnable Boolean 是否为高安全集群。 取值:
  • true:高安全集群。
  • false:非高安全集群。
WhiteListType String 白名单类型。 取值:
  • IP:IP白名单分组。
  • SecurityGroup:安全组。
InitCustomHiveMetaDB Boolean 保留字段,无需填写。
IoOptimized Boolean 是否开启IO优化。 取值:
  • true(默认值):开启。
  • false:关闭。
HostGroup List 机器组。 更多信息,请参见HostGroup属性
Config List 自定义配置项。 更多信息,请参见Config属性
KeyPairName String 密钥对名称。
VpcId String 专有网络ID。
AutoRenew Boolean 包年包月集群是否自动续费。 取值:
  • true:自动续费。
  • false:不自动续费。
RelatedClusterId String Gateway集群关联的主集群ID。 当ClusterType取值为GATEWAY时,该参数有效。
BootstrapAction List 引导操作。 更多信息,请参见BootstrapAction属性
InstanceGeneration String ECS实例规格族。
VSwitchId String 交换机ID。
NetType String 网络类型。 取值:VPC,表示专有网络。
UserDefinedEmrEcsRole String 授权给ECS的角色,用于ECS内部访问OSS等其他阿里云服务。
Name String 集群名称。 长度为1~64个字符,可包含英文字母、汉字、数字、短划线(-)和下划线(_)。
ClusterType String 集群类型。 取值:
  • HADOOP
  • KAFKA
  • DRUID
  • ZOOKEEPER
  • DATA_SCIENCE
  • GATEWAY
ZoneId String 可用区ID。
IsOpenPublicIp Boolean 是否开启公网IP地址。 取值:
  • true:开启。开启后默认支持8 MB带宽。
  • false:关闭。
OptionSoftWareList List 可选软件列表。
Configurations String 保留字段,无需填写。
MasterPwd String Master节点SSH访问密码。 长度为8~30个字符,需同时包含大写英文字母、小写英文字母、数字和特殊符号中任意三项。
MachineType String 机器类型。
EmrVer String EMR版本。
SecurityGroupName String 安全组名称。 如果不指定安全组ID,将使用该名称创建一个新的安全组。

当集群创建完成后,可以在集群详情中查询创建的安全组ID。该安全组将会带有默认的安全组策略:入方向只开放22端口,出方向开放所有端口。

DepositType String 集群的托管类型。
SecurityGroupId String 安全组ID。 若使用已有安全组,将给安全组增加默认策略:入方向只开放22端口,出方向开放所有端口。
LogPath String OSS日志路径。
Period Integer 包年包月时长。 当ChargeType取值为PrePaid时,必须指定该参数。

取值:1、2、3、4、5、6、7、8、9、12、24、36。

单位:月。

HighAvailabilityEnable Boolean 是否开启高可用集群。 取值:
  • true:开启。开启后需要至少包含2个Master节点。
  • false:关闭。
UseCustomHiveMetaDB Boolean 保留字段,无需填写。
UserInfo List 用户信息。 更多信息,请参见UserInfo属性
ChargeType String 付费类型。 取值:
  • PostPaid:按量付费。
  • PrePaid:包年包月。
AuthorizeContent String 保留字段,无需填写。
UseLocalMetaDb Boolean 是否使用集群内置MySQL作为Hive元数据库。 取值:
  • true:使用。
  • false:不使用。
MetaStoreConf String 元数据配置。 MetaStoreType取值为user_rds时,必须指定该参数。

格式:{"dbUrl":"jdbc:mysql://xxxxxx", "dbUserName":"username", "dbPassword":"password"}

MetaStoreType String 元数据类型。 取值:
  • local:集群内置MySQL服务。
  • dlf:DLF元数据服务。
  • user_rds:用户自建RDS服务。
ClickHouseConf Map ClickHouse集群配置。
ResourceGroupId String 资源组ID。
Tags List 用户自定义标签。 更多信息,请参见Tags属性

Tags语法

"Tags": [
  {
    "Value": String,
    "Key": String
  }
]

Tags属性

属性名称 类型 必须 允许更新 描述 约束
Key String 标签键。 长度为1~128个字符。

不能以aliyunacs:开头,不能包含http://https://

Value String 标签值。 长度为0~128个字符。

不能以aliyunacs:开头,不能包含http://https://

HostGroup语法

"HostGroup": [
  {
    "Comment": String,
    "SysDiskType": String,
    "DiskCapacity": Integer,
    "NodeCount": Integer,
    "ClusterId": String,
    "DiskCount": Integer,
    "CreateType": String,
    "DiskType": String,
    "AutoRenew": Boolean,
    "HostGroupType": String,
    "SysDiskCapacity": Integer,
    "VSwitchId": String,
    "ChargeType": String,
    "Period": Integer,
    "HostKeyPairName": String,
    "HostPassword": String,
    "HostGroupId": String,
    "InstanceType": String,
    "GpuDriver": String,
    "HostGroupName": String
  }
]

HostGroup属性

属性名称 类型 必须 允许更新 描述 约束
Comment String 保留字段,无需填写。
SysDiskType String 机器组的系统盘类型。 取值:
  • CLOUD_EFFICIENCY:高效云盘。
  • CLOUD_SSD:SSD云盘。
  • CLOUD:普通云盘。
DiskCapacity Integer 机器组的数据盘容量。 单位:GB。
NodeCount Integer 机器组节点数。
ClusterId String 保留字段,无需填写。
DiskCount Integer 机器组的数据盘数量。
CreateType String 机器组的创建类型。 取值:
  • ON-DEMAND:按需创建。
  • MANUAL:手动创建。
DiskType String 机器组的数据盘类型。 取值:
  • CLOUD_EFFICIENCY:高效云盘。
  • CLOUD_SSD:SSD云盘。
  • LOCAL_DISK:本地盘ECS实例类型只能填该值。
  • CLOUD:普通云盘。
AutoRenew Boolean 包年包月集群是否自动续费。 取值:
  • true:自动续费。
  • false:不自动付费。
HostGroupType String 机器组类型。 取值:
  • MASTER:主实例组。
  • CORE:核心实例组。
  • TASK:计算实例组。
SysDiskCapacity Integer 机器组的系统盘容量。 单位:GB。
VSwitchId String 交换机ID。
ChargeType String 付费类型。 取值:
  • PostPaid:按量付费。
  • PrePaid:包年包月。
Period Integer 包年包月时长。 当ChargeType取值为PrePaid时,必须指定该参数。

取值:1、2、3、4、5、6、7、8、9、12、24、36。

单位:月。

HostKeyPairName String 主机组的密钥对名称。 当ClusterType取值为GATEWAY时,该参数有效。
HostPassword String 主机的密码 当ClusterType取值为GATEWAY时,该参数有效。
HostGroupId String 保留字段,无需填写。
InstanceType String 实例规格。
GpuDriver String GPU驱动。
HostGroupName String 机器组名称。

Config语法

"Config": [
  {
    "Encrypt": String,
    "ConfigKey": String,
    "FileName": String,
    "ServiceName": String,
    "Replace": String,
    "ConfigValue": String
  }
]

Config属性

属性名称 类型 必须 允许更新 描述 约束
Encrypt String 保留字段,无需填写。
ConfigKey String 自定义配置项的键。
FileName String 自定义配置项所属的文件名称。
ServiceName String 自定义配置项的服务名称。
Replace String 保留字段,无需填写。
ConfigValue String 自定义配置项的值。

BootstrapAction语法

"BootstrapAction": [
  {
    "Path": String,
    "Name": String,
    "Arg": String
  }
]

BootstrapAction属性

属性名称 类型 必须 允许更新 描述 约束
Path String 引导操作脚本OSS存放路径。
Name String 引导操作的名称。
Arg String 引导操作的参数。

UserInfo语法

"UserInfo": [
  {
    "UserName": String,
    "Password": String,
    "UserId": String
  }
]

UserInfo属性

属性名称 类型 必须 允许更新 描述 约束
UserName String Knox用户的用户名。
Password String Knox用户的密码。
UserId String Knox用户的RAM用户ID。

返回值

Fn::GetAtt

  • ClusterId:集群ID。
  • HostGroups:集群机器组列表。
  • MasterNodePubIps:集群主节点的公共IP列表。
  • MasterNodeInnerIps:集群主节点的内部IP列表。

示例

  • YAML格式

    ROSTemplateFormatVersion: '2015-09-01'
    Description: Test EMR Cluster
    Parameters:
      VpcId:
        AssociationProperty: ALIYUN::ECS::VPC::VPCId
        Type: String
        Label:
          zh-cn: 现有VPC的实例ID
          en: Existing VPC Instance ID
      ZoneId:
        AssociationProperty: ALIYUN::ECS::ZoneId
        Type: String
        Label:
          zh-cn: 交换机可用区
          en: VSwitch Zone ID
      VSwitchId:
        AssociationProperty: ALIYUN::ECS::VSwitch::VSwitchId
        AssociationPropertyMetadata:
          VpcId: ${VpcId}
          ZoneId: ${ZoneId}
        Type: String
        Label:
          zh-cn: 网络交换机ID
          en: VSwitch ID
      SecurityGroupId:
        AssociationProperty: ALIYUN::ECS::SecurityGroup::SecurityGroupId
        AssociationPropertyMetadata:
          VpcId: ${VpcId}
        Type: String
        Description:
          Label:
            zh-cn: 业务安全组ID
            en: Business Security Group ID
        ClusterDiskType:
          Type: String
          Default: CLOUD_SSD
    Resources:
      EmrCluster:
        Type: ALIYUN::EMR::Cluster
        Properties:
          UseLocalMetaDb: false
          IoOptimized: true
          ZoneId:
            Ref: ZoneId
          VSwitchId:
            Ref: VSwitchId
          SecurityGroupId:
            Ref: SecurityGroupId
          HostGroup:
            - DiskType: CLOUD_SSD
              HostGroupType: MASTER
              DiskCount: 1
              DiskCapacity: 80
              NodeCount: 1
              SysDiskType: CLOUD_SSD
              ChargeType: PostPaid
              VSwitchId:
                Ref: VSwitchId
              AutoRenew: false
              Period: 1
              SysDiskCapacity: 120
              InstanceType: ecs.g5.xlarge
            - DiskType: CLOUD_SSD
              HostGroupType: CORE
              DiskCount: 4
              DiskCapacity: 80
              NodeCount: 2
              SysDiskType: CLOUD_SSD
              ChargeType: PostPaid
              VSwitchId:
                Ref: VSwitchId
              AutoRenew: false
              Period: 1
              SysDiskCapacity: 120
              InstanceType: ecs.g5.xlarge
          EmrVer: EMR-3.22.4
          ClusterType: HADOOP
          Name:
            Fn::Join:
              - '-'
              - - StackId
                - Ref: ALIYUN::StackId
          MasterPwd: Admin123!
          VpcId:
            Ref: VpcId
          ChargeType: PostPaid
          NetType: vpc
    Outputs:
      ClusterId:
        Description: The ID of the cluster.
        Value:
          Fn::GetAtt:
            - EmrCluster
            - ClusterId
  • JSON格式

    {
      "ROSTemplateFormatVersion": "2015-09-01",
      "Description": "Test EMR Cluster",
      "Parameters": {
        "VpcId": {
          "AssociationProperty": "ALIYUN::ECS::VPC::VPCId",
          "Type": "String",
          "Label": {
            "zh-cn": "现有VPC的实例ID",
            "en": "Existing VPC Instance ID"
          }
        },
        "ZoneId": {
          "AssociationProperty": "ALIYUN::ECS::ZoneId",
          "Type": "String",
          "Label": {
            "zh-cn": "交换机可用区",
            "en": "VSwitch Zone ID"
          }
        },
        "VSwitchId": {
          "AssociationProperty": "ALIYUN::ECS::VSwitch::VSwitchId",
          "AssociationPropertyMetadata": {
            "VpcId": "${VpcId}",
            "ZoneId": "${ZoneId}"
          },
          "Type": "String",
          "Label": {
            "zh-cn": "网络交换机ID",
            "en": "VSwitch ID"
          }
        },
        "SecurityGroupId": {
          "AssociationProperty": "ALIYUN::ECS::SecurityGroup::SecurityGroupId",
          "AssociationPropertyMetadata": {
            "VpcId": "${VpcId}"
          },
          "Type": "String",
          "Description": {
            "Label": {
              "zh-cn": "业务安全组ID",
              "en": "Business Security Group ID"
            }
          },
          "ClusterDiskType": {
            "Type": "String",
            "Default": "CLOUD_SSD"
          }
        }
      },
      "Resources": {
        "EmrCluster": {
          "Type": "ALIYUN::EMR::Cluster",
          "Properties": {
            "UseLocalMetaDb": false,
            "IoOptimized": true,
            "ZoneId": {
              "Ref": "ZoneId"
            },
            "VSwitchId": {
              "Ref": "VSwitchId"
            },
            "SecurityGroupId": {
              "Ref": "SecurityGroupId"
            },
            "HostGroup": [
              {
                "DiskType": "CLOUD_SSD",
                "HostGroupType": "MASTER",
                "DiskCount": 1,
                "DiskCapacity": 80,
                "NodeCount": 1,
                "SysDiskType": "CLOUD_SSD",
                "ChargeType": "PostPaid",
                "VSwitchId": {
                  "Ref": "VSwitchId"
                },
                "AutoRenew": false,
                "Period": 1,
                "SysDiskCapacity": 120,
                "InstanceType": "ecs.g5.xlarge"
              },
              {
                "DiskType": "CLOUD_SSD",
                "HostGroupType": "CORE",
                "DiskCount": 4,
                "DiskCapacity": 80,
                "NodeCount": 2,
                "SysDiskType": "CLOUD_SSD",
                "ChargeType": "PostPaid",
                "VSwitchId": {
                  "Ref": "VSwitchId"
                },
                "AutoRenew": false,
                "Period": 1,
                "SysDiskCapacity": 120,
                "InstanceType": "ecs.g5.xlarge"
              }
            ],
            "EmrVer": "EMR-3.22.4",
            "ClusterType": "HADOOP",
            "Name": {
              "Fn::Join": [
                "-",
                [
                  "StackId",
                  {
                    "Ref": "ALIYUN::StackId"
                  }
                ]
              ]
            },
            "MasterPwd": "Admin123!",
            "VpcId": {
              "Ref": "VpcId"
            },
            "ChargeType": "PostPaid",
            "NetType": "vpc"
          }
        }
      },
      "Outputs": {
        "ClusterId": {
          "Description": "The ID of the cluster.",
          "Value": {
            "Fn::GetAtt": [
              "EmrCluster",
              "ClusterId"
            ]
          }
        }
      }
    }

更多示例,请参见:JSON示例YAML示例