User CLI
Alluxio's command line interface provides users with basic file system operations. You can invoke the following command line utility to get all the subcommands:
General operations
This section lists usages and examples of general Alluxio operations with the exception of file system commands which are covered in the Admin CLI doc.
format
The format
command formats the Alluxio master and all its workers.
If -s
specified, only format if under storage is local and does not already exist
Running this command on an existing Alluxio cluster deletes everything persisted in Alluxio, including cached data and any metadata information. Data in under storage will not be changed.
Warning:
format
is required when you run Alluxio for the first time.format
should only be called while the cluster is not running.
formatJournal
The formatJournal
command formats the Alluxio master journal on this host.
The Alluxio master stores various forms of metadata, including:
file system operations
where files are located on workers
journal transactions
under storage file metadata
All this information is deleted if formatJournal
is run.,
Warning:
formatJournal
should only be called while the cluster is not running.
formatMasters
The formatMasters
command formats the Alluxio masters.
This command defers to formatJournal, but if the UFS is an embedded journal it will format all master nodes listed in the 'conf/masters' file instead of just this host.
The Alluxio master stores various forms of metadata, including:
file system operations
where files are located on workers
journal transactions
under storage file metadata
All this information is deleted if formatMasters
is run.,
Warning:
formatMasters
should only be called while the cluster is not running.
formatWorker
The formatWorker
command formats the Alluxio worker on this host.
An Alluxio worker caches files and objects.
formatWorker
deletes all the cached data stored in this worker node. Data in under storage will not be changed.
Warning:
formatWorker
should only be called while the cluster is not running.
bootstrapConf
The bootstrapConf
command generates the bootstrap configuration file ${ALLUXIO_HOME}/conf/alluxio-site.properties
with alluxio.master.hostname
set to the passed in value if the configuration file does not exist.
Note: This command does not require the Alluxio cluster to be running.
fs
fsadmin
The fsadmin
command is meant for administrators of the Alluxio cluster. It provides added tools for diagnostics and troubleshooting. For more information see the Admin CLI main page.
Note: This command requires the Alluxio cluster to be running.
getConf
The getConf
command prints the configured value for the given key. If the key is invalid, it returns a nonzero exit code. If the key is valid but isn't set, an empty string is printed. If no key is specified, the full configuration is printed.
Options:
--master
option prints any configuration properties used by the master.--source
option prints the source of the configuration properties.--unit <arg>
option displays the configuration value in the given unit. For example, with--unit KB
, a configuration value of4096B
returns as4
, and with--unit S
, a configuration value of5000ms
returns as5
. Possible unit options include B, KB, MB, GB, TP, PB as units of byte size and MS, S, M, H, D as units of time.
Note: This command does not require the Alluxio cluster to be running.
job
The job
command is a tool for interacting with the job service.
The usage is job [generic options]
where [generic options]
can be one of the following values:
leader
: Prints the hostname of the job master service leader.ls
: Prints the IDs of the most recent jobs, running and finished, in the history up to the capacity set inalluxio.job.master.job.capacity
.stat [-v] <id>
:Displays the status info for the specific job. Use -v flag to display the status of every task.cancel <id>
: Cancels the job with the corresponding id asynchronously.
Note: This command requires the Alluxio cluster to be running.
logLevel
The logLevel
command returns the current value of or updates the log level of a particular class on specific instances. Users are able to change Alluxio server-side log levels at runtime.
The command follows the format alluxio logLevel --logName=NAME [--target=<master|workers|job_master|job_workers|host:webPort[:role]>] [--level=LEVEL]
, where:
--logName <arg>
indicates the logger's class (e.g.alluxio.master.file.DefaultFileSystemMaster
)--target <arg>
lists the Alluxio master or workers to set. The target could be of the form<master|workers|job_master|job_workers|host:webPort[:role]>
and multiple targets can be listed as comma-separated entries.role
can be one ofmaster|worker|job_master|job_worker
. Using therole
option is useful when an Alluxio process is configured to use a non-standard web port (e.g. if an Alluxio master does not use 19999 as its web port). The default target value is the primary master, primary job master, all workers and job workers.--level <arg>
If provided, the command changes to the given logger level, otherwise it returns the current logger level.
See here for more examples.
Note: This command requires the Alluxio cluster to be running. You are not able to set the logger level on the standby masters. The standby masters/job masters do not have a running web server. So they are not accepting the requests from this command. If you want to modify the logger level for standby masters, update the
log4j.properties
and restart the process.
runClass
The runClass
command runs the main method of an Alluxio class.
For example, to run the multi-mount demo:
runTest
The runTest
command runs end-to-end tests on an Alluxio cluster.
The usage is runTest [--directory <path>] [--operation <operation type>] [--readType <read type>] [--writeType <write type>]
.
--directory
Alluxio path for the tests working directory. Default:${ALLUXIO_HOME}
--operation
The operation to test, one of BASIC or BASIC_NON_BYTE_BUFFER. By default both operations are tested.--readType
The read type to use, one of NO_CACHE, CACHE, CACHE_PROMOTE. By default all readTypes are tested.--writeType
The write type to use, one of MUST_CACHE, CACHE_THROUGH, THROUGH, ASYNC_THROUGH. By default all writeTypes are tested.
Note: This command requires the Alluxio cluster to be running.
runTests
The runTests
command runs all the end-to-end tests on an Alluxio cluster to provide a comprehensive sanity check.
This command is equivalent to running runTest with all the default flag values.
Note: This command requires the Alluxio cluster to be running.
runJournalCrashTest
The runJournalCrashTest
simulates a failover to test recovery from the journal.
Note: This command will stop any Alluxio services running on the machine.
runHmsTests
The runHmsTests
aims to validate the configuration, connectivity, and permissions of an existing hive metastore which is an important component in compute workflows with Alluxio.
-h
provides detailed guidance.-m <hive_metastore_uris>
(required) the full hive metastore uris to connect to an existing hive metastore.-d <database_name>
the database to run tests against. Usedefault
database if not provided.-t [table_name_1,table_name_2,...]
tables to run tests against. Run tests against five out of all tables in the given database if not provided.-st <timeout>
socket timeout of hive metastore client in minutes.
This tool is suggested to run from compute application environments and checks
if the given hive metastore uris are valid
if the hive metastore client connection can be established with the target server
if hive metastore client operations can be run against the given database and tables
Note: This command does not require the Alluxio cluster to be running.
runHdfsMountTests
The runHdfsMountTests
command aims to validate the configuration, connectivity and permissions of an HDFS path. It validates various aspects for connecting to HDFS with the given Alluxio configurations and identifies issues before the path is mounted to Alluxio. This tool will validate a few criteria and return the feedback. If a test failed, advice will be given correspondingly on how the user can rectify the setup.
Usage: runHdfsMountTests [--readonly] [--shared] [--option <key=val>] <hdfsURI>
--help
provides detailed guidance.--readonly
specifies the mount point should be readonly in Alluxio.--shared
specifies the mount point should be accessible for all Alluxio users.--option <key>=<val>
passes an property to this mount point.<hdfs-path>
(required) specifies the HDFS path you want to validate (then mount to Alluxio)
The arguments to this command should be consistent to what you give to the Mount command, in order to validate the setup for the mount.
Note: This command DOES NOT mount the HDFS path to Alluxio. This command does not require the Alluxio cluster to be running.
runUfsIOTest
The runUfsIOTest
command measures the read/write IO throughput from Alluxio cluster to the target HDFS.
Usage: runUfsIOTest --path <hdfs-path> [--io-size <io-size>] [--threads <thread-num>] [--cluster] [--cluster-limit <worker-num>] --java-opt <java-opt>
-h, --help
provides detailed guidance.--path <hdfs-path>
(required) specifies the path to write/read temporary data in.--io-size <io-size>
specifies the amount of data each thread writes/reads. It defaults to "4G".--threads <thread-num>
specifies the number of threads to concurrently use on each worker. It defaults to 4.--cluster
specifies the benchmark is run in the Alluxio cluster. If not specified, this benchmark will run locally.--cluster-limit <worker-num>
specifies how many Alluxio workers to run the benchmark concurrently. If>0
, it will only run on that number of workers. If0
, it will run on all available cluster workers. If<0
, will run on the workers from the end of the worker list. This flag is only used if--cluster
is enabled. This default to 0.--java-opt <java-opt>
The java options to add to the command line to for the task. This can be repeated. The options must be quoted and prefixed with a space. For example:--java-opt " -Xmx4g" --java-opt " -Xms2g"
.
Examples:
Note: This command requires the Alluxio cluster to be running.
runUfsTests
The runUfsTests
aims to test the integration between Alluxio and the given UFS. UFS tests validate the semantics Alluxio expects of the UFS.
Usage: runUfsTests --path <ufs_path>
--help
provides detailed guidance.--path <ufs_path>
(required) the full UFS path to run tests against.
The usage of this command includes:
Test if the given UFS credentials are valid before mounting the UFS to an Alluxio cluster.
If the given UFS is S3, this test can also be used as a S3 compatibility test to test if the target under filesystem can fulfill the minimum S3 compatibility requirements in order to work well with Alluxio.
Validate the contract between Alluxio and the given UFS. This is primarily intended for Alluxio developers. Developers are required to add test coverage for changes to an Alluxio UFS module and run those tests to validate.
Note: This command does not require the Alluxio cluster to be running.
readJournal
The readJournal
command parses the current journal and outputs a human readable version to the local folder. Note this command may take a while depending on the size of the journal. Note that Alluxio master is required to stop before reading the local embedded journal.
-help
provides detailed guidance.-start <arg>
the start log sequence number (exclusive). (Default:0
)-end <arg>
the end log sequence number (exclusive). (Default:+inf
)-inputDir <arg>
the input directory on-disk to read journal content from. (Default: Read from system configuration)-outputDir <arg>
the output directory to write journal content to. (Default: journal_dump-${timestamp})-master <arg>
(advanced) the name of the master (e.g. FileSystemMaster, BlockMaster). (Default: "FileSystemMaster")
Note: This command requires that the Alluxio cluster is NOT running.
upgradeJournal
The upgradeJournal
command upgrades an Alluxio journal version 0 (Alluxio version < 1.5.0) to an Alluxio journal version 1 (Alluxio version >= 1.5.0).
-journalDirectoryV0 <arg>
will provide the v0 journal persisted location.
It is assumed to be the same as the v1 journal directory if not set.
Note: This command does not require the Alluxio cluster to be running.
killAll
The killAll
command kills all processes containing the specified word.
Note: This kills non-Alluxio processes as well.
copyDir
The copyDir
command copies the directory at PATH
to all master nodes listed in conf/masters
and all worker nodes listed in conf/workers
.
Note: This command does not require the Alluxio cluster to be running.
clearCache
The clearCache
command drops the OS buffer cache.
Note: This command does not require the Alluxio cluster to be running.
docGen
The docGen
command autogenerates documentation based on the current source code.
Usage: docGen [--metric] [--conf]
--metric
flag indicates to generate Metric docs--conf
flag indicates to generate Configuration docs
Supplying neither flag will default to generating both docs.
Note: This command does not require the Alluxio cluster to be running.
version
The version
command prints Alluxio version.
Usage: version --revision [revision_length]
-r,--revision [revision_length]
Prints the git revision along with the Alluxio version. Optionally specify the revision length.
Note: This command does not require the Alluxio cluster to be running.
validateConf
The validateConf
command validates the local Alluxio configuration files, checking for common misconfigurations.
Note: This command does not require the Alluxio cluster to be running.
validateEnv
Before starting Alluxio, it is recommended to ensure that the system environment is compatible with running Alluxio services. The validateEnv
command runs checks against the system and reports any potential problems that may prevent Alluxio from starting properly.
The usage is validateEnv COMMAND [NAME] [OPTIONS]
where COMMAND
can be one of the following values:
local
: run all validation tasks on the local machinemaster
: run master validation tasks on the local machineworker
: run worker validation tasks on the local machineall
: run corresponding validation tasks on all master and worker nodesmasters
: run master validation tasks on all master nodesworkers
: run worker validation tasks on all worker nodeslist
: list all validation tasks
For all commands except list
, NAME
specifies the leading prefix of any number of tasks. If NAME
is not given, all tasks for the given COMMAND
will run.
OPTIONS
can be a list of command line options. Each option has the format -<optionName> [optionValue]
For example, [-hadoopConfDir <arg>]
could set the path to server-side hadoop configuration directory when running validating tasks.
Note: This command does not require the Alluxio cluster to be running.
collectInfo
The collectInfo
command collects information to troubleshoot an Alluxio cluster. For more information see the collectInfo command page.
Note: This command does not require the Alluxio cluster to be running. But if the cluster is not running, this command will fail to gather some information from it.
File System Operations
For fs
subcommands that take Alluxio URIs as argument (e.g. ls
, mkdir
), the argument should be either a complete Alluxio URI, such as alluxio://<master-hostname>:<master-port>/<path>
, or a path without its header, such as /<path>
, to use the default hostname and port set in the conf/alluxio-site.properties
.
Note: This command requires the Alluxio cluster to be running.
Wildcard input
Most of the commands which require path components allow wildcard arguments for ease of use. For example:
The example command deletes anything in the
data
directory with a prefix of2014
.Note that some shells will attempt to glob the input paths, causing strange errors (Note: the number 21 could be different and comes from the number of matching files in your local filesystem):
As a workaround, you can disable globbing (depending on the shell type; for example,
set -f
) or by escaping wildcards, for example:Note the double escape; this is because the shell script will eventually call a java program which should have the final escaped parameters (
cat /\\*
).
cat
The cat
command prints the contents of a file in Alluxio to the console. If you wish to copy the file to your local file system, copyToLocal
should be used.
For example, when testing a new computation job, cat
can be used as a quick way to check the output:
checkConsistency
The checkConsistency
command compares Alluxio and under storage metadata for a given path. If the path is a directory, the entire subtree will be compared. The command returns a message listing each inconsistent file or directory. The system administrator should reconcile the differences of these files at their discretion. To avoid metadata inconsistencies between Alluxio and under storages, design your systems to modify files and directories through Alluxio and avoid directly modifying the under storage.
If the -r
option is used, the checkConsistency
command will repair all inconsistent files and directories under the given path. If an inconsistent file or directory exists only in under storage, its metadata will be added to Alluxio. If an inconsistent file exists in Alluxio and its data is fully present in Alluxio, its metadata will be loaded to Alluxio again.
If the -t <thread count>
option is specified, the provided number of threads will be used when repairing consistency. Defaults to the number of CPU cores available,
This option has no effect if
-r
is not specified
NOTE: This command requires a read lock on the subtree being checked, meaning writes and updates to files or directories in the subtree cannot be completed until this command completes.
For example, checkConsistency
can be used to periodically validate the integrity of the namespace.
checksum
The checksum
command outputs the md5 value of a file in Alluxio.
For example, checksum
can be used to verify the contents of a file stored in Alluxio.
chgrp
The chgrp
command changes the group of the file or directory in Alluxio. Alluxio supports file authorization with Posix file permission. Group is an authorizable entity in Posix file permissions model. The file owner or super user can execute this command to change the group of the file or directory.
Adding -R
option also changes the group of child file and child directory recursively.
For example, chgrp
can be used as a quick way to change the group of file:
chmod
The chmod
command changes the permission of file or directory in Alluxio. Currently, octal mode is supported: the numerical format accepts three octal digits which refer to permissions for the file owner, the group and other users. Here is number-permission mapping table:
Number | Permission | rwx |
---|---|---|
7 | read, write and execute | rwx |
6 | read and write | rw- |
5 | read and execute | r-x |
4 | read only | r-- |
3 | write and execute | -wx |
2 | write only | -w- |
1 | execute only | --x |
0 | none | --- |
Adding -R
option also changes the permission of child file and child directory recursively.
For example, chmod
can be used as a quick way to change the permission of file:
chown
The chown
command changes the owner of the file or directory in Alluxio. For security reasons, the ownership of a file can only be altered by a super user.
For example, chown
can be used as a quick way to change the owner of file:
Adding -R
option also changes the owner of child file and child directory recursively.
copyFromLocal
The copyFromLocal
command copies the contents of a file in the local file system into Alluxio. If the node you run the command from has an Alluxio worker, the data will be available on that worker. Otherwise, the data will be copied to a random remote node running an Alluxio worker. If a directory is specified, the directory and all its contents will be copied recursively (parallel at file level up to the number of available threads).
Usage: copyFromLocal [--thread <num>] [--buffersize <bytes>] <src> <remoteDst>
--thread <num>
(optional) Number of threads used to copy files in parallel, default value is CPU cores * 2--buffersize <bytes>
(optional) Read buffer size in bytes, default is 8MB when copying from local and 64MB when copying to local<src>
file or directory path on the local filesystem<remoteDst>
file or directory path on the Alluxio filesystem
For example, copyFromLocal
can be used as a quick way to inject data into the system for processing:
copyToLocal
The copyToLocal
command copies a file in Alluxio to the local file system. If a directory is specified, the directory and all its contents will be copied recursively.
Usage: copyToLocal [--buffersize <bytes>] <src> <localDst>
--buffersize <bytes>
(optional) file transfer buffer size in bytes<src>
file or directory path on the Alluxio filesystem<localDst>
file or directory path on the local filesystem
For example, copyToLocal
can be used as a quick way to download output data for additional investigation or debugging.
count
The count
command outputs the number of files and folders matching a prefix as well as the total size of the files. count
works recursively and accounts for any nested directories and files.
Usage: count [-h] <dir>
-h
(optional) print sizes in human readable format (e.g. 1KB 234MB 2GB)<dir>
file or directory path in the Alluxio filesystem
count
is best utilized when the user has some predefined naming conventions for their files. For example, if data files are stored by their date, count
can be used to determine the number of data files and their total size for any date, month, or year.
cp
The cp
command copies a file or directory in the Alluxio file system or between the local file system and Alluxio file system.
Scheme file://
indicates the local file system whereas scheme alluxio://
or no scheme indicates the Alluxio file system.
If the -R
option is used and the source designates a directory, cp
copies the entire subtree at source to the destination.
Usage: cp [--thread <num>] [--buffersize <bytes>] [--preserve] <src> <dst>
--thread <num>
(optional) Number of threads used to copy files in parallel, default value is CPU cores * 2--buffersize <bytes>
(optional) Read buffer size in bytes, default is 8MB when copying from local and 64MB when copying to local--preserve
(optional) Preserve file permission attributes when copying files. All ownership, permissions and ACLs will be preserved.<src>
source file or directory path<dst>
destination file or directory path
For example, cp
can be used to copy files between under storage systems.
distributedCp
The distributedCp
command copies a file or directory in the Alluxio file system distributed across workers using the job service. By default, the command runs synchronously and the user will get a JOB_CONTROL_ID
after the command successfully submits the job to be executed. The command will wait until the job is complete, at which point the user will see the list of files copied and statistics on which files completed or failed. The command can also run in async mode with the --async
flag. Similar to before, the user will get a JOB_CONTROL_ID
after the command successfully submits the job. The difference is that the command will not wait for the job to finish. Users can use the getCmdStatus
command with the JOB_CONTROL_ID
as an argument to check detailed status information about the job.
If the source designates a directory, distributedCp
copies the entire subtree at source to the destination.
Options:
--active-jobs
: Limits how many jobs can be submitted to the Alluxio job service at the same time. Later jobs must wait until some earlier jobs to finish. The default value is3000
. A lower value means slower execution but also being nicer to the other users of the job service.--overwrite
: Whether to overwrite the destination. Default is true.--batch-size
: Specifies how many files to be batched into one request. The default value is20
. Notice that if some task failed in the batched job, the whole batched job would fail with some completed tasks and some failed tasks.--async
: Specifies whether to wait for command execution to finish. If not explicitly shown then default to run synchronously.
Please note below are known limitations for the distributed copy command.
Limited Scalability: No more than 1 million total number of files should be moved concurrently. Note that a copy job may stay active for a short period after the last file is copied.
Manual Integrity Validation: Verification between source and destination files relies on the response code from the underlying data lake storage. In case the response code is unreliable, we recommend manual verification of source and destination checksums.
Manual Cleanup: In certain failure scenarios, a user may need to manually remove partially written contents in destination directories and restart the failed jobs.
Limited Observability: Status checks are limited to using the command line for each job individually.
du
The du
command outputs the total size and amount stored in Alluxio of files and folders. If a directory is specified, it will display the sizes of all files in this directory.
Usage: du [-s] [-h] [--memory] [-g] <dir>
-s
(optional) display the aggregate summary of file lengths being displayed-h
(optional) print sizes in human readable format (e.g. 1KB 234MB 2GB)-m,--memory
(optional) display the in memory size and in memory percentage-g
(optional) display information for In-Alluxio data size under the path, grouped by worker<dir>
file or directory path in the Alluxio filesystem
free
The free
command sends a request to the master to evict all blocks of a file from the Alluxio workers. If the argument to free
is a directory, it will recursively free
all files. This request is not guaranteed to take effect immediately, as readers may be currently using the blocks of the file. free
will return immediately after the request is acknowledged by the master. Note that files must be already persisted in under storage before being freed or the free
command will fail. Any pinned files cannot be freed unless -f
option is specified. The free
command does not delete any data from the under storage system, only removing the blocks of those files in Alluxio space to reclaim space. Metadata is not affected by this operation; a freed file will still show up if an ls
command is run.
Usage: free [-f]
-f
force to free files even pinned
For example, free
can be used to manually manage Alluxio's data caching.
getCapacityBytes
The getCapacityBytes
command returns the maximum number of bytes Alluxio is configured to store.
For example, getCapacityBytes
can be used to verify if your cluster is set up as expected.
getCmdStatus
The getCmdStatus
command returns the detailed distributed command status based on a given JOB_CONTROL_ID. The detailed status includes:
Successfully loaded or copied file paths.
Statistics on the number of successful and failed file paths.
Failed file paths, logged in a separate csv file.
For example, getCmdStatus
can be used to check what files are loaded in a distributed command, and how many succeeded or failed.
getfacl
The getfacl
command returns the ACL entries for a specified file or directory.
For example, getfacl
can be used to verify that an ACL is changed successfully after a call to setfacl
.
getSyncPathList
The getSyncPathList
command gets all the paths that are under active syncing right now.
getUsedBytes
The getUsedBytes
command returns the number of used bytes in Alluxio.
For example, getUsedBytes
can be used to monitor the health of the cluster.
head
The head
command prints the first 1 KB of data in a file to the console.
Using the -c [bytes]
option will print the first n
bytes of data to the console.
help
The help
command prints the help message for a given fs
subcommand. If the given command does not exist, it prints help messages for all supported subcommands.
Examples:
leader
The leader
command prints the current Alluxio leading master hostname.
load
The load
command moves data from the under storage system into Alluxio storage. For example, load
can be used to prefetch data for analytics jobs. If load
is run on a directory, files in the directory will be recursively loaded.
Options:
--bandwidth
option specify how much ufs bandwidth we want to use to load files.--verify
option specify whether we want to verify that all the files are loaded.--partial-listing
option specify using batch listStatus API or traditional listStatus. We would retire this option when batch listStatus API gets mature.
After submit the command, you can check the status by running the following
And you would get the following output:
Options:
--format
option specify output format. TEXT as default--verbose
option output job details.
If you want to stop the command by running the following
If you just want sequential execution for couple files. You can use the following old version
If there is a Alluxio worker on the machine this command is run from, the data will be loaded to that worker. Otherwise, a random worker will be selected to serve the data.
If the data is already loaded into Alluxio, load is a no-op unless the --local flag
is used. The --local
flag forces the data to be loaded to a local worker even if the data is already available on a remote worker.
loadMetadata
The loadMetadata
command loads metadata about a path in the UFS to Alluxio. No data will be transferred.
loadMetadata V1(legacy)
This command is a client-side optimization without storing all returned ls
results, preventing OOM for massive amount of small files. This is useful when data has been added to the UFS outside of Alluxio and users are expected to reference the new data. This command is more efficient than using the ls
command since it does not store any directory or file information to be returned.
Options:
-R
option recursively loads metadata in subdirectories-F
option updates the metadata of the existing file forcibly
For example, loadMetadata
can be used to load metadata for a path in the UFS. The -F option will force the loading of metadata even if there are existing metadata entries for the path.
loadMetadata V2(new)
The load metadata v2 is a better implementation of metadata sync that designs for object storage (e.g. s3), with better resource control and performance. To use the v2 implementation, please attach the option -v2
in your command. -F
is no longer supported in v2. The command will always load the metadata from UFS. If files are in alluxio already, they will be compared with and updated based on the UFS result. The v2 implementation also has some unique options:
Options:
-d <type>
option that determines how alluxio will load metadata of subdirectories, if a recursive loading is required. Possible values:SINGLE_LISTING (default): Loads the file infos from UFS using a single listing. Use this mode if the directory does not contain or only contains few subdirectories. This mode gives you better reliability. This mode is only allowed on some object storage where single listing is allowed (e.g. ListObjectsV2 in s3).
BFS: Loads the file infos on a directory basis; Creates a new job to load the subdirectory; Use this mode if your UFS directory contains many subdirectories. This mode loads the metadata for each subdirectory concurrently and gives you the best performance. Note that this is only an approximate BFS, as batches are processed and loaded concurrently and may be loaded in different orders.
DFS: Loads the file infos directory by directory, in a DFS way. Note that this is only an approximate DFS, as batches are processed and loaded concurrently and may be loaded in different orders.
-R
option recursively loads metadata in subdirectories-a/--async
If specified, the metadata loading states are pulled and printed every couple of seconds until the sync job is finished. Otherwise, the command line is blocked until the sync job is finished. Note that regardless this option is specified or not, the metadata sync task is processed asynchronously by alluxio master and this option only changes the behavior of display. Hence closing the terminal or CTRL+C do not cancel the sync job.
If -a
is used, the console will print the task group id when the task is submitted. A task will be created for each mount point in the sync root. One can use the task group id to get the metadata load progress or cancel the load.
To get the status a task group, use
To cancel the task group, use
location
The location
command returns the addresses of all the Alluxio workers which contain blocks belonging to the given file.
For example, location
can be used to debug data locality when running jobs using a compute framework.
ls
The ls
command lists all the immediate children in a directory and displays the file size, last modification time, and in memory status of the files. Using ls
on a file will only display the information for that specific file.
The ls
command will also load the metadata for any file or immediate children of a directory from the under storage system to Alluxio namespace if it does not exist in Alluxio. ls
queries the under storage system for any file or directory matching the given path and creates a mirror of the file in Alluxio backed by that file. Only the metadata, such as the file name and size, are loaded this way and no data transfer occurs.
Options:
-d
option lists the directories as plain files. For example,ls -d /
shows the attributes of root directory.-f
option forces loading metadata for immediate children in a directory. By default, it loads metadata only at the first time at which a directory is listed.-f
is equivalent to-Dalluxio.user.file.metadata.sync.interval=0
.-h
option displays file sizes in human-readable formats.-p
option lists all pinned files.-R
option also recursively lists child directories, displaying the entire subtree starting from the input path.--sort
sorts the result by the given option. Possible values are size, creationTime, inMemoryPercentage, lastModificationTime, lastAccessTime and path.-r
reverses the sorting order.--timestamp
display the timestamp of the given option. Possible values are creationTime, lastModificationTime, and lastAccessTime. The default option is lastModificationTime.-m
option excludes mount point related information.
For example, ls
can be used to browse the file system.
Metadata sync is an expensive operation. A rough estimation is metadata sync on 1 million files will consume 2GB heap until the sync operation is complete. Therefore, we recommend not using forced sync to avoid accidental repeated sync operations. It is recommended to always specify a non-zero sync interval for metadata sync, so even if the sync is repeatedly triggered, the paths that have just been sync-ed can be identified and skipped.
masterInfo
The masterInfo
command prints information regarding master fault tolerance such as leader address, list of master addresses, and the configured Zookeeper address. If Alluxio is running in single master mode, masterInfo
prints the master address. If Alluxio is running in fault tolerance mode, the leader address, list of master addresses and the configured Zookeeper address is printed.
For example, masterInfo
can be used to print information regarding master fault tolerance.
mkdir
The mkdir
command creates a new directory in Alluxio space. It is recursive and will create any nonexistent parent directories. Note that the created directory will not be created in the under storage system until a file in the directory is persisted to the underlying storage. Using mkdir
on an invalid or existing path will fail.
For example, mkdir
can be used by an admin to set up the basic folder structures.
mount
The mount
command links an under storage path to an Alluxio path, where files and folders created in Alluxio space under the path will be backed by a corresponding file or folder in the under storage path. For more details, see Unified Namespace.
Options:
--option <key>=<val>
option passes an property to this mount point, such as S3 credentials--readonly
option sets the mount point to be readonly in Alluxio--shared
option sets the permission bits of the mount point to be accessible for all Alluxio users
Note that --readonly
mounts are useful to prevent accidental write operations. If multiple Alluxio satellite clusters mount a remote storage cluster which serves as the central source of truth, --readonly
option could help prevent any write operations on the satellite cluster from wiping out the remote storage.
For example, mount
can be used to make data in another storage system available in Alluxio.
To connect to the UFS for a mount point, Alluxio looks for the corresponding connector under ${ALLUXIO_HOME}/lib/
and will use the first one that supports the path. The connector jars look like lib/alluxio-underfs-hdfs-2.7.1.jar
. The logic to decide whether a connector supports a path depends on the UnderFileSystemFactory
implementation. When there are multiple connectors for the same UFS, like lib/alluxio-underfs-hdfs-2.7.1.jar
, lib/alluxio-underfs-hdfs-2.7.1-patch1.jar
, lib/alluxio-underfs-hdfs-2.7.1-patch2.jar
, option alluxio.underfs.strict.version.match.enabled
can be used to make sure the correct one is picked up. For example, if the HDFS is running with 2.7.1-patch1, you can use alluxio.underfs.version
and alluxio.underfs.strict.version.match.enabled=true
to ensure lib/alluxio-underfs-hdfs-2.7.1-patch1.jar
is used to connect to the target HDFS at hdfs://ns1/
.
mv
The mv
command moves a file or directory to another path in Alluxio. The destination path must not exist or be a directory. If it is a directory, the file or directory will be placed as a child of the directory. mv
is purely a metadata operation and does not affect the data blocks of the file. mv
cannot be done between mount points of different under storage systems.
For example, mv
can be used to re-organize your files.
needsSync
The needsSync
command marks a path in Alluxio as needing synchronization with the UFS. The next time the path or any child path is accessed by a file system operation the metadata for that path will be synchronized with the UFS. Note that the metadata will not be synchronized immediately, the synchronization will only happen on each path when it is accessed.
Usage needsSync <path>
For example, needsSync
can be used after a set of files have been modified on the UFS outside Alluxio and those changes should be visible the next time the files are accessed.
persist
The persist
command persists data in Alluxio storage into the under storage system. This is a server side data operation and will take time depending on how large the file is. After persist is complete, the file in Alluxio will be backed by the file in the under storage, and will still be available if the Alluxio blocks are evicted or otherwise lost.
Usage: persist [-p <parallelism>] [-t <timeout>] [-w <wait time>] <dir>
-p,--parallelism <parallelism>]
(optional) Number of concurrent persist operations. (Default: 4)-t,--timeout <timeout>
(optional) Time in milliseconds for a single file persist to time out. (Default: 20 minutes)-w,--wait <wait time>
(optional) The time to wait in milliseconds before persisting. (Default: 0)<dir>
file or directory path in the Alluxio filesystem
If you are persisting multiple files, you can use the --parallelism <#>
option to submit #
of persist commands in parallel. For example, if your folder has 10,000 files, persisting with a parallelism factor of 10 will persist 10 files at a time until all 10,000 files are persisted.
For example, persist
can be used after filtering a series of temporary files for the ones containing useful data.
pin
The pin
command marks a file or folder as pinned in Alluxio. This is a metadata operation and will not cause any data to be loaded into Alluxio. If a file is pinned, any blocks belonging to the file will never be evicted from an Alluxio worker. If there are too many pinned files, Alluxio workers may run low on storage space, preventing other files from being cached.
For example, pin
can be used to manually ensure performance if the administrator understands the workloads well.
rm
The rm
command removes a file from Alluxio space and the under storage system. The file will be unavailable immediately after this command returns, but the actual data may be deleted a while later.
Adding
-R
option deletes all contents of the directory and the directory itself.Adding
-U
option skips the check for whether the UFS contents being deleted are in-sync with Alluxio before attempting to delete persisted directories. We recommend always using the-U
option for the best performance and resource efficiency.Adding
--alluxioOnly
option removes data and metadata from Alluxio space only. The under storage system will not be affected.
When deleting only from Alluxio but leaving the files in UFS, we recommend using -U
and -Dalluxio.user.file.metadata.sync.interval=-1
to skip the metadata sync and the UFS check. This will save time and memory consumption on the Alluxio master.
When deleting a large directory (with millions of files) recursively both from Alluxio and UFS, the operation is expensive.
We recommend doing the deletion in the following way:
Perform a direct sanity check against the UFS path with the corresponding file system API or CLI to make sure everything can be deleted safely. For example if the UFS is HDFS, use
hdfs dfs -ls -R /dir
to list the UFS files and check. We do not recommend doing this sanity check from Alluxio using a command likealluxio fs ls -R -f /dir
, because the loaded file metadata will be deleted anyway, and the expensive metadata sync operation will essentially be wasted.Issue the deletion from Alluxio to delete files from both Alluxio and the UFS:
Per 1 million files deleted, the memory overhead can be estimated as follows:
If both metadata sync and UFS check are disabled, recursively deleting from Alluxio only will hold 2GB JVM heap memory until the deletion completes.
If files are also deleted from UFS, there will not be extra heap consumption but the operation will take longer to complete.
If metadata sync is enabled, there will be another around 2GB overhead on the JVM heap until the operation completes.
If UFS check is enabled, there will another around 2GB overhead on the JVM heap until the operation completes.
Using this example as a guideline, estimate the total additional memory overhead as a proportion to the number of files to be deleted. Ensure that the leading master has sufficient available heap memory to perform the operation before issuing a large recursive delete command. A general good practice is to break deleting a large directory into deleting each individual children directories.
setfacl
The setfacl
command modifies the access control list associated with a specified file or directory.
The
-R
option applies operations to all files and directories recursively.The
set
option fully replaces the ACL while discarding existing entries. New ACL must be a comma separated list of entries, and must include user, group, and other for compatibility with permission bits.The
-m
option modifies the ACL by adding/overwriting new entries.The
-x
option removes specific ACL entries.The
-b
option removes all ACL entries, except for the base entries.The
-d
option indicates that operations apply to the default ACLThe
-k
option removes all the default ACL entries.
For example, setfacl
can be used to give read and execute permissions to a user named testuser
.
setReplication
The setReplication
command sets the max and/or min replication level of a file or all files under a directory recursively. This is a metadata operation and will not cause any replication to be created or removed immediately. The replication level of the target file or directory will be changed automatically in background.
The
--min
option specifies the minimal replication levelThe
--max
optional specifies the maximal replication level. Specify -1 as the argument of--max
option to indicate no limit of the maximum number of replicas.If the specified path is a directory and
-R
is specified, it will recursively set all files in this directory.
For example, setReplication
can be used to ensure the replication level of a file has at least one copy and at most three copies in Alluxio:
setTtl
The setTtl
command sets the time-to-live of a file or a directory, in milliseconds. If set TTL is run on a directory, the same TTL attributes is set on all its children. If a directory's TTL expires, all its children will also expire.
Action parameter --action
will indicate the action to perform once the file or directory expires. The default action, delete, deletes the file or directory from both Alluxio and the under storage system, whereas the action free
frees the file from Alluxio even if pinned.
For example, setTtl
with action delete
cleans up files the administrator knows are unnecessary after a period of time, or with action free
just remove the contents from Alluxio to make room for more space in Alluxio.
startSync
The startSync
command starts the automatic syncing process of the specified path.
stat
The stat
command dumps the FileInfo representation of a file or a directory to the console. It is primarily intended to assist power users in debugging their system. Generally viewing the file info in the UI will be easier to understand.
One can specify -f <arg>
to display info in given format:
%N
: name of the file%z
: size of file in bytes%u
: owner%g
: group name of owner%y
or%Y
: modification time, where%y
shows the UTC date in the formyyyy-MM-dd HH:mm:ss
and%Y
shows the number of milliseconds since January 1, 1970 UTC%b
: Number of blocks allocated for file%i
: file ID(inode ID) of the file
For example, stat
can be used to debug the block locations of a file. This is useful when trying to achieve locality for compute workloads.
stopSync
The stopSync
command stops the automatic syncing process of the specified path.
tail
The tail
command outputs the last 1 KB of data in a file to the console. Using the -c [bytes]
option will print the last n
bytes of data to the console.
For example, tail
can be used to verify the output of a job is in the expected format or contains expected values.
test
The test
command tests a property of a path, returning 0
if the property is true or 1
otherwise.
Options:
-d
option tests whether path is a directory.-e
option tests whether path exists.-f
option tests whether path is a file.-s
option tests whether path is not empty.-z
option tests whether file is zero length.
Examples:
touch
The touch
command creates a 0-byte file. Files created with touch
cannot be overwritten and are mostly useful as flags.
For example, touch
can be used to create a file signifying the completion of analysis on a directory.
unmount
The unmount
command disassociates an Alluxio path with an under storage directory. Alluxio metadata for the mount point is removed along with any data blocks, but the under storage system will retain all metadata and data. See Unified Namespace for more details.
For example, unmount
can be used to remove an under storage system when the users no longer need data from that system.
If there are files under the mount point, the unmount
operation will implicitly delete those files from Alluxio. See the rm command for how to estimate the memory consumption. It is recommended to remove those files in Alluxio first, before the unmount
.
unpin
The unpin
command unmarks a file or directory in Alluxio as pinned. This is a metadata operation and will not evict or delete any data blocks. Once a file is unpinned, its data blocks can be evicted from the various Alluxio workers containing the block.
For example, unpin
can be used when the administrator knows there is a change in the data access pattern.
unsetTtl
The unsetTtl
command will remove the TTL attributes of a file or directory in Alluxio. This is a metadata operation and will not evict or store blocks in Alluxio. The TTL of a file can later be reset with setTtl
.
For example, unsetTtl
can be used if a regularly managed file requires manual management.
updateMount
The updateMount
command updates options for a mount point while keeping the Alluxio metadata under the path.
Usage: updateMount [--readonly] [--shared] [--option <key=val>] <alluxioPath>
--readonly
(optional) mount point is readonly in Alluxio--shared
(optional) mount point is shared--option <key>=<val>
(optional) options for this mount point. For security reasons, no options from existing mount point will be inherited.<alluxioPath>
Directory path in the Alluxio filesystem
Last updated