

AWS Data Pipeline 不再向新客户提供。的现有客户 AWS Data Pipeline 可以继续照常使用该服务。[了解详情](https://aws.amazon.com/blogs/big-data/migrate-workloads-from-aws-data-pipeline/)

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# EmrConfiguration
<a name="dp-object-emrconfiguration"></a>

 EmrConfiguration 对象是用于 4.0.0 或更高版本的 EMR 集群的配置。配置（作为列表）是 RunJobFlow API 调用的一个参数。Amazon EMR 的配置 API 采用分类和属性。 AWS Data Pipeline EmrConfiguration 与相应的属性对象一起使用，在管道执行中启动的 EMR 集群上配置[EmrCluster](dp-object-emrcluster.md)应用程序，例如 Hadoop、Hive、Spark 或 Pig。由于只能更改新集群的配置，因此您无法为现有资源提供 EmrConfiguration 对象。有关更多信息，请参阅 [https://docs.aws.amazon.com/ElasticMapReduce/latest/ReleaseGuide/](https://docs.aws.amazon.com/ElasticMapReduce/latest/ReleaseGuide/)。

## 示例
<a name="emrconfiguration-example"></a>

以下配置对象在 `core-site.xml` 中设置 `io.file.buffer.size` 和 `fs.s3.block.size` 属性：

```
[
   {  
      "classification":"core-site",
      "properties":
      {
         "io.file.buffer.size": "4096",
         "fs.s3.block.size": "67108864"
      }
   }
]
```

相应的管道对象定义在 EmrConfiguration `property`字段中使用对象和属性对象列表：

```
{
  "objects": [
    {
      "name": "ReleaseLabelCluster",
      "releaseLabel": "emr-4.1.0",
      "applications": ["spark", "hive", "pig"],
      "id": "ResourceId_I1mCc",
      "type": "EmrCluster",
      "configuration": {
        "ref": "coresite"
      }
    },
    {
      "name": "coresite",
      "id": "coresite",
      "type": "EmrConfiguration",
      "classification": "core-site",
      "property": [{
        "ref": "io-file-buffer-size"
      },
      {
        "ref": "fs-s3-block-size"
      }
      ]
    },
    {
      "name": "io-file-buffer-size",
      "id": "io-file-buffer-size",
      "type": "Property",
      "key": "io.file.buffer.size",
      "value": "4096"
    },
    {
      "name": "fs-s3-block-size",
      "id": "fs-s3-block-size",
      "type": "Property",
      "key": "fs.s3.block.size",
      "value": "67108864"
    }
  ]
}
```

以下示例是一个嵌套配置，用于通过 `hadoop-env` 分类设置 Hadoop 环境：

```
[
  {
    "classification": "hadoop-env",
    "properties": {},
    "configurations": [
      {
        "classification": "export",
        "properties": {
          "YARN_PROXYSERVER_HEAPSIZE": "2396"
        }
      }
    ]
  }
]
```

以下是使用此配置的相应管道定义对象：

```
{
  "objects": [
    {
      "name": "ReleaseLabelCluster",
      "releaseLabel": "emr-4.0.0",
      "applications": ["spark", "hive", "pig"],
      "id": "ResourceId_I1mCc",
      "type": "EmrCluster",
      "configuration": {
        "ref": "hadoop-env"
      }
    },
    {
      "name": "hadoop-env",
      "id": "hadoop-env",
      "type": "EmrConfiguration",
      "classification": "hadoop-env",
      "configuration": {
        "ref": "export"
      }
    },
    {
      "name": "export",
      "id": "export",
      "type": "EmrConfiguration",
      "classification": "export",
      "property": {
        "ref": "yarn-proxyserver-heapsize"
      }
    },
    {
      "name": "yarn-proxyserver-heapsize",
      "id": "yarn-proxyserver-heapsize",
      "type": "Property",
      "key": "YARN_PROXYSERVER_HEAPSIZE",
      "value": "2396"
    },
  ]
}
```

以下示例修改了 EMR 集群的 Hive 特定属性：

```
{
    "objects": [
        {
            "name": "hivesite",
            "id": "hivesite",
            "type": "EmrConfiguration",
            "classification": "hive-site",
            "property": [
                {
                    "ref": "hive-client-timeout"
                }
            ]
        },
        {
            "name": "hive-client-timeout",
            "id": "hive-client-timeout",
            "type": "Property",
            "key": "hive.metastore.client.socket.timeout",
            "value": "2400s"
        }
    ]
}
```

## 语法
<a name="emrconfiguration-syntax"></a>

该对象包含以下字段。


****  

| 必填字段 | 说明 | 槽位类型 | 
| --- | --- | --- | 
| 分类 | 配置的分类。 | 字符串 | 

 


****  

| 可选字段 | 说明 | 槽位类型 | 
| --- | --- | --- | 
| 配置 | 此配置的子配置。 | 参考对象，例如 “配置”：\$1"ref”:” myEmrConfiguration Id "\$1 | 
| parent | 槽将继承自的当前对象的父级。 | 引用对象，例如 “父对象”：\$1"ref”:” myBaseObject Id "\$1 | 
| property | 配置属性。 | 引用对象，例如 “属性”：\$1“ref”:” myPropertyId “\$1 | 

 


****  

| 运行时字段 | 说明 | 槽位类型 | 
| --- | --- | --- | 
| @version | 用来创建对象的管道版本。 | 字符串 | 

 


****  

| 系统字段 | 说明 | 槽位类型 | 
| --- | --- | --- | 
| @error | 用于描述格式不正确的对象的错误消息 | 字符串 | 
| @pipelineId | 该对象所属的管道的 ID | 字符串 | 
| @sphere | 对象的范围指明对象在生命周期中的位置：组件对象产生实例对象，后者执行尝试对象 | 字符串 | 

## 另请参阅
<a name="emrconfiguration-seealso"></a>
+ [EmrCluster](dp-object-emrcluster.md)
+ [属性](dp-object-property.md)
+ [Amazon EMR 版本指南](https://docs.aws.amazon.com/ElasticMapReduce/latest/ReleaseGuide/)