加载中

使用私有 CA 从自托管集群重新索引

以下说明解释了如何从使用非公开信任 TLS 证书(包括自签名证书和由私有证书颁发机构 (CA) 签名的证书)的自托管集群配置到 Elastic Cloud Hosted 的远程重新索引。

假设您有一个名为 Source 的自托管源集群,它使用非公开信任的 TLS 证书,并且您希望将数据从 Source 迁移到 Elastic Cloud Hosted 上的目标集群。

  1. 获取 Source 集群的 CA,或通过运行以下命令从集群中提取证书

    echo quit | openssl s_client -showcerts -servername "$SOURCE_SERVER_NAME" -connect "$SOURCE_SERVER:$PORT" > cacert.pem
    		
  2. 使用 curl 测试您刚刚创建的 cacert.pem,这应该会返回成功响应

    curl -XGET https://<SOURCE_SERVER>:<PORT> -u <username>:<password> --cacert cacert.pem
    		
  3. 创建文件夹 my_source_ca 以存储文件 cacert.pem,并将该文件夹压缩为 my_source_ca.zip

注意

文件夹名称和文件名必须与在 第 4 步 中配置的设置相对应。

要上传您的文件,请按照 添加扩展 (Add your extension) 一节中的步骤进行操作。在 版本 (Version) 中输入通配符 * 以便兼容所有未来的升级,并在 类型 (Type) 中选择 A bundle containing dictionary or script

Elastic Cloud 控制台 中创建一个新的部署。这将是 Destination 集群。

注意

Destination 集群的版本应与 Source 集群的版本相同或更高。如果您已经有一个可用的集群,则可以跳过此步骤。

  1. 在您的部署页面中,转到 编辑 (Edit) 页面,点击 管理用户设置和扩展 (Manage user settings and extensions),选择 扩展 (Extensions) 选项卡,然后启用 my_source_ca

  2. 切换到 用户设置 (User settings) 选项卡,将以下设置附加到 elasticsearch.yml 中。此步骤将 source_server 添加到 reindex.remote.whitelist 中,并使用 reindex.ssl.certificate_authorities 设置指向 Destination 集群要信任的源 CA 包。

    reindex.remote.whitelist: ["$SOURCE_SERVER:$PORT"]
    reindex.ssl.certificate_authorities: "/app/config/my_source_ca/cacert.pem"
    reindex.ssl.verification_mode: "full"
    		
    注意

    确保 reindex.remote.whitelist 为数组格式。所有上传的包都将被解压到 /app/config/ 文件夹中。确保文件路径与您在 第 1 步 中上传的包相对应。您可以根据主机名和证书路径的有效性,选择性地将 reindex.ssl.verification_mode 设置为 fullcertificatenone。更多详细信息可在 reindex 设置中找到。

  3. 点击 返回 (Back)编辑 (Edit) 页面,滚动到页面底部以 保存 (Save) 更改。此步骤将重启所有 Elasticsearch 实例。

现在,您可以在 Elastic Cloud Hosted Destination 集群上运行从远程 Source 集群进行 reindex from remote 的重新索引操作,具体如 使用 reindex API 迁移 Elasticsearch 数据 所述。

POST _reindex
{
  "source": {
    "remote": {
      "host": "https://<SOURCE_SERVER>:<PORT>",
      "username": "username",
      "password": "xxx"
    },
    "index": "my_source_index"
  },
  "dest": {
    "index": "my_dest_index"
  }
}
		
注意

如果您有许多源需要重新索引,通常最好一次重新索引一个并并行运行,而不是使用 glob 模式来拾取多个源。查看 从多个源重新索引 (reindex from multiple sources) 以获取更多详细信息。

© . This website operates independently and is not affiliated with or endorsed by Elasticsearch B.V. All brand names, logos, and trademarks are the property of their respective owners.