You are on page 1of 9

3/22/2014

Commands Guide

Apache > Hadoop > Core >

Search the site with google

Search

Last Published: 08/04/2013 08:13:21


PDF

Commands Guide
Overview Generic Options User Commands archive distcp fs fsck fetchdt jar job pipes queue version CLASSNAME classpath Administration Commands balancer daemonlog datanode dfsadmin mradmin jobtracker namenode secondarynamenode tasktracker

Overview
https://hadoop.apache.org/docs/r1.2.1/commands_manual.html 1/9

3/22/2014

Commands Guide

All hadoop commands are invoked by the bin/hadoop script. Running the hadoop script without any arguments prints the description for all commands.

U s a g e :h a d o o p[ c o n f i gc o n f d i r ][ C O M M A N D ][ G E N E R I C _ O P T I O N S ] [ C O M M A N D _ O P T I O N S ]
Hadoop has an option parsing framework that employs parsing generic options as well as running classes. COMMAND_OPTION Description c o n f i gc o n f d i r Overwrites the default Configuration directory. Default is ${HADOOP_HOME}/conf. G E N E R I C _ O P T I O N S The common set of options supported by multiple commands. C O M M A N D Various commands with their options are described in the following C O M M A N D _ O P T I O N S sections. The commands have been grouped into User Commands and Administration Commands.

Generic Options
The following options are supported by dfsadmin, fs, fsck, job and fetchdt. Applications should implement Tool to support GenericOptions. Description c o n f< c o n f i g u r a t i o nf i l e > Specify an application configuration file. D< p r o p e r t y = v a l u e > Use value for given property. f s< l o c a l | n a m e n o d e : p o r t > Specify a namenode. j t< l o c a l | j o b t r a c k e r : p o r t > Specify a job tracker. Applies only to job. f i l e s< c o m m as e p a r a t e d Specify comma separated files to be copied to the map reduce cluster. Applies only to job. l i s to ff i l e s > GENERIC_OPTION

l i b j a r s< c o m m as e p e r a t e d Specify comma separated jar files to include in the classpath. Applies only to job. l i s to fj a r s > a r c h i v e s< c o m m as e p a r a t e d Specify comma separated archives to be unarchived on the compute machines. Applies only to job. l i s to fa r c h i v e s >

User Commands
Commands useful for users of a hadoop cluster.

archive
Creates a hadoop archive. More information can be found at Hadoop Archives.

U s a g e :h a d o o pa r c h i v ea r c h i v e N a m eN A M E< s r c > *< d e s t >


Description a r c h i v e N a m eN A M E Name of the archive to be created. s r c Filesystem pathnames which work as usual with regular expressions.
https://hadoop.apache.org/docs/r1.2.1/commands_manual.html 2/9

COMMAND_OPTION

3/22/2014

Commands Guide

d e s t

Destination directory which would contain the archive.

distcp
Copy file or directories recursively. More information can be found at Hadoop DistCp Guide.

U s a g e :h a d o o pd i s t c p< s r c u r l >< d e s t u r l >


COMMAND_OPTION Description Source Url Destination Url

s r c u r l d e s t u r l

fs
U s a g e :h a d o o pf s[ GENERIC_OPTIONS] [ C O M M A N D _ O P T I O N S ]
Runs a generic filesystem user client. The various COMMAND_OPTIONS can be found at File System Shell Guide.

fsck
Runs a HDFS filesystem checking utility. See Fsck for more info.

U s a g e :h a d o o pf s c k[ GENERIC_OPTIONS] < p a t h >[ m o v e|d e l e t e|o p e n f o r w r i t e ][ f i l e s[ b l o c k s[ l o c a t i o n s|r a c k s ] ] ]


COMMAND_OPTION

< p a t h > m o v e d e l e t e o p e n f o r w r i t e f i l e s b l o c k s l o c a t i o n s r a c k s

Description Start checking from this path. Move corrupted files to /lost+found Delete corrupted files. Print out files opened for write. Print out files being checked. Print out block report. Print out locations for every block. Print out network topology for data-node locations.

fetchdt
Gets Delegation Token from a NameNode. See fetchdt for more info.

