

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

# 使用 Spark 连接器时的注意事项和限制
<a name="emr-spark-redshift-considerations"></a>
+ 建议您为从 Spark on Amazon EMR 到 Amazon Redshift 的 JDBC 连接启用 SSL。
+ 作为最佳实践，建议您在 AWS Secrets Manager 中管理 Amazon Redshift 集群的凭证。有关示例 [AWS Secrets Manager ，请参阅使用检索连接至亚马逊 Redshift 的凭证](https://docs.aws.amazon.com/redshift/latest/mgmt/redshift-secrets-manager-integration.html)。
+ 建议使用参数 `aws_iam_role` 为 Amazon Redshift 身份验证参数传递 IAM 角色。
+ `tempdir` URI 指向 Amazon S3 位置。此临时目录不会自动清理，因此可能会增加额外成本。
+ 请考虑以下针对 Amazon Redshift 的建议：
  + 建议阻止对 Amazon Redshift 集群的公有访问。
  + 建议启用 [Amazon Redshift 审计日志记录](https://docs.aws.amazon.com/redshift/latest/mgmt/db-auditing.html)。
  + 建议启用 [Amazon Redshift 静态加密](https://docs.aws.amazon.com/redshift/latest/mgmt/security-server-side-encryption.html)。
+ 请考虑以下针对 Amazon S3 的建议：
  + 建议[阻止对 Amazon S3 存储桶的公有访问](https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-control-block-public-access.html)。
  + 建议使用 [Amazon S3 服务器端加密](https://docs.aws.amazon.com/AmazonS3/latest/userguide/serv-side-encryption.html)以加密使用的 Amazon S3 存储桶。
  + 建议使用 [Amazon S3 生命周期策略](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lifecycle-mgmt.html)定义 Amazon S3 存储桶的保留规则。
  + Amazon EMR 始终验证从开源导入到映像中的代码。出于安全原因，我们不支持从 Spark 到 Amazon S3 的以下身份验证方法：
    + 在`hadoop-env`配置分类中设置 AWS 访问密钥
    + 在 `tempdir` URI 中对 AWS 访问密钥进行编码

有关使用连接器及其支持参数的更多信息，请参阅以下资源：
+ *Amazon Redshift Management Guide*（《Amazon Redshift 管理指南》）中的 [Amazon Redshift integration for Apache Spark](https://docs.aws.amazon.com/redshift/latest/mgmt/spark-redshift-connector.html)（适用于 Apache Spark 的 Amazon Redshift 集成）
+ Github 上的 [`spark-redshift` 社区存储库](https://github.com/spark-redshift-community/spark-redshift#readme)