All Products
Search
Document Center

Elastic Compute Service:Use the multi-attach feature to attach a cloud disk to multiple ECS instances

Last Updated:Nov 20, 2024

To enable efficient data sharing and fast failover, you can use the multi-attach feature to attach a single Enterprise SSD (ESSD) or ESSD AutoPL disk to multiple Elastic Compute Service (ECS) instances that support the Non-Volatile Memory Express (NVMe) protocol and reside in the same zone. After the attachment, the disk is called a shared NVMe disk. This topic describes how to attach a single cloud disk to multiple ECS instances by using the multi-attach feature.

For information about NVMe, see NVMe protocol.

Scenarios

The multi-attach feature is suitable for the following scenarios:

  • Data sharing

    Data sharing is the simplest use scenario of NVMe. After data is written to a shared NVMe disk from one attachment node, all other attachment nodes can access the data. This reduces storage costs and improves read/write performance. For example, a single NVMe-capable container image in the cloud can be read and loaded by multiple instances that run the same operating system.

    image
  • High-availability failover

    High service availability is one of the most common application scenarios of shared disks. Traditional SAN-based databases, such as Oracle Real Application Clusters (RAC), SAP High-performance ANalytic Appliance (HANA), and cloud-native high-availability databases, may encounter single points of failure (SPOFs) in actual business scenarios. Shared NVMe disks can be used to ensure business continuity and high availability in terms of cloud-based storage and networks in case of SPOFs. Compute nodes encounter frequent outages, downtime, and hardware failures. To achieve high availability of compute nodes, you can deploy business in primary/secondary mode.

    For example, in a database scenario, if the primary database fails, the secondary database quickly takes over to provide services. After the instance that hosts the primary database is switched to the instance that hosts the secondary database, you can run an NVMe Persistent Reservation (PR) command to revoke the write permissions on the faulty primary database. This helps prevent data from being written to the faulty primary database, which ensures data consistency. The following figure shows the failover process.

    Note

    PR is a part of the NVMe protocol that can precisely control read and write permissions on a cloud disk to ensure that the compute nodes can write data as expected. For more information, see NVM Express Base Specification.

    1. The primary database instance (Database Instance 1) fails, which causes the service to stop.

    2. Run an NVMe PR command to prevent data from being written to Database Instance 1 and allow data to be written to the secondary database instance (Database Instance 2).

    3. Restore Database Instance 2 to the same state as Database Instance 1 by using different methods such as log replay.

    4. Database Instance 2 takes over as the primary database instance to provide services externally.

    image
  • Distributed data cache acceleration

    Multi-attach-enabled cloud disks deliver high performance, IOPS, and throughput and can facilitate performance acceleration for storage systems with slow and medium speeds. For example, data lakes are commonly built on top of Object Storage Service (OSS). Each data lake can be simultaneously accessed by multiple clients. Data lakes deliver high sequential read throughput and high append write throughput, but have low sequential read/write throughput, high latency, and low random read/write performance. To greatly improve the access performance in scenarios such as data lakes, you can attach a high-speed, multi-attach-enabled cloud disk as a cache to compute nodes.

    image
  • Machine learning

    In machine learning scenarios, after a sample is labeled and written, the sample is split and distributed across multiple nodes to facilitate parallel distributed computing. The multi-attach feature allows each compute node to directly access shared storage resources without the need to frequently transmit data over the network. This reduces data transfer latency and accelerates the model training process. The combination of high performance and the multi-attach feature allows cloud disks to provide an efficient and flexible storage solution for machine learning scenarios, such as large-scale model training tasks that require high-speed data access and processing. The storage solution significantly improves the efficiency and effectiveness of the machine learning process.

    image

Billing

The multi-attach feature is free of charge. When resources such as cloud disks and ECS instances use the multi-attach feature, you are charged for the resources. For information about the billing of ECS resources, see Billing overview.

Limits

The following table describes the limits on the multi-attach feature.

Resource

Limit

