<tdalign="left"> The command of the project being invoked. For example, Hadoop common uses <code>hadoop</code>, HDFS uses <code>hdfs</code>, and YARN uses <code>yarn</code>. </td></tr>
<trclass="a">
<tdalign="left"> SHELL_OPTIONS </td>
<tdalign="left"> Options that the shell processes prior to executing Java. </td></tr>
<trclass="b">
<tdalign="left"> COMMAND </td>
<tdalign="left"> Action to perform. </td></tr>
<trclass="a">
<tdalign="left"> GENERIC_OPTIONS </td>
<tdalign="left"> The common set of options supported by multiple commands. </td></tr>
<trclass="b">
<tdalign="left"> COMMAND_OPTIONS </td>
<tdalign="left"> Various commands with their options are described in this documention for the Hadoop common sub-project. HDFS and YARN are covered in other documents. </td></tr>
</tbody>
</table><section>
<h3><aname="Shell_Options"></a>Shell Options</h3>
<p>All of the shell commands will accept a common set of options. For some commands, these options are ignored. For example, passing <code>---hostnames</code> on a command that only executes on a single host will be ignored.</p>
<tableborder="0"class="bodyTable">
<thead>
<trclass="a">
<thalign="left"> SHELL_OPTION </th>
<thalign="left"> Description </th></tr>
</thead><tbody>
<trclass="b">
<tdalign="left"><code>--buildpaths</code></td>
<tdalign="left"> Enables developer versions of jars. </td></tr>
<tdalign="left"> Overwrites the default Configuration directory. Default is <code>$HADOOP_HOME/etc/hadoop</code>. </td></tr>
<trclass="b">
<tdalign="left"><code>--daemon mode</code></td>
<tdalign="left"> If the command supports daemonization (e.g., <code>hdfs namenode</code>), execute in the appropriate mode. Supported modes are <code>start</code> to start the process in daemon mode, <code>stop</code> to stop the process, and <code>status</code> to determine the active status of the process. <code>status</code> will return an <aclass="externalLink"href="http://refspecs.linuxbase.org/LSB_3.0.0/LSB-generic/LSB-generic/iniscrptact.html">LSB-compliant</a> result code. If no option is provided, commands that support daemonization will run in the foreground. For commands that do not support daemonization, this option is ignored. </td></tr>
<trclass="a">
<tdalign="left"><code>--debug</code></td>
<tdalign="left"> Enables shell level configuration debugging information </td></tr>
<tdalign="left"> When <code>--workers</code> is used, override the workers file with a space delimited list of hostnames where to execute a multi-host subcommand. If <code>--workers</code> is not used, this option is ignored. </td></tr>
<trclass="b">
<tdalign="left"><code>--hosts</code></td>
<tdalign="left"> When <code>--workers</code> is used, override the workers file with another file that contains a list of hostnames where to execute a multi-host subcommand. If <code>--workers</code> is not used, this option is ignored. </td></tr>
<tdalign="left"> Use value for given property. </td></tr>
<trclass="a">
<tdalign="left"><code>-files <comma separated list of files></code></td>
<tdalign="left"> Specify comma separated files to be copied to the map reduce cluster. Applies only to job. </td></tr>
<trclass="b">
<tdalign="left"><code>-fs <file:///> or <hdfs://namenode:port></code></td>
<tdalign="left"> Specify default filesystem URL to use. Overrides ‘fs.defaultFS’ property from configurations. </td></tr>
<trclass="a">
<tdalign="left"><code>-jt <local> or <resourcemanager:port></code></td>
<tdalign="left"> Specify a ResourceManager. Applies only to job. </td></tr>
<trclass="b">
<tdalign="left"><code>-libjars <comma separated list of jars></code></td>
<tdalign="left"> Specify comma separated jar files to include in the classpath. Applies only to job. </td></tr>
</tbody>
</table>
<h1>Hadoop Common Commands</h1>
<p>All of these commands are executed from the <code>hadoop</code> shell command. They have been broken up into <ahref="#User_Commands">User Commands</a> and <ahref="#Administration_Commands">Administration Commands</a>.</p></section></section><section>
<h2><aname="User_Commands"></a>User Commands</h2>
<p>Commands useful for users of a hadoop cluster.</p><section>
<p>Creates a hadoop archive. More information can be found at <ahref="../../hadoop-archives/HadoopArchives.html">Hadoop Archives Guide</a>.</p></section><section>
<tdalign="left"> Check all libraries are available. </td></tr>
<trclass="a">
<tdalign="left"><code>-h</code></td>
<tdalign="left"> print help </td></tr>
</tbody>
</table>
<p>This command checks the availability of the Hadoop native code. See <ahref="./NativeLibraries.html">Native Libaries</a> for more information. By default, this command only checks the availability of libhadoop.</p></section><section>
<p>Prints the class path needed to get the Hadoop jar and the required libraries. If called without arguments, then prints the classpath set up by the command scripts, which is likely to contain wildcards in the classpath entries. Additional options print the classpath after wildcard expansion or write the classpath into the manifest of a jar file. The latter is useful in environments where wildcards cannot be used and the expanded classpath exceeds the maximum supported command line length.</p></section><section>
<p>Validates configuration XML files. If the <code>-conffile</code> option is not specified, the files in <code>${HADOOP_CONF_DIR}</code> whose name end with .xml will be verified. If specified, that path will be verified. You can specify either a file or directory, and if a directory specified, the files in that directory whose name end with <code>.xml</code> will be verified. You can specify <code>-conffile</code> option multiple times.</p>
<p>The validation is fairly minimal: the XML is parsed and duplicate and empty property names are checked for. The command does not support XInclude; if you using that to pull in configuration items, it will declare the XML file invalid.</p></section><section>
<tdalign="left"> Prompts the user for a credential to be stored as the given alias. The <i>hadoop.security.credential.provider.path</i> within the core-site.xml file will be used unless a <code>-provider</code> is indicated. The <code>-strict</code> flag will cause the command to fail if the provider uses a default password. Use <code>-value</code> flag to supply the credential value (a.k.a. the alias password) instead of being prompted. </td></tr>
<tdalign="left"> Deletes the credential with the provided alias. The <i>hadoop.security.credential.provider.path</i> within the core-site.xml file will be used unless a <code>-provider</code> is indicated. The <code>-strict</code> flag will cause the command to fail if the provider uses a default password. The command asks for confirmation unless <code>-f</code> is specified </td></tr>
<trclass="b">
<tdalign="left"> list [-provider <i>provider-path</i>] [-strict] </td>
<tdalign="left"> Lists all of the credential aliases The <i>hadoop.security.credential.provider.path</i> within the core-site.xml file will be used unless a <code>-provider</code> is indicated. The <code>-strict</code> flag will cause the command to fail if the provider uses a default password. </td></tr>
<tdalign="left"> Check the password for the given alias. The <i>hadoop.security.credential.provider.path</i> within the core-site.xml file will be used unless a <code>-provider</code> is indicated. The <code>-strict</code> flag will cause the command to fail if the provider uses a default password. </td></tr>
</tbody>
</table>
<p>Command to manage credentials, passwords and secrets within credential providers.</p>
<p>The CredentialProvider API in Hadoop allows for the separation of applications and how they store their required passwords/secrets. In order to indicate a particular provider type and location, the user must provide the <i>hadoop.security.credential.provider.path</i> configuration element in core-site.xml or use the command line option <code>-provider</code> on each of the following commands. This provider path is a comma-separated list of URLs that indicates the type and location of a list of providers that should be consulted. For example, the following path: <code>user:///,jceks://file/tmp/test.jceks,jceks://hdfs@nn1.example.com/my/path/test.jceks</code></p>
<p>indicates that the current user’s credentials file should be consulted through the User Provider, that the local file located at <code>/tmp/test.jceks</code> is a Java Keystore Provider and that the file located within HDFS at <code>nn1.example.com/my/path/test.jceks</code> is also a store for a Java Keystore Provider.</p>
<p>When utilizing the credential command it will often be for provisioning a password or secret to a particular credential store provider. In order to explicitly indicate which provider store to use the <code>-provider</code> option should be used. Otherwise, given a path of multiple providers, the first non-transient provider will be used. This may or may not be the one that you intended.</p>
<p>Providers frequently require that a password or other secret is supplied. If the provider requires a password and is unable to find one, it will use a default password and emit a warning message that the default password is being used. If the <code>-strict</code> flag is supplied, the warning message becomes an error message and the command returns immediately with an error status.</p>
<p>Example: <code>hadoop credential list -provider jceks://file/tmp/test.jceks</code></p></section><section>
<tdalign="left"> List of objects to change </td></tr>
<trclass="a">
<tdalign="left"><code>-i</code></td>
<tdalign="left"> Ignore failures </td></tr>
<trclass="b">
<tdalign="left"><code>-log</code></td>
<tdalign="left"> Directory to log output </td></tr>
</tbody>
</table>
<p>Change the ownership and permissions on many files at once.</p></section><section>
<h3><aname="distcp"></a><code>distcp</code></h3>
<p>Copy file or directories recursively. More information can be found at <ahref="../../hadoop-distcp/DistCp.html">Hadoop DistCp Guide</a>.</p></section><section>
<p>Utility to fetch and manage hadoop delegation tokens inside credentials files. It is intended to replace the simpler command <code>fetchdt</code>. There are multiple subcommands, each with their own flags and options.</p>
<p>For every subcommand that writes out a file, the <code>-format</code> option will specify the internal format to use. <code>java</code> is the legacy format that matches <code>fetchdt</code>. The default is <code>protobuf</code>.</p>
<p>For every subcommand that connects to a service, convenience flags are provided to specify the kerberos principal name and keytab file to use for auth.</p>
<tdalign="left"> Print out the fields in the tokens contained in <i>filename</i> (and <i>filename2</i>…). <br/> If <i>alias</i> is specified, print only tokens matching <i>alias</i>. Otherwise, print all tokens. </td></tr>
<tdalign="left"> Fetch a token from service at <i>URL</i> and place it in <i>filename</i>. <br/><i>URL</i> is required and must immediately follow <code>get</code>.<br/><i>URL</i> is the service URL, e.g. <i>hdfs://localhost:9000</i>. <br/><i>alias</i> will overwrite the service field in the token. <br/> It is intended for hosts that have external and internal names, e.g. <i>firewall.com:14000</i>. <br/><i>filename</i> should come last and is the name of the token file. <br/> It will be created if it does not exist. Otherwise, token(s) are added to existing file. <br/> The <code>-service</code> flag should only be used with a URL which starts with <code>http</code> or <code>https</code>. <br/> The following are equivalent: <i>hdfs://localhost:9000/</i> vs. <i>http://localhost:9000</i><code>-service</code><i>hdfs</i></td></tr>
<tdalign="left"> Append the contents of the first N filenames onto the last filename. <br/> When tokens with common service fields are present in multiple files, earlier files’ tokens are overwritten. <br/> That is, tokens present in the last file are always preserved. </td></tr>
<tdalign="left"> From each file specified, remove the tokens matching <i>alias</i> and write out each file using specified format. <br/><i>alias</i> must be specified. </td></tr>
<tdalign="left"> Just like <code>remove</code>, except the tokens are also cancelled using the service specified in the token object. <br/><i>alias</i> must be specified. </td></tr>
<tdalign="left"> For each file specified, renew the tokens matching <i>alias</i> and write out each file using specified format. <br/><i>alias</i> must be specified. </td></tr>
<tdalign="left"> Import a token from a base64 token. <br/><i>alias</i> will overwrite the service field in the token. </td></tr>
</tbody>
</table></section><section>
<h3><aname="fs"></a><code>fs</code></h3>
<p>This command is documented in the <ahref="./FileSystemShell.html">File System Shell Guide</a>. It is a synonym for <code>hdfs dfs</code> when HDFS is in use.</p></section><section>
<p>Gridmix is a benchmark tool for Hadoop cluster. More information can be found in the <ahref="../../hadoop-gridmix/GridMix.html">Gridmix Guide</a>.</p></section><section>
<h3><aname="jar"></a><code>jar</code></h3>
<p>Usage: <code>hadoop jar <jar> [mainClass] args...</code></p>
<p>Runs a jar file.</p>
<p>Use <ahref="../../hadoop-yarn/hadoop-yarn-site/YarnCommands.html#jar"><code>yarn jar</code></a> to launch YARN applications instead.</p></section><section>
<tdalign="left"> Creates a new key for the name specified by the <i>keyname</i> argument within the provider specified by the <code>-provider</code> argument. The <code>-strict</code> flag will cause the command to fail if the provider uses a default password. You may specify a cipher with the <code>-cipher</code> argument. The default cipher is currently “AES/CTR/NoPadding”. The default keysize is 128. You may specify the requested key length using the <code>-size</code> argument. Arbitrary attribute=value style attributes may be specified using the <code>-attr</code> argument. <code>-attr</code> may be specified multiple times, once per attribute. </td></tr>
<trclass="a">
<tdalign="left"> roll <i>keyname</i> [-provider <i>provider</i>] [-strict] [-help] </td>
<tdalign="left"> Creates a new version for the specified key within the provider indicated using the <code>-provider</code> argument. The <code>-strict</code> flag will cause the command to fail if the provider uses a default password. </td></tr>
<tdalign="left"> Deletes all versions of the key specified by the <i>keyname</i> argument from within the provider specified by <code>-provider</code>. The <code>-strict</code> flag will cause the command to fail if the provider uses a default password. The command asks for user confirmation unless <code>-f</code> is specified. </td></tr>
<trclass="a">
<tdalign="left"> list [-provider <i>provider</i>] [-strict] [-metadata] [-help] </td>
<tdalign="left"> Displays the keynames contained within a particular provider as configured in core-site.xml or specified with the <code>-provider</code> argument. The <code>-strict</code> flag will cause the command to fail if the provider uses a default password. <code>-metadata</code> displays the metadata. </td></tr>
<tdalign="left"> Check password of the <i>keyname</i> contained within a particular provider as configured in core-site.xml or specified with the <code>-provider</code> argument. The <code>-strict</code> flag will cause the command to fail if the provider uses a default password. </td></tr>
</tbody>
</table>
<p>| -help | Prints usage of this command |</p>
<p>Manage keys via the KeyProvider. For details on KeyProviders, see the <ahref="../hadoop-hdfs/TransparentEncryption.html">Transparent Encryption Guide</a>.</p>
<p>Providers frequently require that a password or other secret is supplied. If the provider requires a password and is unable to find one, it will use a default password and emit a warning message that the default password is being used. If the <code>-strict</code> flag is supplied, the warning message becomes an error message and the command returns immediately with an error status.</p>
<p>NOTE: Some KeyProviders (e.g. org.apache.hadoop.crypto.key.JavaKeyStoreProvider) do not support uppercase key names.</p>
<p>NOTE: Some KeyProviders do not directly execute a key deletion (e.g. performs a soft-delete instead, or delay the actual deletion, to prevent mistake). In these cases, one may encounter errors when creating/deleting a key with the same name after deleting it. Please check the underlying KeyProvider for details.</p></section><section>
<h3><aname="kms"></a><code>kms</code></h3>
<p>Usage: <code>hadoop kms</code></p>
<p>Run KMS, the Key Management Server.</p></section><section>
<tdalign="left"> Prints the log level of the log identified by a qualified <i>classname</i>, in the daemon running at <i>host:port</i>. The <code>-protocol</code> flag specifies the protocol for connection. </td></tr>
<tdalign="left"> Sets the log level of the log identified by a qualified <i>classname</i>, in the daemon running at <i>host:port</i>. The <code>-protocol</code> flag specifies the protocol for connection. </td></tr>
</tbody>
</table>
<p>Get/Set the log level for a Log identified by a qualified class name in the daemon dynamically. By default, the command sends a HTTP request, but this can be overridden by using argument <code>-protocol https</code> to send a HTTPS request.</p>
<p>Note that the setting is not permanent and will be reset when the daemon is restarted. This command works by sending a HTTP/HTTPS request to the daemon’s internal Jetty servlet, so it supports the following daemons:</p>
<p>This stores the personal environment for an individual user. It is processed after the hadoop-env.sh and hadoop-user-functions.sh files and can contain the same settings.</p></section></section>