JindoFS is a cloud-native file system that combines the advantages of Object Storage Service (OSS) and local storage. JindoFS is also a next-generation storage system that provides efficient and reliable storage services for cloud computing in E-MapReduce (EMR). This topic describes how to configure and use JindoFS, and its use scenarios.
Overview
JindoFS supports the block storage mode and cache mode.
JindoFS adopts a heterogeneous multi-backup mechanism. Storage Service provides the data storage capability. Data is stored in OSS to ensure high reliability. Redundant backups are stored in the local cluster to accelerate read operations. Namespace Service manages metadata of JindoFS. In this case, metadata is queried from Namespace Service instead of OSS, which improves query performance. This query method of JindoFS is similar to that of Hadoop Distributed File System (HDFS).
-
JindoFS is supported in EMR 3.20.0 and later. To use JindoFS, select the service when you create a cluster.
-
This topic describes how to use JindoFS in EMR 3.22.0 and later. For instructions on using JindoFS in versions from EMR 3.20.0 up to (but not including) 3.22.0, see SmartData User Guide (EMR 3.20.0 to 3.22.0).

Prepare the environment
-
Create a cluster
Select EMR 3.22.0 or later and select SmartData in the optional services. For more information, see Create a cluster.
-
Configure the cluster
JindoFS uses OSS as its storage backend. Before you can use JindoFS, you must configure OSS-related parameters. You can do this in two ways. The first method is to modify Bigboot parameters after the cluster is created. This change requires restarting the SmartData service to take effect. The second method is to add custom configurations during cluster creation, which allows the services to start with your custom parameters once the cluster is ready.
-
Initialize parameters after cluster creation
You can configure all parameters related to JindoFS in Bigboot, as shown in the following figures.
-
On the Service Configuration page, click the bigboot tab.
Set the value of jfs.namespaces to
test. -
Click Custom Configuration. In the Add Configuration Item dialog box, add the following configuration items: Set
jfs.namespaces.test.uritooss://oss-bucket/oss-dir, setjfs.namespaces.test.modetoblock, configure the corresponding OSS AccessKey ID and AccessKey Secret, and then click OK.
Note-
The listed parameters are required.
-
JindoFS supports multiple namespaces. This topic uses
testas an example namespace.
Parameter
Description
Example
jfs.namespaces
The namespaces supported by the current JindoFS instance. Use commas to separate multiple namespaces.
test
jfs.namespaces.test.uri
The URI of the storage backend for the
testnamespace.oss://oss-bucket/oss-dir
NoteYou can configure this to a specific directory within an OSS bucket. The namespace then uses this directory as its root directory for read and write operations.
jfs.namespaces.test.mode
The storage mode for the
testnamespace.block
NoteJindoFS supports
blockandcachestorage modes.jfs.namespaces.test.oss.access.key
The AccessKey ID for OSS.
xxxx
NoteFor optimal performance and stability, we recommend using an OSS bucket that is under the same account and in the same region as your EMR cluster. This allows the cluster to have password-free access to OSS, eliminating the need to configure an AccessKey ID and AccessKey Secret.
jfs.namespaces.test.oss.access.secret
The AccessKey Secret for OSS.
Save and deploy the JindoFS configuration. Restart all components in SmartData to use JindoFS.
-
-
Add custom configurations during cluster creation
You can add custom settings when you create an EMR cluster. For example, to enable password-free access to an OSS bucket in the same region, select Custom Software Configuration and add the following configuration for the
testnamespace.[ { "ServiceName":"BIGBOOT", "FileName":"bigboot", "ConfigKey":"jfs.namespaces","ConfigValue":"test" },{ "ServiceName":"BIGBOOT", "FileName":"bigboot", "ConfigKey":"jfs.namespaces.test.uri", "ConfigValue":"oss://oss-bucket/oss-dir" },{ "ServiceName":"BIGBOOT", "FileName":"bigboot", "ConfigKey":"jfs.namespaces.test.mode", "ConfigValue":"block" } ]
-
Use JindoFS
The use of JindoFS is similar to that of HDFS. JindoFS also provides a prefix. To use JindoFS, you only need to replace the hdfs prefix with the jfs prefix.
JindoFS supports most of the computing components in the EMR cluster, including Hadoop, Hive, Spark, Flink, Presto, and Impala.
Examples:
-
Shell commands
hadoop fs -ls jfs://your-namespace/ hadoop fs -mkdir jfs://your-namespace/test-dir hadoop fs -put test.log jfs://your-namespace/test-dir/ hadoop fs -get jfs://your-namespace/test-dir/test.log ./ -
MapReduce job
hadoop jar /usr/lib/hadoop-current/share/hadoop/mapreduce/hadoop-mapreduce-examples-2.8.5.jar teragen -Dmapred.map.tasks=1000 10737418240 jfs://your-namespace/terasort/input hadoop jar /usr/lib/hadoop-current/share/hadoop/mapreduce/hadoop-mapreduce-examples-2.8.5.jar terasort -Dmapred.reduce.tasks=1000 jfs://your-namespace/terasort/input jfs://your-namespace/terasort/output -
Spark SQL
CREATE EXTERNAL TABLE IF NOT EXISTS src_jfs (key INT, value STRING) location 'jfs://your-namespace/Spark_sql_test/';
Disk space watermark control
JindoFS uses OSS as its backend for massive storage capacity, but local disk space is limited. To manage local disk usage, JindoFS automatically evicts cold data backups based on two watermark parameters: node.data-dirs.watermark.high.ratio and node.data-dirs.watermark.low.ratio. Both parameters are set as a ratio (a decimal from 0 to 1) of total disk capacity. When disk usage reaches the high watermark, JindoFS evicts data until the usage level drops to the low watermark. The value for the low watermark must be lower than the high watermark.
Configure the storage policy
JindoFS provides multiple storage policies to meet different storage needs. The following table lists four available storage policies for a directory.
|
Policy |
Description |
|
COLD |
Data has only one backup in OSS and no local backup. This policy is suitable for storing cold data. |
|
WARM |
The default storage policy. Data has one backup in OSS and one on local storage. The local backup can effectively accelerate subsequent read operations. |
|
HOT |
Data has one backup in OSS and multiple backups on local storage. This policy provides further acceleration for the most frequently accessed data. |
|
TEMP |
Data has only one local backup. This policy provides high-performance reads and writes for temporary data but reduces data reliability. It is suitable for storing and accessing temporary data. |
JindoFS provides a command-line tool Admin to configure the storage policy of a directory. The default storage policy is WARM. New files are stored based on the storage policy configured for the parent directory. Run the following command to configure the storage policy:
jindo dfsadmin -R -setStoragePolicy [path] [policy]
Run the following command to obtain the storage policy configured for a directory:
jindo dfsadmin -getStoragePolicy [path]
Here, [path] specifies the path for which you want to set the policy, and -R specifies that the policy is recursively applied to all subdirectories under the specified path.
Use the Admin tool
The JindoFS Admin tool provides the archive and jindo commands.
-
The Admin tool provides the archive command to archive cold data.
This command allows you to explicitly evict local blocks. Assume that Hive partitions a table by day. If the data generated a week ago in partitioned tables is infrequently accessed, you can run the archive command on the directory that stores such data on a regular basis. Then, the backups stored in the local cluster are evicted, whereas the backups in OSS are retained.
Run the following archive command:
jindo dfsadmin -archive [path]NoteThe [path] parameter specifies the directory path of the files to be archived.
-
The Admin tool provides the jindo command to manage metadata of JindoFS for Namespace Service.
jindo dfsadmin [-options]NoteYou can run the
jindo dfsadmin --helpcommand to get help information.
The Admin tool also provides diff and sync commands for cache mode.
-
The diff command is mainly used to display the differences between local data and data in the backend storage system.
jindo dfsadmin -R -diff [path]NoteBy default, this command compares the metadata of the immediate subdirectories within the specified
[path]. The-Roption recursively compares all paths under the specified[path]. -
The
synccommand synchronizes metadata between local and backend storage.jindo dfsadmin -R -sync [path]NoteThe
[path]parameter specifies the path to synchronize. By default, only the metadata of the immediate subdirectories of[path]is synchronized. The-Roption recursively synchronizes all paths under the specified[path].