Use the multi-attach feature to attach a cloud disk to multiple ECS instances

更新时间:
复制 MD 格式

The multi-attach feature allows you to attach a single cloud disk, such as an ESSD or an ESSD AutoPL disk, to multiple ECS instances that support the NVMe protocol in the same zone. This setup enables concurrent read and write access, making it ideal for workloads that require efficient data sharing and fast failover. This topic shows you how to attach a cloud disk to multiple ECS instances using the multi-attach feature.

For more information about the NVMe protocol, see NVMe protocol overview.

Use cases

The multi-attach feature is suitable for the following use cases:

  • Data sharing

    Data sharing is a primary use case for a shared NVMe disk. After data is written to the disk from one instance, other attached instances can immediately access it. This approach saves costs and improves read/write performance. For example, in a containerized environment, multiple instances can read and load from a single, shared container image, especially when the images are similar.

  • High availability failover

    Building high availability (HA) applications is a common use case for shared disks. Traditional SAN-based applications like Oracle RAC and SAP HANA, as well as cloud-native high availability databases, can experience single points of failure. Although cloud storage and networks provide high availability, compute nodes are susceptible to disruptions such as power loss, crashes, or hardware failures. To ensure business continuity, applications are often deployed in a primary/secondary mode.

    In a database scenario, for example, if the primary database instance fails, services can quickly switch to the secondary instance. After the instance switch, you can issue an NVMe Persistent Reservation (PR) command to revoke the write permissions of the old instance. This ensures data consistency by preventing the old instance from writing new data. The following figure illustrates the failover process.

    Note

    PR (Persistent Reservation) is part of the NVMe protocol. PR allows you to precisely control the read and write permissions for a specific cloud disk, ensuring that data is written as expected by the compute node. For more information, see NVMe PR protocol.

    1. The primary database instance (Instance 1) fails, causing a service interruption.

    2. An NVMe PR command is issued to prevent Instance 1 from writing data and to grant write permissions to the secondary database instance (Instance 2).

    3. Instance 2 is restored to the same state as Instance 1 through methods such as log replay.

    4. Instance 2 is promoted to the primary instance and resumes service.

  • Distributed cache acceleration

    A cloud disk with multi-attach enabled offers high IOPS and throughput, making it an excellent choice for accelerating the performance of slower storage systems. For example, a data lake built on OSS provides high sequential throughput but often suffers from high latency and poor random I/O performance. By using a high-speed, multi-attach cloud disk as a cache for compute nodes, you can significantly improve access performance for applications like data lakes.

  • Machine learning

    In distributed machine learning training, after sample labels are written, a dataset is often split into smaller chunks and distributed to multiple compute nodes for parallel processing. The multi-attach feature allows each compute node to directly access the shared storage resource, which reduces data transfer latency by eliminating the need for frequent data transfers over the network. This accelerates the model training process. The combination of high-performance cloud disks and the multi-attach feature provides an efficient and flexible storage solution for machine learning, especially for large-scale model training tasks that require high-speed data access. This significantly improves the efficiency and effectiveness of the entire machine learning workflow.

Billing

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

Limitations

The following limitations apply when you use the multi-attach feature:

Resource

Description

cloud disk

  • You can enable the multi-attach feature only when you create a cloud disk. You cannot enable or disable this feature for an existing cloud disk.

  • Multi-attach is available for data disks only. It is not available for system disks.

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

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

  • The following operations are not supported for a cloud disk with the multi-attach feature enabled:

    • Releasing the disk with its instance

    • Partitioning the disk in the console

      Note

      You can only log on to an instance to partition, format, and mount a file system. For more information, see Initialize a data disk.

    • Changing the billing method of the disk

    • Re-initializing the disk

    • Changing the disk category

    • Changing the performance level of an ESSD

    • Using snapshot-consistent groups

Region and Zone

This feature is supported in the same regions and zones where the required instance families are available.

ECS instance

  • The instance family must support the NVMe protocol by default. For more information, see 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 multi-attach-enabled cloud disk can be attached to up to 16 ECS instances.

Image

The image must include NVMe drivers.

Note

Procedure

Step 1: Create a multi-attach disk

  1. Go to ECS console - Block Storage.

  2. In the top navigation bar, select the region and resource group of the resource that you want to manage. Region

  3. Click Create Disk.

  4. On the Create Disk page, configure the disk parameters.

    image

    Note

    This step describes only the parameters required to enable the multi-attach feature. For more information about other parameters, see Create an empty data disk.

    Parameter

    Description

    Attach

    Select Not Attach to create the disk without attaching it to an ECS instance.

    Region and Zone

    Select a region and zone that support the multi-attach feature.

    Billing Method

    Select Pay-as-you-go.

    Cloud Disk

    Configure the disk settings and enable the multi-attach feature.

    • Select a disk category and set the capacity.

    • Select Multi-attach.

    After the disk is created, verify that the new disk shows Yes in the Multi-attach column on the Disks page.

Step 2: Attach the disk to multiple instances

  1. Go to ECS console - Instances.

  2. From the instance list, note the IDs of the ECS instances that support the NVMe protocol.

  3. Go to ECS console - Block Storage.

  4. Find the target disk and click Attach in the Actions column.

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

    Note

    This step describes only the parameters required to attach a multi-attach-enabled cloud disk. For more information about other parameters, see Attach a data disk.

    • Target Instance: Enter the ID of the target ECS instance.

    • Release Disk with Instance: Do not select this option. The multi-attach feature requires you to retain the cloud disk when an instance is released.

  6. Log on to an ECS instance to partition, format, and mount a file system for the disk.

    For more information, see Initialize a data disk.

    Important

    If a multi-attach-enabled cloud disk that is attached to multiple ECS instances uses a file system designed for a single node, such as ext3, ext4, XFS, or NTFS, data cannot be synchronized between the instances. This can lead to data inconsistency. We recommend that you create a cluster file system that is suitable for your application. A cluster file system synchronizes all written data, created files, and modified metadata across all attached nodes in real time to ensure data consistency at the file system level. Common cluster file systems include OCFS2, GFS2, Veritas CFS, Oracle ACFS, and DBFS. For more information, see Deploy a cluster file system based on a shared NVMe disk.

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

    After the attachment is successful, the disk status changes to In Use. You can hover over the instance ID or name in the Associated Instance column to view the attachment information for one or more ECS instances.

Related documentation