本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
使用 Amazon OpenSearch Ingestion 在域和集合之间迁移数据
您可以使用 OpenSearch Ingestion 管道在 Amazon OpenSearch Service 域或 OpenSearch 无服务器 VPC 集合之间迁移数据。为此,您需要设置一个管道,将一个域或集合配置为源,将另一个域或集合配置为接收器。这可以有效地将数据从一个域或集合迁移到另一个域或集合。
要迁移数据,您必须拥有以下资源:
-
源 OpenSearch Service 域或 OpenSearch 无服务器 VPC 集合。此域或集合包含要迁移的数据。如果您正在使用某个域,则该域必须运行 OpenSearch 版本 1.0 或更高版本或者 Elasticsearch 版本 7.4 或更高版本。该域还必须具有向您的管道角色授予相应权限的访问策略。
-
您要向其迁移数据的单独域或 VPC 集合。该域或集合将充当管道接收器。
-
OpenSearch Ingestion 将用于读取和写入集合或域的管道角色。请将此角色的 Amazon 资源名称(ARN)包含在管道配置中。有关更多信息,请参阅以下资源:
限制
将 OpenSearch Service 域或 OpenSearch 无服务器集合指定为接收器时,应注意以下限制:
-
一个管道不能写入多个 VPC 域。
-
您只能将数据迁移到使用 VPC 访问的 OpenSearch 无服务器集合或从中迁移数据。不支持公有集合。
-
您不能在单个管道配置中指定 VPC 和公有域的组合。
-
在单个管道配置中,您最多可以指定 20 个非管道接收器。
-
在单个管道配置中,您最多可以指定来自三个不同 Amazon Web Services 区域的接收器。
-
如果任何接收器的停机时间过长或未预置足够的容量来接收传入的数据,则具有多个接收器的管道的处理速度可能会逐渐下降。
OpenSearch Service 作为源
您指定为源的域或集合是要迁移的数据的来源。
在 IAM 中创建管道角色
要创建 OpenSearch Ingestion 管道,必须首先创建一个管道角色来授予在域或集合之间读写的权限。为此,请执行以下步骤:
-
在 IAM 中创建一个新权限策略以附加到该管道角色。确保允许从源读取数据并将数据写入接收器的权限。有关为 OpenSearch Service 域设置 IAM 管道权限的更多信息,请参阅向 Amazon OpenSearch Ingestion 管道授予访问域的权限和向 Amazon OpenSearch Ingestion 管道授予访问集合的权限。
-
在管道角色中指定以下权限,以从源中读取:
{ "Version":"2012-10-17", "Statement":[ { "Effect":"Allow", "Action":"es:ESHttpGet", "Resource":[ "arn:aws:es:us-east-1:
{account-id}
:domain/{domain-name}
/", "arn:aws:es:us-east-1:{account-id}
:domain/{domain-name}
/_cat/indices", "arn:aws:es:us-east-1:{account-id}
:domain/{domain-name}
/_search", "arn:aws:es:us-east-1:{account-id}
:domain/{domain-name}
/_search/scroll", "arn:aws:es:us-east-1:{account-id}
:domain/{domain-name}
/*/_search" ] }, { "Effect":"Allow", "Action":"es:ESHttpPost", "Resource":[ "arn:aws:es:us-east-1:{account-id}
:domain/{domain-name}
/*/_search/point_in_time", "arn:aws:es:us-east-1:{account-id}
:domain/{domain-name}
/*/_search/scroll" ] }, { "Effect":"Allow", "Action":"es:ESHttpDelete", "Resource":[ "arn:aws:es:us-east-1:{account-id}
:domain/{domain-name}
/_search/point_in_time", "arn:aws:es:us-east-1:{account-id}
:domain/{domain-name}
/_search/scroll" ] } ] }
创建管道
将此策略附加到管道角色后,使用 AWSOpenSearchDataMigrationPipeline 迁移蓝图创建管道。此蓝图包括在 OpenSearch Service 域或集合之间迁移数据的默认配置。有关更多信息,请参阅 使用蓝图创建管道。
注意
OpenSearch Ingestion 使用您的源域版本和发行版来确定用于迁移的机制。某些版本支持 point_in_time
选项。OpenSearch 无服务器之所以使用 search_after
选项,是因为不支持 point_in_time
或 scroll
。
迁移过程中可能正在创建新索引,也可能在迁移过程中更新文档。因此,您可能需要对域索引数据执行一次或多次扫描,以获取新的或更新的数据。
通过在管道配置中配置 index_read_count
和 interval
,指定要运行的扫描次数。以下示例说明如何执行多次扫描:
scheduling: interval: "PT2H" index_read_count: 3 start_time: "2023-06-02T22:01:30.00Z"
OpenSearch Ingestion 使用以下配置来确保将数据写入同一索引并保持相同的文档 ID:
index: "${getMetadata(\"opensearch-index\")}" document_id: "${getMetadata(\"opensearch-document_id\")}"
指定多个 OpenSearch Service 域接收器
您可以将多个公有 OpenSearch Service 域指定为数据的目标。您可以使用此功能执行条件路由或将传入数据复制到多个 OpenSearch Service 域中。您最多可以将 10 个不同的公有 OpenSearch Service 域指定为接收器。
在以下示例中,将传入数据有条件地路由到不同的 OpenSearch Service 域:
... route: - 2xx_status: "/response >= 200 and /response < 300" - 5xx_status: "/response >= 500 and /response < 600" sink: - opensearch: hosts: [ "https://search-
response-2xx
.us-east-1
.es.amazonaws.com" ] aws: sts_role_arn: "arn:aws:iam::123456789012
:role/Example-Role
" region: "us-east-1" index: "response-2xx" routes: - 2xx_status - opensearch: hosts: [ "https://search-response-5xx
.us-east-1
.es.amazonaws.com" ] aws: sts_role_arn: "arn:aws:iam::123456789012:role/Example-Role
" region: "us-east-1" index: "response-5xx" routes: - 5xx_status
将数据迁移到 OpenSearch 无服务器 VPC 集合
您可以使用 OpenSearch Ingestion 管道将数据从源 OpenSearch Service 域或 OpenSearch 无服务器集合迁移到 VPC 集合接收器。必须在管道配置中提供网络访问策略。有关将数据摄取到 OpenSearch 无服务器 VPC 集合中的更多信息,请参阅 教程:使用 Amazon OpenSearch Ingestion 将数据摄取到集合。
将数据迁移到 VPC 集合
-
创建 OpenSearch 无服务器集合。有关说明,请参阅 教程:使用 Amazon OpenSearch Ingestion 将数据摄取到集合。
-
为集合创建网络策略,指定对集合端点和控制面板端点的 VPC 访问权限。有关说明,请参阅 针对 Amazon OpenSearch 无服务器的网络访问权限。
-
如果您还没有管道角色,请创建一个。有关说明,请参阅 管道角色。
-
创建管道。有关说明,请参阅 使用蓝图创建管道。