<a href="../../hadoop-mapreduce-client/hadoop-mapreduce-client-core/MapReduce_Compatibility_Hadoop1_Hadoop2.html">Compatibilty between Hadoop 1.x and Hadoop 2.x</a>
<a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy">
<img alt="Built by Maven" src="./images/logos/maven-feather.png"/>
</a>
</div>
</div>
<div id="bodyColumn">
<div id="contentBox">
<!-- Licensed to the Apache Software Foundation (ASF) under one or more --><!-- contributor license agreements. See the NOTICE file distributed with --><!-- this work for additional information regarding copyright ownership. --><!-- The ASF licenses this file to You under the Apache License, Version 2.0 --><!-- (the "License"); you may not use this file except in compliance with --><!-- the License. You may obtain a copy of the License at --><!-- --><!-- http://www.apache.org/licenses/LICENSE-2.0 --><!-- --><!-- Unless required by applicable law or agreed to in writing, software --><!-- distributed under the License is distributed on an "AS IS" BASIS, --><!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --><!-- See the License for the specific language governing permissions and --><!-- limitations under the License. --><ul>
<p>All hadoop commands are invoked by the <tt>bin/hadoop</tt> script. Running the hadoop script without any arguments prints the description for all commands.</p>
<td align="left">The common set of options supported by multiple commands. Various commands with their options are described in the following sections. The commands have been grouped into User Commands and Administration Commands.</td></tr></table></div>
<p>The following options are supported by <a href="#dfsadmin">dfsadmin</a>, <a href="#fs">fs</a>, <a href="#fsck">fsck</a>, <a href="#job">job</a> and <a href="#fetchdt">fetchdt</a>. Applications should implement <a href="../../api/org/apache/hadoop/util/Tool.html">Tool</a> to support GenericOptions.</p>
<td align="left">Prints job details, failed and killed tip details. More details about the job such as successful tasks and task attempts made for each task can be viewed by specifying the [all] option.</td></tr>
<tr class="b">
<td align="left">-list [all]</td>
<td align="left">Displays jobs which are yet to complete. <tt>-list all</tt> displays all jobs.</td></tr>
<tr class="a">
<td align="left">-kill-task <i>task-id</i></td>
<td align="left">Kills the task. Killed tasks are NOT counted against failed attempts.</td></tr>
<tr class="b">
<td align="left">-fail-task <i>task-id</i></td>
<td align="left">Fails the task. Failed tasks are counted against failed attempts.</td></tr>
<td align="left">Displays the job queue information and associated scheduling information of particular job queue. If <tt>-showJobs</tt> options is present a list of jobs submitted to the particular job queue is displayed.</td></tr>
<tr class="b">
<td align="left">-showacls</td>
<td align="left">Displays the queue name and associated queue operations allowed for the current user. The list consists of only those queues to which the user has access.</td></tr></table></div>
<p>Commands useful for administrators of a hadoop cluster.</p>
<div class="section">
<h3><tt>balancer</tt><a name="balancer"></a></h3>
<p>Runs a cluster balancing utility. An administrator can simply press Ctrl-C to stop the rebalancing process. See <a href="../hadoop-hdfs/HdfsUserGuide.html#Rebalancer">Rebalancer</a> for more details.</p>
<td align="left">Prints the log level of the daemon running at <i>host:port</i>. This command internally connects to http://<i>host:port</i>/logLevel?log=<i>name</i></td></tr>
<td align="left">Sets the log level of the daemon running at <i>host:port</i>. This command internally connects to http://<i>host:port</i>/logLevel?log=<i>name</i></td></tr></table></div>
<td align="left">Rollsback the datanode to the previous version. This should be used after stopping the datanode and distributing the old hadoop version.</td></tr></table></div>
<td align="left">Reports basic filesystem information and statistics.</td></tr>
<tr class="a">
<td align="left">-safemode enter / leave / get / wait</td>
<td align="left">Safe mode maintenance command. Safe mode is a Namenode state in which it  <br />1. does not accept changes to the name space (read-only)  <br />2. does not replicate or delete blocks.  <br />Safe mode is entered automatically at Namenode startup, and leaves safe mode automatically when the configured minimum percentage of blocks satisfies the minimum replication condition. Safe mode can also be entered manually, but then it can only be turned off manually as well.</td></tr>
<tr class="b">
<td align="left">-refreshNodes</td>
<td align="left">Re-read the hosts and exclude files to update the set of Datanodes that are allowed to connect to the Namenode and those that should be decommissioned or recommissioned.</td></tr>
<tr class="a">
<td align="left">-finalizeUpgrade</td>
<td align="left">Finalize upgrade of HDFS. Datanodes delete their previous version working directories, followed by Namenode doing the same. This completes the upgrade process.</td></tr>
<tr class="b">
<td align="left">-upgradeProgress status / details / force</td>
<td align="left">Request current distributed upgrade status, a detailed status or force the upgrade to proceed.</td></tr>
<tr class="a">
<td align="left">-metasave filename</td>
<td align="left">Save Namenode's primary data structures to <i>filename</i> in the directory specified by hadoop.log.dir property. <i>filename</i> is overwritten if it exists. <i>filename</i> will contain one line for each of the following <br />1. Datanodes heart beating with Namenode <br />2. Blocks waiting to be replicated <br />3. Blocks currrently being replicated <br />4. Blocks waiting to be deleted </td></tr>
<td align="left">Set the quota <i>quota</i> for each directory <i>dirname</i>. The directory quota is a long integer that puts a hard limit on the number of names in the directory tree. Best effort for the directory, with faults reported if  <br />1. N is not a positive integer, or  <br />2. user is not an administrator, or  <br />3. the directory does not exist or is a file, or  <br />4. the directory would immediately exceed the new quota.  </td></tr>
<td align="left">Clear the quota for each directory <i>dirname</i>. Best effort for the directory. with fault reported if  <br />1. the directory does not exist or is a file, or  <br />2. user is not an administrator. It does not fault if the directory has no quota.</td></tr>
<td align="left">This option will turn on/off automatic attempt to restore failed storage replicas. If a failed storage becomes available again the system will attempt to restore edits and/or fsimage during checkpoint. 'check' option will return current setting.</td></tr>
<tr class="a">
<td align="left">-help [cmd]</td>
<td align="left">Displays help for the given command or all commands if none is specified.</td></tr></table></div>
<td align="left">Refresh the queue acls used by hadoop, to check access during submissions and administration of the job by the user. The properties present in mapred-queue-acls.xml is reloaded by the queue manager.</td></tr></table></div>
<td align="left">Dumps the configuration used by the JobTracker alongwith queue configuration in JSON format into Standard output used by the jobtracker and exits.</td></tr></table></div>
<div class="section">
<h3><tt>namenode</tt><a name="namenode"></a></h3>
<p>Runs the namenode. More info about the upgrade, rollback and finalize is at <a href="../hadoop-hdfs/HdfsUserGuide.html#Upgrade_and_Rollback">Upgrade Rollback</a>.</p>
<td align="left">Formats the namenode. It starts the namenode, formats it and then shut it down.</td></tr>
<tr class="a">
<td align="left">-upgrade</td>
<td align="left">Namenode should be started with upgrade option after the distribution of new hadoop version.</td></tr>
<tr class="b">
<td align="left">-rollback</td>
<td align="left">Rollsback the namenode to the previous version. This should be used after stopping the cluster and distributing the old hadoop version.</td></tr>
<tr class="a">
<td align="left">-finalize</td>
<td align="left">Finalize will remove the previous state of the files system. Recent upgrade will become permanent. Rollback option will not be available anymore. After finalization it shuts the namenode down.</td></tr>
<tr class="b">
<td align="left">-importCheckpoint</td>
<td align="left">Loads image from a checkpoint directory and save it into the current one. Checkpoint dir is read from property fs.checkpoint.dir</td></tr></table></div>
<td align="left">Checkpoints the Secondary namenode if EditLog size >= fs.checkpoint.size. If <tt>-force</tt> is used, checkpoint irrespective of EditLog size.</td></tr>
<tr class="a">
<td align="left">-geteditsize</td>
<td align="left">Prints the EditLog size.</td></tr></table></div>