您可以将亚马逊EBS到多个实例? [英] Can you attach Amazon EBS to multiple instances?

查看:513
本文介绍了您可以将亚马逊EBS到多个实例?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们目前使用的多个Web服务器访问一个MySQL服务器和文件服务器。纵观移动到云中,我可以使用相同的设置和EBS附加到多个机实例或什么的另一种解决办法?

We currently use multiple webservers accessing one mysql server and fileserver. Looking at moving to the cloud, can I use this same setup and attach the EBS to multiple machine instances or what's another solution?

推荐答案

更新(2015年四月):对于这个用例,你应该开始寻找新的Amazon弹性文件系统(EFS)的,其目的是要乘法附着在完全相同你想要的方式。 EFS和EBS之间的主要区别在于它们提供不同的抽象:EFS公开的NFSv4协议,而EBS提供原始块IO访问。

UPDATE (April 2015): For this use-case, you should start looking at the new Amazon Elastic File System (EFS), which is designed to be multiply attached in exactly the way you are wanting. The key difference between EFS and EBS is that they provide different abstractions: EFS exposes the NFSv4 protocol, whereas EBS provides raw block IO access.

下面你会发现我原来的解释,为什么它无法安全地装入原始块设备上的多台机器。

Below you'll find my original explanation as to why it's not possible to safely mount a raw block device on multiple machines.

原来的职位(2011):

即使您能够得到连接到多个实例的EBS卷,这将是一个_REALLY_BAD_IDEA_。引述Kekoa,这就像使用两台计算机硬盘驱动器一次

Even if you were able to get an EBS volume attached to more than one instance, it would be a _REALLY_BAD_IDEA_. To quote Kekoa, "this is like using a hard drive in two computers at once"

为什么这是一个坏主意? ... 你不能将一个体积多个实例的原因是,EBS提供了一个块存储抽象赖以运行的客户像EXT2 / EXT3 /等文件系统。大多数文件系统(例如EXT2 / 3,FAT,NTFS等)都写假设他们有独占访问块设备。两个实例访问同一个文件系统几乎肯定会在泪水和数据损坏结束。

Why is this a bad idea? ... The reason you can't attach a volume to more than one instance is that EBS provides a "block storage" abstraction upon which customers run a filesystem like ext2/ext3/etc. Most of these filesystems (eg, ext2/3, FAT, NTFS, etc) are written assuming they have exclusive access to the block device. Two instances accessing the same filesystem would almost certainly end in tears and data corruption.

在换句话说,双重安装EBS卷会,如果你正在运行,旨在共享多台计算机之间的块设备的群集文件系统才有效。此外,即使这是不够的。 EBS将需要测试这种情况下,并确保它提供了相同的一致性保证其他共享块设备解决方案...即,该块不是缓存在像dom0的内核,Xen的层中间非共享的水平,和DomU中的内核。再有就是多个客户端之间同步块的性能方面的考虑 - 大多数集群文件系统的设计工作在高速专用的SAN,而不是尽力而为商品以太网。这听起来很简单,但你所要求的东西是一件很平凡的事情。

In other words, double mounting an EBS volume would only work if you were running a cluster filesystem that is designed to share a block device between multiple machines. Furthermore, even this wouldn't be enough. EBS would need to be tested for this scenario and to ensure that it provides the same consistency guarantees as other shared block device solutions ... ie, that blocks aren't cached at intermediate non-shared levels like the Dom0 kernel, Xen layer, and DomU kernel. And then there's the performance considerations of synchronizing blocks between multiple clients - most of the clustered filesystems are designed to work on high speed dedicated SANs, not a best-effort commodity ethernet. It sounds so simple, but what you are asking for is a very nontrivial thing.

另外,看看你的数据共享方案可以是NFS,SMB / CIFS,SimpleDB的,或S3。这些解决方案都使用了旨在共享文件,而无需共享块设备子系统较高层协议。多次这样的解决方案实际上是更有效的。

Alternatively, see if your data sharing scenario can be NFS, SMB/CIFS, SimpleDB, or S3. These solutions all use higher layer protocols that are intended to share files without having a shared block device subsystem. Many times such a solution is actually more efficient.

在你的情况,你仍然可以有一个由多个Web前端访问的单个MySQL实例/文件服务器。该文件服务器可以再存储在EBS卷上的数据,从而可以拍摄夜间快照备份。如果运行文件服务器实例丢失,可以分离EBS卷并将其重新安装到一个新的文件服务器实例,并进​​行备份,并在几分钟内运行。

In your case, you can still have a single MySql instance / fileserver that is accessed by multiple web front-ends. That fileserver could then store it's data on an EBS volume, allowing you to take nightly snapshot backups. If the instance running the fileserver is lost, you can detach the EBS volume and reattach it to a new fileserver instance and be back up and running in minutes.

有没有像S3作为一个文件系统吗? - yes和no。是的,有喜欢 s3fs 的工作OK的第三方解决方案,但引擎盖下他们仍然要做出相对昂贵的Web服务调用每一个读/写。对于共享工具目录,工程巨大。对于那种集群FS用法您在HPC领域看,而不是一个机会。为了做的更好,你需要一个新的服务,提供了一个二进制面向连接的协议,如NFS。提供这种多安装的文件系统与合理的绩效和行为将是一个伟大的功能,附加的EC2。我一直是一个倡导亚马逊建立类似的东西。

"Is there anything like S3 as a filesystem?" - yes and no. Yes, there are 3rd party solutions like s3fs that work "ok", but under the hood they still have to make relatively expensive web service calls for each read / write. For a shared tools dir, works great. For the kind of clustered FS usage you see in the HPC world, not a chance. To do better, you'd need a new service that provides a binary connection-oriented protocol, like NFS. Offering such a multi-mounted filesystem with reasonable performance and behavior would be a GREAT feature add-on for EC2. I've long been an advocate for Amazon to build something like that.

这篇关于您可以将亚马逊EBS到多个实例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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