CommandsManual.apt.vm 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  1. ~~ Licensed to the Apache Software Foundation (ASF) under one or more
  2. ~~ contributor license agreements. See the NOTICE file distributed with
  3. ~~ this work for additional information regarding copyright ownership.
  4. ~~ The ASF licenses this file to You under the Apache License, Version 2.0
  5. ~~ (the "License"); you may not use this file except in compliance with
  6. ~~ the License. You may obtain a copy of the License at
  7. ~~
  8. ~~ http://www.apache.org/licenses/LICENSE-2.0
  9. ~~
  10. ~~ Unless required by applicable law or agreed to in writing, software
  11. ~~ distributed under the License is distributed on an "AS IS" BASIS,
  12. ~~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. ~~ See the License for the specific language governing permissions and
  14. ~~ limitations under the License.
  15. ---
  16. Hadoop Commands Guide
  17. ---
  18. ---
  19. ${maven.build.timestamp}
  20. %{toc}
  21. Overview
  22. All hadoop commands are invoked by the <<<bin/hadoop>>> script. Running the
  23. hadoop script without any arguments prints the description for all
  24. commands.
  25. Usage: <<<hadoop [--config confdir] [COMMAND] [GENERIC_OPTIONS] [COMMAND_OPTIONS]>>>
  26. Hadoop has an option parsing framework that employs parsing generic
  27. options as well as running classes.
  28. *-----------------------+---------------+
  29. || COMMAND_OPTION || Description
  30. *-----------------------+---------------+
  31. | <<<--config confdir>>>| Overwrites the default Configuration directory. Default is <<<${HADOOP_HOME}/conf>>>.
  32. *-----------------------+---------------+
  33. | GENERIC_OPTIONS | The common set of options supported by multiple commands.
  34. | COMMAND_OPTIONS | Various commands with their options are described in the following sections. The commands have been grouped into User Commands and Administration Commands.
  35. *-----------------------+---------------+
  36. Generic Options
  37. The following options are supported by {{dfsadmin}}, {{fs}}, {{fsck}},
  38. {{job}} and {{fetchdt}}. Applications should implement
  39. {{{../../api/org/apache/hadoop/util/Tool.html}Tool}} to support
  40. GenericOptions.
  41. *------------------------------------------------+-----------------------------+
  42. || GENERIC_OPTION || Description
  43. *------------------------------------------------+-----------------------------+
  44. |<<<-conf \<configuration file\> >>> | Specify an application
  45. | configuration file.
  46. *------------------------------------------------+-----------------------------+
  47. |<<<-D \<property\>=\<value\> >>> | Use value for given property.
  48. *------------------------------------------------+-----------------------------+
  49. |<<<-jt \<local\> or \<jobtracker:port\> >>> | Specify a job tracker.
  50. | Applies only to job.
  51. *------------------------------------------------+-----------------------------+
  52. |<<<-files \<comma separated list of files\> >>> | Specify comma separated files
  53. | to be copied to the map
  54. | reduce cluster. Applies only
  55. | to job.
  56. *------------------------------------------------+-----------------------------+
  57. |<<<-libjars \<comma seperated list of jars\> >>>| Specify comma separated jar
  58. | files to include in the
  59. | classpath. Applies only to
  60. | job.
  61. *------------------------------------------------+-----------------------------+
  62. |<<<-archives \<comma separated list of archives\> >>> | Specify comma separated
  63. | archives to be unarchived on
  64. | the compute machines. Applies
  65. | only to job.
  66. *------------------------------------------------+-----------------------------+
  67. User Commands
  68. Commands useful for users of a hadoop cluster.
  69. * <<<archive>>>
  70. Creates a hadoop archive. More information can be found at Hadoop
  71. Archives.
  72. Usage: <<<hadoop archive -archiveName NAME <src>* <dest> >>>
  73. *-------------------+-------------------------------------------------------+
  74. ||COMMAND_OPTION || Description
  75. *-------------------+-------------------------------------------------------+
  76. | -archiveName NAME | Name of the archive to be created.
  77. *-------------------+-------------------------------------------------------+
  78. | src | Filesystem pathnames which work as usual with regular
  79. | expressions.
  80. *-------------------+-------------------------------------------------------+
  81. | dest | Destination directory which would contain the archive.
  82. *-------------------+-------------------------------------------------------+
  83. * <<<distcp>>>
  84. Copy file or directories recursively. More information can be found at
  85. Hadoop DistCp Guide.
  86. Usage: <<<hadoop distcp <srcurl> <desturl> >>>
  87. *-------------------+--------------------------------------------+
  88. ||COMMAND_OPTION || Description
  89. *-------------------+--------------------------------------------+
  90. | srcurl | Source Url
  91. *-------------------+--------------------------------------------+
  92. | desturl | Destination Url
  93. *-------------------+--------------------------------------------+
  94. * <<<fs>>>
  95. Deprecated, use {{{../hadoop-hdfs/HDFSCommands.html#dfs}<<<hdfs dfs>>>}}
  96. instead.
  97. * <<<fsck>>>
  98. Deprecated, use {{{../hadoop-hdfs/HDFSCommands.html#fsck}<<<hdfs fsck>>>}}
  99. instead.
  100. * <<<fetchdt>>>
  101. Deprecated, use {{{../hadoop-hdfs/HDFSCommands.html#fetchdt}
  102. <<<hdfs fetchdt>>>}} instead.
  103. * <<<jar>>>
  104. Runs a jar file. Users can bundle their Map Reduce code in a jar file and
  105. execute it using this command.
  106. Usage: <<<hadoop jar <jar> [mainClass] args...>>>
  107. The streaming jobs are run via this command. Examples can be referred from
  108. Streaming examples
  109. Word count example is also run using jar command. It can be referred from
  110. Wordcount example
  111. * <<<job>>>
  112. Command to interact with Map Reduce Jobs.
  113. Usage: <<<hadoop job [GENERIC_OPTIONS] [-submit <job-file>] | [-status <job-id>] | [-counter <job-id> <group-name> <counter-name>] | [-kill <job-id>] | [-events <job-id> <from-event-#> <#-of-events>] | [-history [all] <jobOutputDir>] | [-list [all]] | [-kill-task <task-id>] | [-fail-task <task-id>] | [-set-priority <job-id> <priority>]>>>
  114. *------------------------------+---------------------------------------------+
  115. || COMMAND_OPTION || Description
  116. *------------------------------+---------------------------------------------+
  117. | -submit <job-file> | Submits the job.
  118. *------------------------------+---------------------------------------------+
  119. | -status <job-id> | Prints the map and reduce completion
  120. | percentage and all job counters.
  121. *------------------------------+---------------------------------------------+
  122. | -counter <job-id> <group-name> <counter-name> | Prints the counter value.
  123. *------------------------------+---------------------------------------------+
  124. | -kill <job-id> | Kills the job.
  125. *------------------------------+---------------------------------------------+
  126. | -events <job-id> <from-event-#> <#-of-events> | Prints the events' details
  127. | received by jobtracker for the given range.
  128. *------------------------------+---------------------------------------------+
  129. | -history [all]<jobOutputDir> | Prints job details, failed and killed tip
  130. | details. More details about the job such as
  131. | successful tasks and task attempts made for
  132. | each task can be viewed by specifying the [all]
  133. | option.
  134. *------------------------------+---------------------------------------------+
  135. | -list [all] | Displays jobs which are yet to complete.
  136. | <<<-list all>>> displays all jobs.
  137. *------------------------------+---------------------------------------------+
  138. | -kill-task <task-id> | Kills the task. Killed tasks are NOT counted
  139. | against failed attempts.
  140. *------------------------------+---------------------------------------------+
  141. | -fail-task <task-id> | Fails the task. Failed tasks are counted
  142. | against failed attempts.
  143. *------------------------------+---------------------------------------------+
  144. | -set-priority <job-id> <priority> | Changes the priority of the job. Allowed
  145. | priority values are VERY_HIGH, HIGH, NORMAL,
  146. | LOW, VERY_LOW
  147. *------------------------------+---------------------------------------------+
  148. * <<<pipes>>>
  149. Runs a pipes job.
  150. Usage: <<<hadoop pipes [-conf <path>] [-jobconf <key=value>, <key=value>,
  151. ...] [-input <path>] [-output <path>] [-jar <jar file>] [-inputformat
  152. <class>] [-map <class>] [-partitioner <class>] [-reduce <class>] [-writer
  153. <class>] [-program <executable>] [-reduces <num>]>>>
  154. *----------------------------------------+------------------------------------+
  155. || COMMAND_OPTION || Description
  156. *----------------------------------------+------------------------------------+
  157. | -conf <path> | Configuration for job
  158. *----------------------------------------+------------------------------------+
  159. | -jobconf <key=value>, <key=value>, ... | Add/override configuration for job
  160. *----------------------------------------+------------------------------------+
  161. | -input <path> | Input directory
  162. *----------------------------------------+------------------------------------+
  163. | -output <path> | Output directory
  164. *----------------------------------------+------------------------------------+
  165. | -jar <jar file> | Jar filename
  166. *----------------------------------------+------------------------------------+
  167. | -inputformat <class> | InputFormat class
  168. *----------------------------------------+------------------------------------+
  169. | -map <class> | Java Map class
  170. *----------------------------------------+------------------------------------+
  171. | -partitioner <class> | Java Partitioner
  172. *----------------------------------------+------------------------------------+
  173. | -reduce <class> | Java Reduce class
  174. *----------------------------------------+------------------------------------+
  175. | -writer <class> | Java RecordWriter
  176. *----------------------------------------+------------------------------------+
  177. | -program <executable> | Executable URI
  178. *----------------------------------------+------------------------------------+
  179. | -reduces <num> | Number of reduces
  180. *----------------------------------------+------------------------------------+
  181. * <<<queue>>>
  182. command to interact and view Job Queue information
  183. Usage: <<<hadoop queue [-list] | [-info <job-queue-name> [-showJobs]] | [-showacls]>>>
  184. *-----------------+-----------------------------------------------------------+
  185. || COMMAND_OPTION || Description
  186. *-----------------+-----------------------------------------------------------+
  187. | -list | Gets list of Job Queues configured in the system.
  188. | Along with scheduling information associated with the job queues.
  189. *-----------------+-----------------------------------------------------------+
  190. | -info <job-queue-name> [-showJobs] | Displays the job queue information and
  191. | associated scheduling information of particular job queue.
  192. | If <<<-showJobs>>> options is present a list of jobs
  193. | submitted to the particular job queue is displayed.
  194. *-----------------+-----------------------------------------------------------+
  195. | -showacls | Displays the queue name and associated queue operations
  196. | allowed for the current user. The list consists of only
  197. | those queues to which the user has access.
  198. *-----------------+-----------------------------------------------------------+
  199. * <<<version>>>
  200. Prints the version.
  201. Usage: <<<hadoop version>>>
  202. * <<<CLASSNAME>>>
  203. hadoop script can be used to invoke any class.
  204. Usage: <<<hadoop CLASSNAME>>>
  205. Runs the class named <<<CLASSNAME>>>.
  206. * <<<classpath>>>
  207. Prints the class path needed to get the Hadoop jar and the required
  208. libraries. If called without arguments, then prints the classpath set up by
  209. the command scripts, which is likely to contain wildcards in the classpath
  210. entries. Additional options print the classpath after wildcard expansion or
  211. write the classpath into the manifest of a jar file. The latter is useful in
  212. environments where wildcards cannot be used and the expanded classpath exceeds
  213. the maximum supported command line length.
  214. Usage: <<<hadoop classpath [--glob|--jar <path>|-h|--help]>>>
  215. *-----------------+-----------------------------------------------------------+
  216. || COMMAND_OPTION || Description
  217. *-----------------+-----------------------------------------------------------+
  218. | --glob | expand wildcards
  219. *-----------------+-----------------------------------------------------------+
  220. | --jar <path> | write classpath as manifest in jar named <path>
  221. *-----------------+-----------------------------------------------------------+
  222. | -h, --help | print help
  223. *-----------------+-----------------------------------------------------------+
  224. Administration Commands
  225. Commands useful for administrators of a hadoop cluster.
  226. * <<<balancer>>>
  227. Deprecated, use {{{../hadoop-hdfs/HDFSCommands.html#balancer}
  228. <<<hdfs balancer>>>}} instead.
  229. * <<<daemonlog>>>
  230. Get/Set the log level for each daemon.
  231. Usage: <<<hadoop daemonlog -getlevel <host:port> <name> >>>
  232. Usage: <<<hadoop daemonlog -setlevel <host:port> <name> <level> >>>
  233. *------------------------------+-----------------------------------------------------------+
  234. || COMMAND_OPTION || Description
  235. *------------------------------+-----------------------------------------------------------+
  236. | -getlevel <host:port> <name> | Prints the log level of the daemon running at
  237. | <host:port>. This command internally connects
  238. | to http://<host:port>/logLevel?log=<name>
  239. *------------------------------+-----------------------------------------------------------+
  240. | -setlevel <host:port> <name> <level> | Sets the log level of the daemon
  241. | running at <host:port>. This command internally
  242. | connects to http://<host:port>/logLevel?log=<name>
  243. *------------------------------+-----------------------------------------------------------+
  244. * <<<datanode>>>
  245. Deprecated, use {{{../hadoop-hdfs/HDFSCommands.html#datanode}
  246. <<<hdfs datanode>>>}} instead.
  247. * <<<dfsadmin>>>
  248. Deprecated, use {{{../hadoop-hdfs/HDFSCommands.html#dfsadmin}
  249. <<<hdfs dfsadmin>>>}} instead.
  250. * <<<mradmin>>>
  251. Runs MR admin client
  252. Usage: <<<hadoop mradmin [ GENERIC_OPTIONS ] [-refreshQueueAcls]>>>
  253. *-------------------+-----------------------------------------------------------+
  254. || COMMAND_OPTION || Description
  255. *-------------------+-----------------------------------------------------------+
  256. | -refreshQueueAcls | Refresh the queue acls used by hadoop, to check access
  257. | during submissions and administration of the job by the
  258. | user. The properties present in mapred-queue-acls.xml is
  259. | reloaded by the queue manager.
  260. *-------------------+-----------------------------------------------------------+
  261. * <<<jobtracker>>>
  262. Runs the MapReduce job Tracker node.
  263. Usage: <<<hadoop jobtracker [-dumpConfiguration]>>>
  264. *--------------------+-----------------------------------------------------------+
  265. || COMMAND_OPTION || Description
  266. *--------------------+-----------------------------------------------------------+
  267. | -dumpConfiguration | Dumps the configuration used by the JobTracker alongwith
  268. | queue configuration in JSON format into Standard output
  269. | used by the jobtracker and exits.
  270. *--------------------+-----------------------------------------------------------+
  271. * <<<namenode>>>
  272. Deprecated, use {{{../hadoop-hdfs/HDFSCommands.html#namenode}
  273. <<<hdfs namenode>>>}} instead.
  274. * <<<secondarynamenode>>>
  275. Deprecated, use {{{../hadoop-hdfs/HDFSCommands.html#secondarynamenode}
  276. <<<hdfs secondarynamenode>>>}} instead.
  277. * <<<tasktracker>>>
  278. Runs a MapReduce task Tracker node.
  279. Usage: <<<hadoop tasktracker>>>