

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

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

# 公用事业机构
<a name="dp-object-utilities"></a>

以下实用程序对象配置其他管道对象：

**Topics**
+ [ShellScriptConfig](dp-object-shellscriptconfig.md)
+ [EmrConfiguration](dp-object-emrconfiguration.md)
+ [属性](dp-object-property.md)

# ShellScriptConfig
<a name="dp-object-shellscriptconfig"></a>

与 Activity 一起使用，运行 preActivityTask Config 和 postActivityTask Config 的 shell 脚本。此对象可用于[HadoopActivity](dp-object-hadoopactivity.md)、[HiveActivity[HiveCopyActivity](dp-object-hivecopyactivity.md)](dp-object-hiveactivity.md)、和[PigActivity](dp-object-pigactivity.md)。您为该脚本指定一个 S3 URI 和一个参数列表。

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

 ShellScriptConfig 带参数的 A：

```
{
   "id" : "ShellScriptConfig_1”,
   "name" : “prescript”,
   "type" : "ShellScriptConfig",
   "scriptUri": “s3://my-bucket/shell-cleanup.sh”,
   "scriptArgument" : ["arg1","arg2"]
 }
```

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

该对象包含以下字段。


****  

| 可选字段 | 说明 | 槽位类型 | 
| --- | --- | --- | 
| parent | 作为槽继承源的当前对象的父项。 | 参考对象，例如，“父对象”：\$1"ref”:” myBaseObject Id "\$1 | 
| scriptArgument | 用于 Shell 脚本的参数列表。 | 字符串 | 
| scriptUri | Amazon S3 中需要下载并运行的脚本 URI。 | 字符串 | 

 


****  

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

 


****  

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

# 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/)

# 属性
<a name="dp-object-property"></a>

用于对象的单个键值属性。 EmrConfiguration 

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

以下管道定义显示了用于启动的 EmrConfiguration 对象和相应的 Property 对象 EmrCluster：

```
{
  "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"
    }
  ]
}
```

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

该对象包含以下字段。


****  

| 必填字段 | 说明 | 槽位类型 | 
| --- | --- | --- | 
| 键 | 键 | 字符串 | 
| 值 | 值 | 字符串 | 

 


****  

| 可选字段 | 说明 | 槽位类型 | 
| --- | --- | --- | 
| parent | 作为槽继承源的当前对象的父项。 | 参考对象，例如，“父对象”：\$1"ref”:” myBaseObject Id "\$1 | 

 


****  

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

 


****  

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

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