Edit on GitHub

Using File Storage

Environment Dependencies

  • Insert the kernel FUSE module
  • Install libfuse
modprobe fuse
yum install -y fuse

Mounting the File System

After successfully creating a replica volume, mount the volume by executing the following command:

cfs-client -c client.json

After successful execution, you can use the df -h command to view the mount point. If the execution fails, you can judge according to the content of output.log in the log directory.

The example configuration file is as follows:


The meaning of each parameter in the configuration file is shown in the following table:

mountPointstringMount pointYes
subdirstringMount subdirectoryNo
volNamestring sliceVolume nameYes
ownerstringVolume ownerYes
accessKeystringAuthentication key of the user to which the volume belongsYes
secretKeystringAuthentication key of the user to which the volume belongsYes
masterAddrstringMaster node addressYes
rdonlyboolMount as read-only, default is falseNo
logDirstringLog storage pathNo
logLevelstringLog level: debug, info, warn, errorNo
profPortstringGolang pprof debugging portNo

Other configuration parameters can be set according to actual needs:

exporterPortstringPort for Prometheus to obtain monitoring dataNo
consulAddrstringMonitoring registration server addressNo
lookupValidstringValidity period of kernel FUSE lookup, in secondsNo
attrValidstringValidity period of kernel FUSE attribute, in secondsNo
icacheTimeoutstringValidity period of client inode cache, in secondsNo
enSyncWritestringEnable DirectIO synchronous write, that is, DirectIO forces data nodes to write to diskNo
autoInvalDatastringUse the AutoInvalData option for FUSE mountingNo
writecacheboolUse the write cache function of the kernel FUSE module. This function requires the kernel FUSE module to support write cache. The default is false.No
keepcacheboolKeep the kernel page cache. This function requires the writecache option to be enabled. The default is false.No
tokenstringIf enableToken is enabled when creating a volume, fill in the token corresponding to the permission.No
readRateintLimit the number of reads per second. The default is unlimited.No
writeRateintLimit the number of writes per second. The default is unlimited.No
followerReadboolRead data from the follower. The default is false.No
disableDcacheboolDisable Dentry cache. The default is false.No
fsyncOnCloseboolPerform fsync operation after the file is closed. The default is true.No
maxcpusintThe maximum number of CPUs that can be used, which can limit the CPU usage of the client process.No
enableXattrboolWhether to use xattr. The default is false.No
enableBcacheboolWhether to enable local level 1 cache. The default is false.No
maxStreamerLimitstringWhen local level 1 cache is enabled, the number of file metadata caches.No
bcacheDirstringThe target directory for read cache when local level 1 cache is enabled.No

Unmounting the File System

Execute the following command to unmount the replica volume:

umount -l /path/to/mountPoint

/path/to/mountPoint is the mount path in the client configuration file.

Enabling Level 1 Cache

The local read cache service deployed on the user client is not recommended for scenarios where the data set has modified writes and requires strong consistency. After deploying the cache, the client needs to add the following mount parameters, and the cache will take effect after remounting.

./cfs-bcache -c bcache.json

The meaning of each parameter in the configuration file is shown in the following table:

cacheDirstringLocal storage path for cached data: allocated space (Byte)Yes
logDirstringLog pathYes
logLevelstringLog levelYes