You need to enable JavaScript to run this app.
Big Data File Storage

Big Data File Storage

Copy page
Download PDF
Best practices
Configure Flink to access CloudFS
Copy page
Download PDF
Configure Flink to access CloudFS
Flink is a distributed framework for stateful computation on bounded and unbounded streams. It supports both streaming and batch processing applications.​
This topic describes how to configure Flink services in EMR to use and access CloudFS.​
Prerequisites​
  • CloudFS service is enabled; a file storage instance is created; and mount information is obtained. For detailed actions, see Create file storage instance.​
  • Prepare a test file.​
Step 1: Configure the CloudFS service​
tip​
Modify the following settings on all cluster nodes.​
  1. Connect to the E-MapReduce cluster as follows: ​
  • Connect to the public IP address of master node of the cluster by using local terminal SSH.​
  • Connect to the private IP address of cluster node by using a cloud server instance in the same region.​
  1. Run the following command to download the CloudfsSDK package version 1.5.3.49.​
  • ​
    wget https://cloudfs.tos-cn-beijing.volces.com/sdk/prod/cloudfs-client-1.5.3.49.tar.gz​
    ​
  1. Run the following command to unzip the CloudfsSDK rar.​
  • ​
    tar -zxvf cloudfs-client-1.5.3.49.tar.gz​
    ​
  1. Copy the extracted file cloudfs-client/lib/cloudfs-sdk-1.5.3.49.jar to the cluster directory /share/hadoop/hdfs.​
  • ​
    cp {YOUR_DOWNLOAD_PATH}/cloudfs-client/lib/cloudfs-sdk-1.5.3.49.jar /opt/{Directory}/hadoop/share/hadoop/hdfs/​
    ​
  1. Configure core-site.xml file.​
  1. Run the following command to open the core-site.xml file in the Hadoop installation directory:​
  • vim {hadoop_installation directory}/hadoop/conf/core-site.xml​
  1. Add the following configuration in core-site.xml:​
  • ​
    <property>​
    <name>fs.defaultFS</name>​
    <value>cfs://xxxx.cfs-cn-beijing.ivolces.com</value>​
    <!-- Enter the mount target address -->​
    </property>​
    ​
    <property>​
    <name>fs.cfs.impl</name>​
    <value>com.volcengine.cloudfs.fs.CfsFileSystem</value>​
    </property>​
    ​
    <property>​
    <name>fs.AbstractFileSystem.cfs.impl</name>​
    <value>com.volcengine.cloudfs.fs.CFS</value>​
    </property> ​
    ​
    <property>​
    <name>cfs.access.key</name>​
    <value>AKxxxxxxxxxxx</value>​
    <!-- Enter the access key ID -->​
    </property>​
    <property>​
    <name>cfs.secret.key</name>​
    <value>SKxxxxxxxxxxx</value>​
    <!-- Enter your private access key -->​
    </property>​
    ​
    <!-- Optional: If you use an STS Token, this is required -->.​
    <property>​
    <name>cfs.security.token</name>​
    <value>STSTokenxxxxxxxx</value>​
    </property>​
    ​
    <!-- Optional: To enable cache acceleration, configure the VPC subnet used for cache acceleration access -->​
    <property>​
    <name>cfs.client.network.segment</name>​
    <value><VPC subnet, for example, 192.168.0.0/16></value>​
    </property>​
    ​
Step 2: Configure Flink​
  1. Copy the cloudfs-client/lib/cloudfs-sdk-1.5.3.49.jar file from the extracted SDK directory to the Flink lib folder.​
  • ​
    cp {YOUR_DOWNLOAD_PATH}/cloudfs-client/lib/cloudfs-sdk-1.5.3.49.jar /{Directory}/flink/lib/​
    ​
  1. Restart the Flink service.​
  1. Log in to the VolcanoEngine E-MapReduce console.​
  1. On the cluster management page, locate the target E-MapReduce cluster.​
  1. Click Service List to locate the Flink service.​
  1. Click the Restart button on the right side of the list page and select Restart All Components. Reconnect to the cluster after restarting.​
Step 3: Verify Flink configuration​
tip​
Upload test data yourself.​
  1. Prepare test data.​
  • ​
    hdfs dfs -ls cfs://`{`Directory`}/`{document}​
    <!-- View files in the upload directory -->​
    ​
  1. Run the Flink computing command.​
  • ​
    export HADOOP_CONF_DIR=/`{`Directory`}`/hadoop/conf​
    <!-- This command specifies the environment; use the conf folder of your Hadoop installation -->​
    flink run -t local /`{`Directory`}`/flink/examples/batch/WordCount.jar \​
    ---input cfs://`{`Directory`}`/{document} \​
    <!-- The data in this folder is used as input -->​
    --output cfs://`{`Directory`}`/{document}​
    <!-- The output file after WordCount calculation is stored here -->​
    ​
  1. View the computation results.​
  • ​
    hdfs dfs -cat cfs://`{`Directory`}`/{document}​
    <!-- Here is the file path after calculation -->​
    ​
  • If information similar to the figure below is returned, Flink configuration is successful.​
  • ​Image​​
​
Last updated: 2026.02.02 11:22:42