HDFS CLI

Overview

This section includes the reference documentation for the HDFS shell CLI. Using hdfs commands without any arguments outputs a description for all these commands.

The usage is as follows:

$ hdfs [SHELL_OPTIONS] COMMAND [GENERIC_OPTIONS] [COMMAND_OPTIONS]

Hadoop has an option parsing framework that employs parsing generic options as well as running classes.

Hadoop shell basic structure

SHELL_OPTIONS

The common set of shell options

GENERIC_OPTIONS

The common set of options supported by multiple commands

COMMAND_OPTIONS

Various commands with their options are described in the following sections

User commands

These commands are helpful for users of a Hadoop cluster.

Command Description

classpath

Prints the class path needed to get the Hadoop JAR and the required libraries

dfs

Runs a filesystem command on the file system supported in Hadoop

envvars

Displays computed Hadoop environment variables

fetchdt

Gets Delegation Token from a NameNode

fsck

Runs the HDFS filesystem checking utility

getconf

Gets configuration information from the configuration directory, post-processing

groups

Returns the group information given one or more usernames

httpfs

Runs HttpFS server, the HDFS HTTP Gateway

lsSnapshottableDir

Gets the list of snapshot table directories

jmxget

Dumps JMX information from a service

oev

Hadoop offline edits viewer

oiv

Hadoop Offline Image Viewer for image files

oiv_legacy

Hadoop Offline Image Viewer for older versions of Hadoop

snapshotDiff

Determines the difference between HDFS snapshots

version

Prints the version

Administration commands

These commands are useful for administrators of a Hadoop cluster.

Command Description

balancer

Runs a cluster balancing utility

cacheadmin

Interacts with cache pools and directives via the hdfs cacheadmin subcommand

crypto

Creates a new encryption zone

datanode

Runs an HDFS DataNode

dfsadmin

Runs an HDFS dfsadmin client

dfsrouter

Runs the DFS router

dfsrouteradmin

Manages Router-based federation

diskbalancer

Runs the disk balancer CLI

ec

Runs the ErasureCoding CLI

haadmin

Gets access to some additional commands to administer the HA HDFS cluster

journalnode

Starts a JournalNode for use with HDFS HA with QJM

mover

Runs the data migration utility

namenode

Runs the NameNode

nfs3

Starts the NFS3 gateway for use with the HDFS NFS3 Service

portmap

Starts the RPC portmap for use with the HDFS NFS3 Service

secondarynamenode

Runs the HDFS secondary NameNode

storagepolicies

Lists out all/gets/sets/unsets storage policies

zkfc

Starts a ZooKeeper Failover Controller process for use with HDFS HA with QJM

Debug commands

These commands are used to help administrators debug HDFS issues.

Command Description

computeMeta

Computes HDFS metadata from block files

recoverLease

Recovers the lease on the specified path

verifyMeta

Verifies HDFS metadata and block files

Found a mistake? Seleсt text and press Ctrl+Enter to report it