U s a g e :h a d o o pf e t c h d t[ GENERIC_OPTIONS] [ w e b s e r v i c e < n a m e n o d e _ h t t p _ a d d r > ]< p a t h >


COMMAND_OPTION

< f i l e N a m e > w e b s e r v i c e< h t t p s _ a d d r e s s >


https://hadoop.apache.org/docs/r1.2.1/commands_manual.html

Description File name to store the token into. use http protocol instead of RPC

3/9

3/22/2014

Commands Guide

jar
Runs a jar file. Users can bundle their Map Reduce code in a jar file and execute it using this command.

U s a g e :h a d o o pj a r< j a r >[ m a i n C l a s s ]a r g s . . .
The streaming jobs are run via this command. Examples can be referred from Streaming examples Word count example is also run using jar command. It can be referred from Wordcount example

job
Command to interact with Map Reduce Jobs.

U s a g e :h a d o o pj o b[ GENERIC_OPTIONS] [ s u b m i t< j o b f i l e > ]|[ s t a t u s < j o b i d > ]|[ c o u n t e r< j o b i d >< g r o u p n a m e >< c o u n t e r n a m e > ]|[ k i l l< j o b i d > ]|[ e v e n t s< j o b i d >< f r o m e v e n t # >< # o f e v e n t s > ]| [ h i s t o r y[ a l l ]< j o b O u t p u t D i r > ]|[ l i s t[ a l l ] ]|[ k i l l t a s k < t a s k i d > ]|[ f a i l t a s k< t a s k i d > ]|[ s e t p r i o r i t y< j o b i d > < p r i o r i t y > ]
COMMAND_OPTION Description

s u b m i t< j o b Submits the job. f i l e > s t a t u s< j o b i d > Prints the map and reduce completion percentage and all job counters. c o u n t e r< j o b - Prints the counter value. i d >< g r o u p n a m e > < c o u n t e r n a m e > k i l l< j o b i d > Kills the job. e v e n t s< j o b i d > Prints the events' details received by jobtracker for the given range. < f r o m e v e n t # > < # o f e v e n t s > h i s t o r y[ a l l ] -history <jobOutputDir> prints job details, failed and killed tip details. More < j o b O u t p u t D i r > details about the job such as successful tasks and task attempts made for l i s t[ a l l ] k i l l t a s k < t a s k i d > f a i l t a s k < t a s k i d > s e t p r i o r i t y < j o b i d > < p r i o r i t y >
each task can be viewed by specifying the [all] option. -list all displays all jobs. -list displays only jobs which are yet to complete. Kills the task. Killed tasks are NOT counted against failed attempts. Fails the task. Failed tasks are counted against failed attempts. Changes the priority of the job. Allowed priority values are VERY _HIGH, HIGH, NORMAL, LOW, VERY _LOW

pipes
Runs a pipes job.
https://hadoop.apache.org/docs/r1.2.1/commands_manual.html 4/9

3/22/2014

Commands Guide

U s a g e :h a d o o pp i p e s[ c o n f< p a t h > ][ j o b c o n f< k e y = v a l u e > , < k e y = v a l u e > ,. . . ][ i n p u t< p a t h > ][ o u t p u t< p a t h > ][ j a r< j a r f i l e > ][ i n p u t f o r m a t< c l a s s > ][ m a p< c l a s s > ][ p a r t i t i o n e r< c l a s s > ] [ r e d u c e< c l a s s > ][ w r i t e r< c l a s s > ][ p r o g r a m< e x e c u t a b l e > ][ r e d u c e s< n u m > ]
COMMAND_OPTION

c o n f< p a t h > j o b c o n f< k e y = v a l u e > ,< k e y = v a l u e > ,. . . i n p u t< p a t h > o u t p u t< p a t h > j a r< j a rf i l e > i n p u t f o r m a t< c l a s s > m a p< c l a s s > p a r t i t i o n e r< c l a s s > r e d u c e< c l a s s > w r i t e r< c l a s s > p r o g r a m< e x e c u t a b l e > r e d u c e s< n u m >

Description Configuration for job Add/override configuration for job Input directory Output directory Jar filename InputFormat class Java Map class Java Partitioner Java Reduce class Java RecordWriter Executable URI Number of reduces

queue
command to interact and view Job Queue information

U s a g e:h a d o o pq u e u e[ l i s t ]|[ i n f o< j o b q u e u e n a m e >[ s h o w J o b s ] ] |[ s h o w a c l s ]


COMMAND_OPTION

l i s t i n f o< j o b q u e u e n a m e >[ s h o w J o b s ] s h o w a c l s

Description Gets list of Job Queues configured in the system. Along with scheduling information associated with the job queues. Displays the job queue information and associated scheduling information of particular job queue. If -showJobs options is present a list of jobs submitted to the particular job queue is displayed. 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.

version
Prints the version.

U s a g e :h a d o o pv e r s i o n

CLASSNAME
hadoop script can be used to invoke any class.

U s a g e :h a d o o pC L A S S N A M E
https://hadoop.apache.org/docs/r1.2.1/commands_manual.html 5/9

3/22/2014

Commands Guide

Runs the class named CLASSNAME.

classpath
Prints the class path needed to get the Hadoop jar and the required libraries.

U s a g e :h a d o o pc l a s s p a t h

Administration Commands
Commands useful for administrators of a hadoop cluster.

balancer
Runs a cluster balancing utility. An administrator can simply press Ctrl-C to stop the rebalancing process. See Rebalancer for more details.

U s a g e :h a d o o pb a l a n c e r[ t h r e s h o l d< t h r e s h o l d > ]
Description t h r e s h o l d< t h r e s h o l d > Percentage of disk capacity. This overwrites the default threshold. COMMAND_OPTION

daemonlog
Get/Set the log level for each daemon.

U s a g e :h a d o o pd a e m o n l o gg e t l e v e l< h o s t : p o r t >< n a m e > U s a g e :h a d o o pd a e m o n l o gs e t l e v e l< h o s t : p o r t >< n a m e >< l e v e l >


Description g e t l e v e l Prints the log level of the daemon running at <host:port>. This < h o s t : p o r t >< n a m e > command internally connects to http://<host:port>/logLevel?log= <name> s e t l e v e l Sets the log level of the daemon running at <host:port>. This command < h o s t : p o r t >< n a m e > internally connects to http://<host:port>/logLevel?log=<name> COMMAND_OPTION

< l e v e l >

datanode
Runs a HDFS datanode.

U s a g e :h a d o o pd a t a n o d e[ r o l l b a c k ]
COMMAND_OPTION

r o l l b a c k

Description Rollsback the datanode to the previous version. This should be used after stopping the datanode and distributing the old hadoop version.

dfsadmin
https://hadoop.apache.org/docs/r1.2.1/commands_manual.html 6/9

3/22/2014

Commands Guide

Runs a HDFS dfsadmin client.

U s a g e :h a d o o pd f s a d m i n[ GENERIC_OPTIONS] [ r e p o r t ][ s a f e m o d ee n t e r |l e a v e|g e t|w a i t ][ r e f r e s h N o d e s ][ f i n a l i z e U p g r a d e ][ u p g r a d e P r o g r e s ss t a t u s|d e t a i l s|f o r c e ][ m e t a s a v ef i l e n a m e ][ s e t Q u o t a< q u o t a >< d i r n a m e > . . . < d i r n a m e > ][ c l r Q u o t a< d i r n a m e > . . . < d i r n a m e > ][ h e l p[ c m d ] ]
COMMAND_OPTION Description r e p o r t Reports basic filesystem information and statistics. s a f e m o d ee n t e r Safe mode maintenance command. Safe mode is a Namenode state in |l e a v e|g e t | which it 1. does not accept changes to the name space (read-only) w a i t 2. does not replicate or delete blocks. 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. r e f r e s h N o d e s 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. f i n a l i z e U p g r a d e Finalize upgrade of HDFS. Datanodes delete their previous version working directories, followed by Namenode doing the same. This completes the upgrade process. u p g r a d e P r o g r e s s Request current distributed upgrade status, a detailed status or force the s t a t u s|d e t a i l s upgrade to proceed.

|f o r c e m e t a s a v e f i l e n a m e

s e t Q u o t a < q u o t a > < d i r n a m e > . . . < d i r n a m e >

c l r Q u o t a < d i r n a m e > . . . < d i r n a m e > h e l p[ c m d ]

Save Namenode's primary data structures to <filename> in the directory specified by hadoop.log.dir property. <filename> will contain one line for each of the following 1. Datanodes heart beating with Namenode 2. Blocks waiting to be replicated 3. Blocks currrently being replicated 4. Blocks waiting to be deleted Set the quota <quota> for each directory <dirname>. 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 1. N is not a positive integer, or 2. user is not an administrator, or 3. the directory does not exist or is a file, or 4. the directory would immediately exceed the new quota. Clear the quota for each directory <dirname>. Best effort for the directory. with fault reported if 1. the directory does not exist or is a file, or 2. user is not an administrator. It does not fault if the directory has no quota. Displays help for the given command or all commands if none is specified.

https://hadoop.apache.org/docs/r1.2.1/commands_manual.html

7/9

3/22/2014

Commands Guide

mradmin
Runs MR admin client

U s a g e :h a d o o pm r a d m i n [GENERIC_OPTIONS ] [ r e f r e s h Q u e u e A c l s ]
COMMAND_OPTION Description

Refresh the queue acls used by hadoop, to check access during submissions r e f r e s h Q u e u e A c l s and administration of the job by the user. The properties present in m a p r e d q u e u e a c l s . x m lis reloaded by the queue manager.

jobtracker
Runs the MapReduce job Tracker node.

U s a g e :h a d o o pj o b t r a c k e r[ d u m p C o n f i g u r a t i o n ]
COMMAND_OPTION Description

Dumps the configuration used by the JobTracker alongwith queue configuration in JSON format into Standard output used by the jobtracker d u m p C o n f i g u r a t i o n
and exits.

namenode
Runs the namenode. More info about the upgrade, rollback and finalize is at Upgrade Rollback

U s a g e :h a d o o pn a m e n o d e[ f o r m a t[ f o r c e ][ n o n I n t e r a c t i v e ] ]|[ u p g r a d e ]|[ r o l l b a c k ]|[ f i n a l i z e ]|[ i m p o r t C h e c k p o i n t ]


COMMAND_OPTION Description f o r m a t[ f o r c e ] Formats the namenode. It starts the namenode, formats it and then shuts it down. User will be prompted for input if the name directories exist on the [ n o n I n t e r a c t i v e ] local filesystem. -nonInteractive: User will not be prompted for input if the name directories exist in the local filesystem and the format will fail. -force: formats the namenode and the user will NOT be prompted to confirm formatting of name directories in the local filesystem. If nonInteractive option is specified it will be ignored. u p g r a d e Namenode should be started with upgrade option after the distribution of new hadoop version. r o l l b a c k Rollsback the namenode to the previous version. This should be used after stopping the cluster and distributing the old hadoop version.

f i n a l i z e

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. Loads image from a checkpoint directory and save it into the current one. i m p o r t C h e c k p o i n t Checkpoint dir is read from property fs.checkpoint.dir

secondarynamenode
https://hadoop.apache.org/docs/r1.2.1/commands_manual.html 8/9

3/22/2014

Commands Guide

Runs the HDFS secondary namenode. See Secondary Namenode for more info.

U s a g e :h a d o o ps e c o n d a r y n a m e n o d e[ c h e c k p o i n t[ f o r c e ] ]|[ g e t e d i t s i z e ]
COMMAND_OPTION

c h e c k p o i n t [ f o r c e ] g e t e d i t s i z e

Description Checkpoints the Secondary namenode if EditLog size >= fs.checkpoint.size. If -force is used, checkpoint irrespective of EditLog size. Prints the EditLog size.

tasktracker
Runs a MapReduce task Tracker node.

U s a g e :h a d o o pt a s k t r a c k e r

La st Pu blish ed: 0 8 /0 4 /2 0 1 3 0 8 :1 3 :2 1 Copy r ig h t 2 0 0 8 T h e A pa ch e Soft w a r e Fou n da t ion .

https://hadoop.apache.org/docs/r1.2.1/commands_manual.html

9/9

You might also like