将安装在 AWS EC2 实例上的 MongoDB 的存储位置设置为 EBS 存储.以及如何在实例停止/终止后恢复它? [英] Set storage location of MongoDB installed on AWS EC2 Instance to EBS storage. And How do I recover It after instance is stopped/terminated?

查看:53
本文介绍了将安装在 AWS EC2 实例上的 MongoDB 的存储位置设置为 EBS 存储.以及如何在实例停止/终止后恢复它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我是 AWS 的新手.我已经创建并实例化并在其上安装了 MongoDB.但是我从 EC2 文档中了解到,存储在 EC2 机器上的数据一旦停止或终止就会被销毁.所以我必须使用 EBS 来存储数据.

Hello everone I am new to AWS. I have created and Instance and installed MongoDB on It. But I learned from EC2 docs that the data stored on EC2 machine destroyed once they stop or terminated. So I have to use EBS for the data storage.

在创建 EC2-Instance 的第 4 步,我选择了卷

On the 4th step of creating EC2-Instance I selected the volume

但是我不知道如何使用它.EC2-Instance 是自动使用它来存储数据还是我们必须手动执行它.我知道要更改数据库存储,我们必须更改名为 mongod.conf 的文件并修改那里的 dbpath,但我不知道在那里给出什么路径.在那之后,如果我销毁了该实例,我将收回 EBS 存储.提前感谢您的帮助.

But I don't know how to use it. Is it automatically used by EC2-Instance to store the data in it or we have to manually do it. I know that for changing the database storage we have to change the file named mongod.conf and modify the dbpath there but I don't know what path to give there. and after that also if I destroyed that instance when I will get the EBS storage back. thanks in advance for the help.

推荐答案

在您的屏幕截图中,EBS 卷是实例的根卷.因此,除非您将其他卷添加到该实例,否则该实例上持久保存到磁盘的所有内容都将存储在 EBS 卷上.您可以选择(或创建)任何位置来存储您的数据库.

In your screenshot the EBS volume is the root volume for the instance. So unless you add other volumes to the instance, everything persisted to disk on that instance is going to be stored on the EBS volume. You can pick (or create) any location to store your database.

这篇关于将安装在 AWS EC2 实例上的 MongoDB 的存储位置设置为 EBS 存储.以及如何在实例停止/终止后恢复它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