When cache acceleration is enabled for a CloudFS instance, CLI commands are supported. This article describes how to use commonly used CLI commands in cache acceleration scenarios.
Machine learning platform [development machine] and [custom training] have integrated CLI, so deployment is not required and can be used directly. - Run the following command to download version 1.5.6.65 of the CloudfsSDK package.
https://cloudfs.tos-cn-beijing.volces.com/sdk/prod/cloudfs-client-1.5.6.65.tar.gz
- Run the following command to extract the CloudfsSDK package.
tar -zxvf cloudfs-client-1.5.6.65.tar.gz
- Configure environment variables.
export LD_LIBRARY_PATH=${CLOUDFSSDK_HOME}/lib/
Machine learning platform [development machine] and [custom training] have integrated CLI, so configuration is not required and can be used directly. - Create and configure the cloudfs.conf configuration file in any directory.
vim ${CLOUDFSSDK_HOME}/conf/cloudfs-fuse.conf
- Edit the configuration file cloudfs-fuse.conf.
# CloudFS Client Configurations
# CloudFS endpoint, e.g. cfs://xxx.cfs-cn-beijing.ivolces.com
cfs.filesystem.fs-mode=ACC
# Required settings for ACC mode
cfs.filesystem.ufs-path=
Run the following command to obtain the file list.
cfs-cli ls tos://bucket/object
- Self-deployment installation method
${CLOUDFSSDK_HOME}/bin/cfs ls tos://bucket/object --config-file ${CLOUDFSSDK_HOME}/conf/cloudfs-fuse.conf
Is
The CLI lists files, allowing CloudFS to synchronize metadata from TOS. For the listed path, enter the TOS path to be executed.
${CLOUDFSSDK_HOME}/bin/cfs ls [OPTION] <path>
Recursively list subdirectories.
Skip metadata synchronization.
Display the persistence status of the file.
Can be used in conjunction with "-R", indicating the depth of list path. "0" represents only the current path of list, "1" represents current path of list and its subpath, and so on. The defaul value is 32767.
Recursively list the maximum concurrency of subdirectories. The default value is 100.
Display wether the file is pinned.
Configuration file path.
- If no list result is printed after 30 seconds, the total number of files listed so far will be printed to indicate progress. Examples:
1327202 paths have been listed as of Dec 21 10:37:06
Load metadata or data from the underlying file system into the CloudFS cache.
${CLOUDFSSDK_HOME}/bin/cfs load [OPTION] <path>
After the command is run, JOB ID is returned. This JOB ID is used to query task status.
Load data from the underlying file system into CloudFS cache.
Load metadata from the underlying file system into CloudFS cache.
Recursively load data or metadata.
Number of copies of loaded data (default to 1).
Configuration file path.
Release data or metadata in CloudFS (this does not affect data in the underlying file system).
${CLOUDFSSDK_HOME}/bin/cfs free [OPTION] <path>
After the command is run, JOB ID is returned. This JOB ID is used to query task status.
Recursively release data or metadata
Query task status.
${CLOUDFSSDK_HOME}/bin/cfs lookup <job ID>
Cancel task.
${CLOUDFSSDK_HOME}/bin/cfs cancel <job ID>
Display cache usage statistics for a path in CloudFS.
${CLOUDFSSDK_HOME}/bin/cfs du [OPTION] <path>
Summarize and display the specified path
Set the read/write policy for a path.
${CLOUDFSSDK_HOME}/bin/cfs setPolicy [OPTION] <path>
Whether to write back to the underlying storage. Currently, only 0 (immediate write back) and -1 (no write back) are supported.
Obtain the read/write policy for all paths.
${CLOUDFSSDK_HOME}/bin/cfs getPolicy [OPTION] <path>
Obtain the read/write policy for all paths in the file system instance.
${CLOUDFSSDK_HOME}/bin/cfs listPolicy [OPTION]
Remove the read/write policy for a path.
${CLOUDFSSDK_HOME}/bin/cfs removePolicy [OPTION] <path>
Delete write back policy.
Pin file data in the CloudFS cache to prevent the data from being evicted.
${CLOUDFSSDK_HOME}/bin/cfs pin [OPTION] <path>
Choose whther to execute recursively. Recursive mode will mark all subpaths as PINned, while non-recursive mode only marks the requested path itself. Both modes will mark incremental paths as PINned.
Unpin the pinned path. After unpinning, the data in the cache will be automatically evicted according to the algorithm.
${CLOUDFSSDK_HOME}/bin/cfs unpin [OPTION] <path>
Whether to excute recursion.