您可以将 Amazon EBS 附加到多个实例吗? [英] Can you attach Amazon EBS to multiple instances?

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

问题描述

我们目前使用多个网络服务器访问一个 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 年 4 月):对于此用例,您应该开始查看新的 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 这样的文件系统?" - 是和否.是的,有像 s3fs 这样的 3rd 方解决方案可以正常"工作,但在他们仍然必须为每次读取/写入进行相对昂贵的 Web 服务调用.对于共享工具目录,效果很好.对于您在 HPC 世界中看到的那种集群 FS 使用,绝非偶然.为了做得更好,您需要一个提供二进制面向连接协议的新服务,例如 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.

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

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