简体   繁体   English

Elasticsearch不断覆盖ebs卷上的现有数据

[英]Elasticsearch keeps overwriting existing data on ebs volume

I have an aws instance running ELK server on it, with an EBS attached. 我有一个AWS实例在其上运行ELK服务器,并附加了EBS。 All mamanged by Terraform. 全部由Terraform修饰。

Elasticsearch's path.data is pointed towards the mounted dir of EBS. Elasticsearch的path.data指向EBS的安装目录。 Data is stored as /ebs_vol/nodes/0/indices . 数据存储为/ebs_vol/nodes/0/indices Works perfectly fine. 工作完美。

The Problem: 问题:

When I destroy and re-create the instance (with Terraform), the ELK server is all set BUT it overwrites the /ebs_vol/nodes/0/indices and all the data present in elasticsearch before destroy/create is gone now. 当我销毁并重新创建实例(使用Terraform)时,所有ELK服务器都已设置好, 它覆盖了/ebs_vol/nodes/0/indices/ebs_vol/nodes/0/indices存在的所有数据现在销毁/创建都消失了。

Expected: 预期:

After aws_instance destroy/create elasticsearch data should persist. 在aws_instance中销毁/创建elasticsearch数据后,该数据将继续存在。

It would be great if someone can help! 如果有人可以帮助,那就太好了!

The problem was with the ec2 instance start script which before mounting the EBS volume created a file system on it sudo mkfs.ext4 and it wiped all the existing content. 问题在于ec2实例启动脚本,该脚本在装入EBS卷之前在其sudo mkfs.ext4上创建了一个文件系统,并擦除了所有现有内容。

Hence I have done that dynamically now; 因此,我现在已经动态地完成了;

if sudo mount -a ; then
    echo "Mount succeeded"
else
    echo "Mount failed"
    sudo mkfs.ext4 $EBS_DEVICE
    sudo mount -a
fi

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

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