置放群组简介:
在我们启动EC2实例时,EC2服务会以某种方式放置实例,将所有实例分布在底层的基础硬件上,最大限度的减少相关故障。若使用置放群组功能,它可以影响EC2实例的放置。如放置一组相互依赖的实例,以满足工作负载需求。根据工作负载的不同,置放群组分为以下三种策略:
第一种:集群
在一个可用区中将实例放到一起。通过使用这个策略,可以实现低延迟的网络工作负载。以满足HPC应用程序使用,紧耦合的节点与节点之间通信的要求。
第二种:分区
将实例分布放置在不同的逻辑分区上。这样一个分区中的实例组不会与不同分区的实例组使用相同的基础硬件。该策略通常为大型分布式和重复的工作负载所使用,例如Hadoop、Cassandra 和 Kafka。
第三种:分布
将一组实例严格的放置在不同的基础硬件上,减少相关故障。
置放群组限制:
具体参考官网:https://docs.aws.amazon.com/zh_cn/AWSEC2/latest/UserGuide/placement-groups.html#placement-groups-partition
使用限制:
- 区域中名称唯一。
- 不能合并置放群组。
- 一次可在一个置放群组中启动一个实例;实例不能跨多个置放群组。
- 置放群组中的实例可以使用容量预留。但是,无法为置放群组显式预留容量。
- 无法在置放群组中启动租赁为 host 的实例。
使用置放群组:
可以使用 Amazon EC2 控制台或命令行创建置放群组。
在置放群组启动实例:
可以专门创建一个 AMI 以在置放群组中启动实例,并在该实例上安装所需的软件和应用程序。然后,从该实例中创建一个 AMI。
注意事项:
- 实例数:输入在该置放群组中所需的实例总数,因为以后可能无法向其中添加实例。
- 置放群组:如果页面上没有看到之前创建的置放群组列表,那么要确定可启动的实例类型。
- 分区置放群组:一个区域置放群组支持最多7个分区
- 分布置放群组:每个可用区最多支持运行7个实例
更改实例的置放群组:
可以将现有实例移动到置放群组,将一个置放群组中的实例移动到另一个置放群组或从置放群组中删除实例。在开始之前,实例必须处于 stopped 状态。
此处可通过命令行,将停止的EC2实例移动到置放群组中。
Introduction to Placement Groups:
When we launch EC2 instances, the EC2 service places instances in a way that distributes all instances across underlying hardware to minimize correlated failures. Using the placement group feature, you can influence EC2 instance placement. For example, you can place a group of interdependent instances to meet workload requirements. Depending on the workload, placement groups are divided into three strategies:
First: Cluster
Place instances together in one Availability Zone. Using this strategy, you can achieve low-latency network workloads to meet HPC application requirements for tightly coupled node-to-node communication.
Second: Partition
Distribute instances across different logical partitions. This way, instance groups in one partition don't share the same underlying hardware with instance groups in different partitions. This strategy is typically used for large distributed and replicated workloads such as Hadoop, Cassandra, and Kafka.
Third: Spread
Strictly place a group of instances on different underlying hardware to reduce correlated failures.
Placement Group Limitations:
See official documentation: https://docs.aws.amazon.com/zh_cn/AWSEC2/latest/UserGuide/placement-groups.html#placement-groups-partition
Usage Restrictions:
- Names must be unique within a region.
- Placement groups cannot be merged.
- You can launch one instance in a placement group at a time; instances cannot span multiple placement groups.
- Instances in a placement group can use capacity reservations. However, you cannot explicitly reserve capacity for a placement group.
- You cannot launch instances with host tenancy in a placement group.
Using Placement Groups:
You can create placement groups using the Amazon EC2 console or command line.
Launching Instances in a Placement Group:
You can specifically create an AMI to launch instances in a placement group and install required software and applications on that instance. Then create an AMI from that instance.
Important Notes:
- Number of instances: Enter the total number of instances needed in the placement group, as you may not be able to add instances later.
- Placement group: If you don't see a list of previously created placement groups on the page, determine which instance types can be launched.
- Partition placement groups: A region placement group supports up to 7 partitions
- Spread placement groups: Supports up to 7 running instances per Availability Zone
Changing an Instance's Placement Group:
You can move an existing instance to a placement group, move an instance from one placement group to another, or remove an instance from a placement group. Before starting, the instance must be in a stopped state.
You can use the command line to move a stopped EC2 instance to a placement group.