Jindo CLI (jindo fs) lets you run file-system operations — upload, download, list, delete, and more — against an OSS-HDFS-enabled bucket directly from the command line. The jindo fs interface mirrors the familiar hadoop fs shell, so existing Hadoop workflows apply directly.
Prerequisites
Before you begin, make sure that you have:
An OSS bucket with OSS-HDFS enabled
One of the following environments set up:
An Alibaba Cloud E-MapReduce (EMR) cluster at version 3.44.0 or later, or 5.10.0 or later — these versions bundle JindoSDK by default. For details, see Create a cluster.
JindoSDK installed in a non-EMR environment. For details, see Deploy JindoSDK in an environment other than EMR.
Configure the environment (non-EMR only)
Skip this section if you are using an EMR cluster — the required configuration is already in place.
For non-EMR environments, complete the following steps.
Connect to your ECS instance. For details, see Connect to an ECS instance.
Go to the
bindirectory of the installed JindoSDK JAR file.cd jindosdk-x.x.x/bin/Replace
x.x.xwith your installed JindoSDK version number.Create a configuration file named
jindosdk.cfgwith the following content.[common] logger.dir = /tmp/jindo/ logger.sync = false logger.consolelogger = false logger.level = 0 logger.verbose = 0 logger.cleaner.enable = true hadoopConf.enable = false [jindosdk] # Replace with the endpoint for your region fs.oss.endpoint = cn-hangzhou.oss-dls.aliyuncs.com fs.oss.accessKeyId = yourAccessKeyId fs.oss.accessKeySecret = yourAccessKeySecretThe example above uses the China (Hangzhou) region. Replace
cn-hangzhou.oss-dls.aliyuncs.comwith the endpoint for your actual region. The endpoint format for OSS-HDFS is<region-id>.oss-dls.aliyuncs.com.Set the
JINDOSDK_CONF_DIRenvironment variable to the absolute path of thejindosdk.cfgconfiguration file.export JINDOSDK_CONF_DIR=<JINDOSDK_CONF_DIR>
Run Jindo CLI commands
All commands below run from the bin directory of your JindoSDK installation. OSS-HDFS paths use the following format:
oss://<bucket-name>.<region-endpoint>/<path>The following table summarizes the available operations.
| Operation | Command flag | Example |
|---|---|---|
| Upload a file | -put | ./jindo fs -put examplefile.txt oss://examplebucket.cn-shanghai.oss-dls.aliyuncs.com/ |
| Create a directory | -mkdir | ./jindo fs -mkdir oss://examplebucket.cn-shanghai.oss-dls.aliyuncs.com/dir/ |
| List objects or directories | -ls | ./jindo fs -ls oss://examplebucket.cn-shanghai.oss-dls.aliyuncs.com/ |
| Query object or directory sizes | -du | ./jindo fs -du oss://examplebucket.cn-shanghai.oss-dls.aliyuncs.com/ |
| Read object content | -cat | ./jindo fs -cat oss://examplebucket.cn-shanghai.oss-dls.aliyuncs.com/localfile.txt |
| Download a file | -get | ./jindo fs -get oss://examplebucket.cn-shanghai.oss-dls.aliyuncs.com/exampleobject.txt /tmp/ |
| Delete directories or objects | -rm -r | ./jindo fs -rm -r oss://examplebucket.cn-shanghai.oss-dls.aliyuncs.com/destfolder/ |
Upload a file
Upload a local file to a bucket.
./jindo fs -put examplefile.txt oss://examplebucket.cn-shanghai.oss-dls.aliyuncs.com/This uploads examplefile.txt from the local root directory to the root of examplebucket.
Create a directory
./jindo fs -mkdir oss://examplebucket.cn-shanghai.oss-dls.aliyuncs.com/dir/This creates a directory named dir/ in examplebucket.
List objects or directories
./jindo fs -ls oss://examplebucket.cn-shanghai.oss-dls.aliyuncs.com/This lists all objects and directories in the root of examplebucket.
Query object or directory sizes
./jindo fs -du oss://examplebucket.cn-shanghai.oss-dls.aliyuncs.com/This displays the size of every object and directory in examplebucket.
Read object content
./jindo fs -cat oss://examplebucket.cn-shanghai.oss-dls.aliyuncs.com/localfile.txtThis prints the content of localfile.txt to stdout as plain text.
Content is always output as plain text. If the object is encoded or binary, use HDFS API for Java to read and decode it.
Download a file
./jindo fs -get oss://examplebucket.cn-shanghai.oss-dls.aliyuncs.com/exampleobject.txt /tmp/This downloads exampleobject.txt from examplebucket to /tmp/ on your local machine.
Delete directories or objects
./jindo fs -rm -r oss://examplebucket.cn-shanghai.oss-dls.aliyuncs.com/destfolder/The -r flag deletes destfolder/ and all objects inside it recursively.
What's next
Jindo CLI user guide — full command reference including all flags and options