0

我们使用 EMR 进行处理,但最近遇到了严重的容量问题 - 到了我们无法运行任何东西的地步,因为我们的可用区没有足够的容量。

我查看了生成 emr 配置的代码,看起来我们只指定了一个子网,我们在其中创建了 ec2 集群来运行作业。

然而,我们的 VPC 中有大约 10 个不同的子网,而且几乎每个子网都位于不同的可用区中——我想利用这一点。

现在,我们只需将一个子网 id 传递给 boto3 的 run_job_flow()。不幸的是,我们设置为使用实例组配置,我认为这意味着您只能指定一个子网 ID。

如果我们使用 Instance Fleet 配置,我们是否可以传递多个实例 ID,然后 emr 会评估具有容量的子网/可用区吗?

真的,我只需要解决这个容量问题,而无需更改集群的规格。我认为我们可以通过在多个可用区中寻找集群来解决这个问题。这是正确的方法吗?还是有更好的方法来做到这一点?

这是我们提交给 boto3 run_job_flow() 的示例。其中大部分将是在其他地方设置的变量:

{
    'Name': cluster_name,
    'LogUri': log_uri + cluster_name,
    'ReleaseLabel': release_label,
    'Instances': {
        'InstanceGroups': [
            {
                'Name': "Master Node",
                'Market': 'ON_DEMAND',
                'InstanceRole': 'MASTER',
                'InstanceType': master_instance_type,
                'InstanceCount': 1
            },
            {
                'Name': "Worker Nodes",
                'Market': 'ON_DEMAND',
                'InstanceRole': 'CORE',
                'BidPrice': bid_price,
                'InstanceType': core_node_instance_type,
                'InstanceCount': num_core_nodes,
                'EbsConfiguration': {
                    'EbsBlockDeviceConfigs': [
                        {
                            'VolumeSpecification': {
                                'VolumeType': core_ebs_volume_type,
                                'SizeInGB': core_ebs_volume_gb_size
                            },
                            'VolumesPerInstance': core_ebs_volumes
                        },
                    ],
                    'EbsOptimized': True
                }
            }
        ],
        'KeepJobFlowAliveWhenNoSteps': keep_alive,
        'Ec2SubnetId': emr_subnet_id,
        'EmrManagedMasterSecurityGroup': emr_master_sg,
        'EmrManagedSlaveSecurityGroup': emr_node_sg,
        'ServiceAccessSecurityGroup': emr_access_sg
    },
    'Configurations': [
        {
            "Classification": "emrfs-site",
            "Properties": {
                "fs.s3.enableServerSideEncryption": "true"
            },
            "Configurations": []
        },
        {
            "Classification": "spark-env",
            "Configurations": [
                {
                    "Classification": "export",
                    "Properties": {
                        "PYSPARK_PYTHON": "/usr/bin/python3"
                    }
                }
            ]
        }
    ],
    'VisibleToAllUsers': True,
    'JobFlowRole': 'MyInstanceProfile',
    'ServiceRole': 'MyInstanceRole',
    'Applications': [
        {'Name': 'hadoop'},
        {'Name': 'spark'},
        {'Name': 'hive'},
        {'Name': 'livy'},
        {'Name': 'zeppelin'},
        {'Name': 'ganglia'}
    ],
    'Tags': [],
    'StepConcurrencyLevel': step_concurrency,
    'BootstrapActions': [
            {
                'Name': 'analytical-packages-bootstrap',
                'ScriptBootstrapAction': {
                    'Path': analytical_packages_bootstrap_path
                }
            }
        ]
}
4

0 回答 0