Configure NAS storage

更新时间:
复制 MD 格式

Typically, when a container is destroyed, its internal data is lost. This can negatively impact production environments. NAS is suitable for high-performance computing and data sharing scenarios. Mounting a NAS file system to an SAE application instance provides persistent storage for your application data and enables data sharing between application instances.

Prerequisites

Procedure

Configure NAS storage when you create an application

  1. On the SAE Application List page, select the target region and namespace at the top, and then click Create Application.

  2. On the Basic Information page, configure the application details, and click Next: Advanced Settings.

  3. Expand the Persistent Storage section and configure the parameters.

    1. Turn on the Enable NAS switch.

    2. In the NAS File System row, select the file system to mount, and then set Mount Source, Mount Directory, Container Path, and Permission.

      Note
      • The Mount Directory can only be the root directory / or a subdirectory that does not start with /.

      • Container Path cannot be duplicated or nested, such as /tmp and /tmp/nas.

      • Click + Add to add another mount path. You can add a maximum of 10 mount paths.

  4. Click Create Application.

Configure NAS storage when you deploy an application

Warning

After you redeploy an application, the application is restarted. To prevent unpredictable errors such as business interruptions, we recommend that you deploy applications during off-peak hours.

The procedure that can be performed to update an application varies based on the number of instances in the application. This section provides an example on how to configure the required features for an application in which the number of instances is greater than or equal to 1. For information about how to update an application in which the number of instances is 0, see Update an application.

  1. On the SAE Application List page, select the target region and namespace at the top, and then click the target Application ID to open the application details page.

  2. On the Basic Information page of the target application, click Deploy Application.

  3. Expand the Persistent Storage section and configure the parameters.

    1. Turn on the Enable NAS switch.

    2. In the NAS File System row, select the file system to mount, and then set Mount Source, Mount Directory, Container Path, and Permission.

      Note
      • The Mount Directory can only be the root directory / or a subdirectory that does not start with /.

      • Container Path cannot be duplicated or nested, such as /tmp and /tmp/nas.

      • Click + Add to add another mount path. You can add a maximum of 10 mount paths.

  4. After you complete the configuration, click OK.

Unmount a NAS file system

Warning

After you redeploy an application, the application is restarted. To prevent unpredictable errors such as business interruptions, we recommend that you deploy applications during off-peak hours.

If you no longer use NAS storage, you can unmount the NAS file system. Unmounting a file system in the SAE console does not delete the data stored in it. For detailed instructions, see Configure NAS storage when you deploy an application. In Step 4, turn off the Enable NAS file storage switch and click OK.

Verify the result

You can use one of the following methods to verify that the NAS file system is mounted:

  • Check the deployment details.

    If the application creation or deployment is successful and the new instances start without any errors, the mount is successful.

  • Verify from within the container.

    Connect to the container's webshell and run the following command to check the NAS mount information:

    cat /proc/mounts | grep nfs

    If output similar to the following is returned, the mount is successful.

    sh-4.2# cat /proc/mounts | grep nfs
    192.168.xxx.xxx:/ /xxx nfs rw,relatime,vers=3,rsize=1048576,wsize=1048576,namlen=255,hard,nolock,noresvport,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=192.168.xxx.xxx,mountvers=3,mountproto=tcp,local_lock=all,addr=192.168.xxx.xxx
    sh-4.2#
  • Verify with a file operation.

    In the webshell, perform an operation on the mounted NAS path, such as creating a file. If you can find the file in the NAS file system, the mount is successful.

FAQ

How to view NAS content?

You cannot view the content of a NAS file system directly from the console. To view the content, you must mount the file system to an SAE application or an ECS server. For more information, see the following topics:

Can I use NAS to store logs?

We do not recommend using NAS for log persistence. When multiple clients write to the same file simultaneously, it can lead to concurrent access conflicts and performance bottlenecks.

For logging, we recommend using Simple Log Service (SLS) to ensure data persistence. For more information, see Configure log collection to SLS.