【发布时间】:2021-03-26 18:44:13
【问题描述】:
本文档显示了基于实例大小的默认卷大小: https://docs.aws.amazon.com/emr/latest/ManagementGuide/emr-plan-storage.html
我的问题是如何在启动集群时将卷大小指定为更大。
【问题讨论】:
标签: amazon-ec2 amazon-emr
本文档显示了基于实例大小的默认卷大小: https://docs.aws.amazon.com/emr/latest/ManagementGuide/emr-plan-storage.html
我的问题是如何在启动集群时将卷大小指定为更大。
【问题讨论】:
标签: amazon-ec2 amazon-emr
您可以指定VolumeSpecification JSON 来完成此操作。我没有在主节点上尝试过这个。我曾经将它用于核心节点和任务节点,但我相信这个概念也可以扩展到主节点。
VolumeSpecification JSON 中的字段是不言自明的,所以我不在这里添加它们的解释。你可以在这里阅读它们VolumeSpecification explanation
我正在添加一个代码 sn-p,它可以帮助您我们如何准确地使用此配置。
我在我的代码中使用标准boto3 library。我有一个生成 EMR 集群的 lambda 函数,但是有一个生成 EMR 的 lambda 函数是,不是必须的,您可以选择自己的替代方案。
代码sn-p是:
from datetime import datetime
import boto3
'''
This code snippet is used to create an EMR cluster.
'''
def create_emr_cluster(event, context):
conn = boto3.client("emr")
today = datetime.today().strftime('%Y-%m-%d')
cluster_id = conn.run_job_flow(
Name='Your_EMR_name',
ServiceRole='EMR_DefaultRole',
JobFlowRole='EMR_EC2_DefaultRole',
VisibleToAllUsers=True,
LogUri='s3://your-s3-path-where-you-want-cluster-logs/%s/' % today,
ReleaseLabel='emr-5.17.0',
ScaleDownBehavior='TERMINATE_AT_TASK_COMPLETION',
Applications=[{'Name': 'Spark'},
{'Name': 'Hadoop'},
{'Name': 'Hive'},
{'Name': 'Hue'}]
Instances={
'KeepJobFlowAliveWhenNoSteps': False,
'Ec2KeyName': 'your-key-name-here',
'Ec2SubnetId': 'your-subnet-id',
'InstanceFleets': [
{'Name': 'Master Node',
'InstanceFleetType': 'MASTER',
'TargetOnDemandCapacity': 1,
'InstanceTypeConfigs': [{
'InstanceType': 'c4.xlarge'
}]
}, {
'Name': 'Core Node',
'InstanceFleetType': 'CORE',
'TargetOnDemandCapacity': 1,
'InstanceTypeConfigs': [{
'InstanceType': 'r5.2xlarge',
"EbsConfiguration": {
"EbsBlockDeviceConfigs": [
{
"VolumeSpecification": {
"SizeInGB": 64,
"VolumeType": "gp2"
},
"VolumesPerInstance": 1
}
]
}
}]
}, {
'Name': 'Task Nodes',
'InstanceFleetType': 'TASK',
'TargetSpotCapacity': 100,
'InstanceTypeConfigs': [{
'InstanceType': 'r5.2xlarge',
'BidPriceAsPercentageOfOnDemandPrice': 50,
'WeightedCapacity': 16,
"EbsConfiguration": {
"EbsBlockDeviceConfigs": [
{
"VolumeSpecification": {
"SizeInGB": 32,
"VolumeType": "gp2"
},
"VolumesPerInstance": 1
}
]
}
}, {
'InstanceType': 'r5.4xlarge',
'BidPriceAsPercentageOfOnDemandPrice': 50,
'WeightedCapacity': 40,
"EbsConfiguration": {
"EbsBlockDeviceConfigs": [
{
"VolumeSpecification": {
"SizeInGB": 64,
"VolumeType": "gp2"
},
"VolumesPerInstance": 1
}
]
}
}]
}]
}
)
return cluster_id['JobFlowId']
【讨论】:
一个 Amazon EMR 集群总是由一个或三个主节点组成。初始配置集群后,您无法扩展主节点的数量。您只能扩展集群中的核心和任务节点
【讨论】: