终止附加 EBS 卷和 MongoDB 服务器的 EC2 实例的最安全方法是什么
我目前正处于一个系统的开发阶段,该系统将使用 Mongo 作为其数据存储。数据库服务器将在 EC2 实例上运行,实际数据库位于单独的 EBS 卷上。
我的问题是这样的 - 假设数据库已启动并正在运行,但没有数据写入或读取,那么从 AWS 控制台终止 EC2 实例对于数据库数据完整性有多危险?正如我所说,我并不担心任何部分写入的数据或类似的东西,我实际上指的是数据库中已有的数据。
此外,有人可以解释 EBS 卷的快照对快照中数据的完整性有什么影响吗?在我的本地开发服务器上,我总是在将备份同步到本地存储之前停止 Mongo,因此我不清楚在数据库运行时拍摄 EBS 卷的 S3 快照的影响。
谢谢!
I'm currently in the development stages of a system that will use Mongo as its data store. The DB server will run on an EC2 instance, with the actual DB living on a separate EBS volume.
My question is this - supposing the database is up and running, but no data is being written to or read from it, how dangerous is it to terminate the EC2 instance from the AWS console, with respect to the DB data integrity? As I say, I'm not worried about any partially written data or anything like that, I'm referring really to the data already in the DB.
Further, can someone explain what impact snapshotting of the EBS volume has on the integrity of the data in the snapshot? On my local development server I always stopped Mongo before I rsync'd a backup to local storage so I'm not clear on the implications of taking an S3 snapshot of the EBS volume while the DB is running.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
从 AWS 控制台终止 EC2 实例与从 VM 内部选择操作系统关闭功能相同,因此只要 Mongo 遵守标准关闭协议并优雅地停顿任何打开的数据库通道,一切都会好起来的,并且不会出现完整性问题EBS 卷。
EBS 存储快照不是原子时间点过程 - 创建新快照需要有限的时间,具体取决于 EBS 卷的大小以及自上次快照以来的更改量。因此,如果数据完整性是一个问题,您应该始终在捕捉 EBS 数据存储之前停止数据库服务。同样,如果您要快照 VM 根 EBS 卷,则应首先停止 VM。
Terminating an EC2 instance from the AWS console is the same as selecting the OS shutdown function from inside the VM, so provided Mongo obeys standard shutdown protocol and quiesces any open database channels gracefully, everything will be fine and there will be no integrity issues on the EBS volume.
Snapshotting EBS storage is not an atomic point-in-time process - it takes a finite amount of time, depending on the size of the EBS volume and the amount of change since the last snapshot, to create the new snapshot. Thus, if data integrity is a concern, you should always quiesce the database service before snapping the EBS data store. Similarly, if you are snapping the VM root EBS volume, you should stop the VM first.
此外,请注意,对 EBS 卷进行快照可能会影响该 EBS 卷的性能。
当我们对 EBS 卷进行快照时,我们会发现延迟增加。
Furthermore, note that snapshotting an EBS volume could impact performance of that EBS volume.
When we snapshot our EBS volumes we see increased latencies.
根据我的经验,这并不是实际发生的情况。
对于 Linux EC2 实例,终止实例模拟电源故障而不是正常关闭。 /etc/rc.d 关闭脚本未运行。
From my experience this is not what actually happens.
For Linux EC2 instances, terminating the instance simulates a power failure NOT a normal shutdown. The /etc/rc.d shutdown scripts are NOT run.