Cloud disks

  • You can enable the multi-attach feature for a cloud disk only if you separately create the cloud disk. You cannot enable or disable the multi-attach feature for existing cloud disks.

  • You can enable the multi-attach feature for data disks, but not for system disks.

  • Only pay-as-you-go ESSDs, ESSD AutoPL disks, and Regional ESSDs (public preview) are supported.

  • If you attach a single cloud disk to multiple ECS instances, the total performance of all ECS instances cannot exceed the maximum performance of the cloud disk.

  • The following operations are not supported by cloud disks for which the multi-attach feature is enabled:

    • Release a cloud disk when its associated ECS instance is released.

    • Resize a cloud disk online. However, you can resize a cloud disk for which the multi-attach feature is enabled offline.

    • Partition a cloud disk in the ECS console.

      Note

      You can only log on to an instance to which the cloud disk is attached to create partitions and mount file systems for the cloud disk. For more information, see Initialize a data disk.

    • Change the billing method of a cloud disk.

    • Re-initialize a cloud disk.

    • Change the category of a cloud disk.

    • Change the ESSD performance level.

    • Create a snapshot-consistent group.

Regions and zones

Multi-attach-capable cloud disks are available in the same regions and zones as the instance families that support the cloud disks.

ECS instances

  • The instance families must support NVMe. For information about the instance families that support NVMe, see Overview of instance families.

    Note

    To query instance families and check whether an instance family supports NVMe, call the DescribeInstanceTypes operation and view the value of the NvmeSupport parameter in the response.

  • A single cloud disk for which the multi-attach feature is enabled can be attached to up to 16 instances.

Images

The images must contain NVMe drivers.

Note

Procedure

Step 1: Enable the multi-attach feature when you create a cloud disk

  1. Log on to the ECS console.

  2. In the left-side navigation pane, choose Storage & Snapshots > Block Storage.

  3. On the Block Storage page, click Create Cloud Disk.

  4. On the cloud disk buy page, configure the parameters described in the following table.

    创建多重挂载ESSD云盘

    Note

    This step describes how to enable the multi-attach feature for a cloud disk when you create the cloud disk. For information about other parameters, see Create an empty data disk.

    Parameter

    Description

    Attach

    Select Not Attach to specify not to attach the cloud disk to be created to ECS instances.

    Region and Zone

    Select a region and zone in which the multi-attach feature is supported.

    Billing Method

    Select Pay-as-you-go.

    Cloud Disk

    Specify the cloud disk storage parameters and enable the multi-attach feature.

    • Select the cloud disk category and specify parameters such as the cloud disk capacity.

    • Select Multi-Attach.

    If Supported is displayed in the Multi-attach column on the Cloud Disk tab, the cloud disk is created.

Step 2: Attach a cloud disk for which the multi-attach feature is enabled to multiple ECS instances

  1. In the left-side navigation pane, choose Instances & Images > Instances.

  2. Obtain the ID of an NVMe-capable ECS instance to which you want to attach the cloud disk from the instance list.

  3. In the left-side navigation pane, choose Storage & Snapshots > Block Storage.

  4. Find the disk that you want to attach and click Attach in the Actions column.

  5. In the Attach Cloud Disk dialog box, configure parameters.

    Note

    This step describes how to attach a cloud disk for which the multi-attach feature is enabled to an ECS instance. For information about other parameters, see Attach a data disk.

    • Destination Instance: Enter the ID of the ECS instance that you obtained.

    • Release Cloud Disk with Instance: Clear this option to retain the cloud disk if an associated instance is released.

  6. Log on to the ECS instance to partition and format the cloud disk and mount file systems.

    For more information, see Initialize a data disk.

    Important

    If the multi-attach-enabled cloud disk attached to multiple ECS instances uses a single-node file system, the ECS instances may fail to synchronize data, which leads to data inconsistency. A single-node file system can be one of the following types: extended file system 3 (Ext3), Ext4, eXtensible File System (XFS), and new technology file system (NTFS). To prevent data inconsistency, we recommend that you create a cluster file system that is suitable for your business scenarios. A cluster file system ensures that written data, created files, and modified metadata are synchronized across all instances to which the cloud disk is attached in real time. This ensures data consistency at the file system layer. Typical cluster file system types include Oracle Cluster File System version 2 (OCFS2), Global File System 2 (GFS2), Veritas Cluster File System (Veritas CFS), Oracle Automatic Storage Management Cluster File System (Oracle ACFS), and Databricks File System (DBFS).

  7. (Optional) Repeat Step 2 to Step 5 as needed to attach the cloud disk to other ECS instances that support NVMe.

    After the cloud disk is attached to all required ECS instances, the Status column of the cloud disk displays In Use on the Cloud Disk tab of the Block Storage (Disks) page. You can move the pointer over an instance ID or name in the Associated Instance column to view the mount information of the cloud disk on each ECS instance.

References