简体   繁体   English

将数据从 AWS Elasticsearch 移动到 S3

[英]Move data from AWS Elasticsearch to S3

I have an application pumping logs to an AWS OpenSearch (earlier Elasticsearch) cluster.我有一个应用程序将日志发送到 AWS OpenSearch(早期的 Elasticsearch)集群。 I want to move old logs to S3 to save cost and still be able to read the logs (occasionally).我想将旧日志移动到 S3 以节省成本,并且仍然能够(偶尔)读取日志。

One approach I can think of is writing a cron job that reads the old indexes, writes them (in text format) to the s3 and deletes the indexes.我能想到的一种方法是编写一个读取旧索引的 cron 作业,将它们(以文本格式)写入 s3 并删除索引。 This also requires keeping day wise indexes.这也需要保持每日索引。 Is there a more efficient/better way?有没有更有效/更好的方法?

You can use the manual snapshots approach to backup your indexes to s3: https://docs.aws.amazon.com/opensearch-service/latest/developerguide/managedomains-snapshots.html您可以使用手动快照方法将索引备份到 s3: https ://docs.aws.amazon.com/opensearch-service/latest/developerguide/managedomains-snapshots.html

Another option as suggested toward the end of the first link is to use a tool named Curator within lambda that will handle the index rotation: https://docs.aws.amazon.com/opensearch-service/latest/developerguide/curator.html第一个链接末尾建议的另一个选项是在 lambda 中使用名为 Curator 的工具来处理索引轮换: https ://docs.aws.amazon.com/opensearch-service/latest/developerguide/curator.html

Depending on your use case UltraWarm could be the best approach, in case you want those logs to be searchable later on without the need of manual restores, that will be required in case you go with the first two options I have listed: https://aws.amazon.com/blogs/aws/general-availability-of-ultrawarm-for-amazon-elasticsearch-service/根据您的用例,UltraWarm 可能是最好的方法,如果您希望以后无需手动恢复即可搜索这些日志,如果您使用我列出的前两个选项,则需要这样做: https:/ /aws.amazon.com/blogs/aws/general-availability-of-ultrawarm-for-amazon-elasticsearch-service/

There is one tool elasticdump有一个工具elasticdump

# Export ES data to S3 (using s3urls)
elasticdump \
  --s3AccessKeyId "${access_key_id}" \
  --s3SecretAccessKey "${access_key_secret}" \
  --input=http://production.es.com:9200/my_index \
  --output "s3://${bucket_name}/${file_name}.json"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM