edit-icon download-icon

Create an OSSFS data volume

Last Updated: Feb 06, 2018

OSSFS is a FUSE-based file system officially provided by Alibaba Cloud (click https://github.com/aliyun/ossfs to view the project home page). OSSFS data volumes can package Object Storage Service (OSS) buckets as data volumes.

The performance and functions of OSSFS differ from those of local file systems because data needs to be synchronized to the cloud by means of network. We recommend that you do not run I/O-intensive applications such as databases or applications that require constantly rewriting files such as logs on OSSFS. OSSFS is applicable to scenarios such as sharing configuration files among containers and attachment upload that do not require rewriting.

OSSFS differs from local file systems in the following ways:

  • Random write or append write leads to the entire file being overwritten.
  • Metadata operations, such as list directory, provide poor performance because the system needs to remotely access the OSS server.
  • The file/folder rename operation is not atomic.
  • Coordinate the actions of each client on your own when multiple clients are mounted to the same OSS bucket. For example, avoid multiple clients from writing the same file.
  • Hard link is not supported.

Prerequisites

You can only use the data volume function when your cluster meets the following conditions:

  • The cluster Agent is of version 0.6 or later versions.

    You can view your Agent version on the Cluster List page. Click More at the right of the cluster and then select Upgrade Agent from the list. For how to upgrade Agent, see Upgrade Agent.

    1

  • The acsvolumedriver application is deployed in the cluster. We recommend that you update the acsvolumedriver to the latest version.

    You can deploy and update the acsvolumedriver application by upgrading the system services. For more information, see Upgrade system services.

    Note: When acsvolumedriver is upgraded or restarted, containers using OSSFS data volumes will be restarted, and your services will be restarted.

Procedure

Step 1 Create an OSS bucket

Log on to the OSS console and create a bucket. For more information, see Create a bucket.

In this example, create a bucket in the region of China East 1 (Hangzhou).

1

Step 2 Create an OSSFS data volume

  1. Log on to the Container Service console.

  2. Click Data Volumes in the left-side navigation pane.

  3. Select the cluster in which you want to create a data volume from the Cluster list.

  4. Click Create in the upper-right corner.

    1

  5. The Create Data Volume dialog box appears. Select OSS as the Type, configure the data volume parameters, and then click Create. Container Service will create data volumes with the same name on each node in the cluster.

    1

    • Name: The data volume name and must be unique in the cluster.
    • Access Key ID and Access Key Secret: The AccessKey required to access OSS. You can obtain them from the AccessKey console.
    • Bucket ID: The name of the OSS bucket to be used. Click Select Bucket. Select the bucket in the displayed dialog box and click Select.
    • Access Domain Name: If the bucket and Elastic Compute Service (ECS) instance are in the same region, select Intranet. Otherwise, select Internet. If your cluster uses Virtual Private Cloud (VPC), select VPC.
    • File Caching: Select Disable if you want to synchronize the modifications of the same file on multiple machines (for example, modify the file on machine A and read the modified contents on machine B).

      Note: Disabling the file caching slows down the ls folder, especially when many files are in the same folder. Therefore, enable the file caching to speed up the ls if you do not have the preceding requirement.

    You can view the created OSSFS data volumes on the Data Volume List page.

Subsequent operations

After creating a data volume, you can use it in your applications. For how to use data volumes in applications, see Use third-party data volumes.

Thank you! We've received your feedback.