简体   繁体   English

将EC2实例从临时存储备份到持久存储

[英]Backing up EC2 instance from Ephemeral to Persistent Storage

I'm pretty new with EC2 and backing up data, but currently, the app that I've built has no backup strategy and I want to know how to build a proper one. 我对EC2和备份数据还很陌生,但是目前,我构建的应用没有备份策略,我想知道如何构建合适的应用。 Currently, I have my RoR app and my MongoDB database on one instance. 目前,我在一个实例上拥有RoR应用程序和MongoDB数据库。 I've just now read about EBS volumes and snapshots, but I just can't wrap my head around it. 我现在刚刚阅读了有关EBS卷和快照的信息,但我对此无能为力。

Supposedly EBS can be used as a datastore. 可以将EBS用作数据存储。 If that is so, how do I set up a MongoDB database in EBS and migrate the data I have in my EC2 instance to it? 如果是这样,如何在EBS中建立MongoDB数据库并将EC2实例中的数据迁移到该数据库? I'm not familiar with configuring EBS and I've read the documentation and have more questions than answers. 我对配置EBS不熟悉,我已经阅读了文档,并且有很多疑问而不是答案。

In short, my instance is ephemeral storage right now and I want to turn it into persistent storage. 简而言之,我的实例现在是临时存储,我想将其转换为持久存储。

Thank you, 谢谢,

Don

It is pretty simple. 这很简单。

  • EBS is network disk volumes, it is used to store data. EBS是网络磁盘卷,用于存储数据。
  • A snapshot is an compress image backup, so this can apply to EC2 instance, RDS instances, even snapshot EBS volumes itself. 快照是压缩映像备份,因此它可以应用于EC2实例,RDS实例,甚至快照EBS卷本身。 After create the snapshot, it must store some where, thus, AWS use to store this backup into EBS. 创建快照后,它必须存储一些位置,因此,AWS使用此位置将​​该备份存储到EBS中。

Configure EBS is not difficult, it is little different that put on a new hard drive. 配置EBS并不困难,放在新硬盘上几乎没有什么不同。 You just need to "attach" an EBS volume to your instance. 您只需要将EBS卷“附加”到您的实例即可。 Then inside the EC2, do the usual OS disk initialisation work. 然后在EC2内部,执行常规的OS磁盘初始化工作。

Because EBS is a dynamic storage, as long as your EC2 instance OS support it, you can extend the disk space anytime you need it (although it is recommended to do backup before doing it). 由于EBS是动态存储,因此只要您的EC2实例操作系统支持它,就可以在需要时扩展磁盘空间(尽管建议在执行备份之前先进行备份)。

But from the operation perspective, you may want to consider putting your data into RDS if it is run for 24x7x365. 但是从操作角度来看,如果数据以24x7x365运行,则可能要考虑将数据放入RDS。 So you don't need to deal with DB installation, complicate replication update,etc. 因此,您无需处理数据库安装,使复制更新复杂化等工作。 If you run the DB occasionally, then you might want to stick to the EC2 instance mongodb. 如果您偶尔运行数据库,则可能要坚持使用EC2实例mongodb。

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

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