mapred.cmd 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. @echo off
  2. @rem Licensed to the Apache Software Foundation (ASF) under one or more
  3. @rem contributor license agreements. See the NOTICE file distributed with
  4. @rem this work for additional information regarding copyright ownership.
  5. @rem The ASF licenses this file to You under the Apache License, Version 2.0
  6. @rem (the "License"); you may not use this file except in compliance with
  7. @rem the License. You may obtain a copy of the License at
  8. @rem
  9. @rem http://www.apache.org/licenses/LICENSE-2.0
  10. @rem
  11. @rem Unless required by applicable law or agreed to in writing, software
  12. @rem distributed under the License is distributed on an "AS IS" BASIS,
  13. @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. @rem See the License for the specific language governing permissions and
  15. @rem limitations under the License.
  16. @rem The Hadoop mapred command script
  17. setlocal enabledelayedexpansion
  18. if not defined HADOOP_BIN_PATH (
  19. set HADOOP_BIN_PATH=%~dp0
  20. )
  21. if "%HADOOP_BIN_PATH:~`%" == "\" (
  22. set HADOOP_BIN_PATH=%HADOOP_BIN_PATH:~0,-1%
  23. )
  24. set DEFAULT_LIBEXEC_DIR=%HADOOP_BIN_PATH%\..\libexec
  25. if not defined HADOOP_LIBEXEC_DIR (
  26. set HADOOP_LIBEXEC_DIR=%DEFAULT_LIBEXEC_DIR%
  27. )
  28. call %DEFAULT_LIBEXEC_DIR%\mapred-config.cmd %*
  29. if "%1" == "--config" (
  30. shift
  31. shift
  32. )
  33. if "%1" == "--loglevel" (
  34. shift
  35. shift
  36. )
  37. :main
  38. if exist %MAPRED_CONF_DIR%\mapred-env.cmd (
  39. call %MAPRED_CONF_DIR%\mapred-env.cmd
  40. )
  41. set mapred-command=%1
  42. call :make_command_arguments %*
  43. if not defined mapred-command (
  44. goto print_usage
  45. )
  46. @rem JAVA and JAVA_HEAP_MAX are set in hadoop-confg.cmd
  47. if defined MAPRED_HEAPSIZE (
  48. @rem echo run with Java heapsize %MAPRED_HEAPSIZE%
  49. set JAVA_HEAP_SIZE=-Xmx%MAPRED_HEAPSIZE%m
  50. )
  51. @rem CLASSPATH initially contains HADOOP_CONF_DIR and MAPRED_CONF_DIR
  52. if not defined HADOOP_CONF_DIR (
  53. echo NO HADOOP_CONF_DIR set.
  54. echo Please specify it either in mapred-env.cmd or in the environment.
  55. goto :eof
  56. )
  57. set CLASSPATH=%HADOOP_CONF_DIR%;%MAPRED_CONF_DIR%;%CLASSPATH%
  58. @rem for developers, add Hadoop classes to CLASSPATH
  59. if exist %HADOOP_MAPRED_HOME%\build\classes (
  60. set CLASSPATH=%CLASSPATH%;%HADOOP_MAPRED_HOME%\build\classes
  61. )
  62. if exist %HADOOP_MAPRED_HOME%\build\webapps (
  63. set CLASSPATH=%CLASSPATH%;%HADOOP_MAPRED_HOME%\build
  64. )
  65. if exist %HADOOP_MAPRED_HOME%\build\test\classes (
  66. set CLASSPATH=%CLASSPATH%;%HADOOP_MAPRED_HOME%\build\test\classes
  67. )
  68. if exist %HADOOP_MAPRED_HOME%\build\tools (
  69. set CLASSPATH=%CLASSPATH%;%HADOOP_MAPRED_HOME%\build\tools
  70. )
  71. @rem Need YARN jars also
  72. set CLASSPATH=%CLASSPATH%;%HADOOP_YARN_HOME%\%YARN_DIR%\*
  73. @rem add libs to CLASSPATH
  74. set CLASSPATH=%CLASSPATH%;%HADOOP_MAPRED_HOME%\%MAPRED_LIB_JARS_DIR%\*
  75. @rem add modules to CLASSPATH
  76. set CLASSPATH=%CLASSPATH%;%HADOOP_MAPRED_HOME%\modules\*
  77. if %mapred-command% == classpath (
  78. if not defined mapred-command-arguments (
  79. @rem No need to bother starting up a JVM for this simple case.
  80. @echo %CLASSPATH%
  81. exit /b
  82. )
  83. )
  84. call :%mapred-command% %mapred-command-arguments%
  85. set java_arguments=%JAVA_HEAP_MAX% %HADOOP_OPTS% -classpath %CLASSPATH% %CLASS% %mapred-command-arguments%
  86. call %JAVA% %java_arguments%
  87. goto :eof
  88. :classpath
  89. set CLASS=org.apache.hadoop.util.Classpath
  90. goto :eof
  91. :job
  92. set CLASS=org.apache.hadoop.mapred.JobClient
  93. set HADOOP_OPTS=%HADOOP_OPTS% %HADOOP_CLIENT_OPTS%
  94. goto :eof
  95. :queue
  96. set CLASS=org.apache.hadoop.mapred.JobQueueClient
  97. set HADOOP_OPTS=%HADOOP_OPTS% %HADOOP_CLIENT_OPTS%
  98. goto :eof
  99. :sampler
  100. set CLASS=org.apache.hadoop.mapred.lib.InputSampler
  101. set HADOOP_OPTS=%HADOOP_OPTS% %HADOOP_CLIENT_OPTS%
  102. goto :eof
  103. :historyserver
  104. set CLASS=org.apache.hadoop.mapreduce.v2.hs.JobHistoryServer
  105. set HADOOP_OPTS=%HADOOP_OPTS% -Dmapred.jobsummary.logger=%HADOOP_JHS_LOGGER% %HADOOP_JOB_HISTORYSERVER_OPTS%
  106. if defined HADOOP_JOB_HISTORYSERVER_HEAPSIZE (
  107. set JAVA_HEAP_MAX=-Xmx%HADOOP_JOB_HISTORYSERVER_HEAPSIZE%m
  108. )
  109. goto :eof
  110. :distcp
  111. set CLASS=org.apache.hadoop.tools.DistCp
  112. set CLASSPATH=%CLASSPATH%;%TOO_PATH%
  113. set HADOOP_OPTS=%HADOOP_OPTS% %HADOOP_CLIENT_OPTS%
  114. goto :eof
  115. :archive
  116. set CLASS=org.apache.hadop.tools.HadoopArchives
  117. set CLASSPATH=%CLASSPATH%;%TOO_PATH%
  118. set HADOOP_OPTS=%HADOOP_OPTS% %HADOOP_CLIENT_OPTS%
  119. :hsadmin
  120. set CLASS=org.apache.hadoop.mapreduce.v2.hs.client.HSAdmin
  121. set HADOOP_OPTS=%HADOOP_OPTS% %HADOOP_CLIENT_OPTS%
  122. :pipes
  123. goto not_supported
  124. :mradmin
  125. goto not_supported
  126. :jobtracker
  127. goto not_supported
  128. :tasktracker
  129. goto not_supported
  130. :groups
  131. goto not_supported
  132. @rem This changes %1, %2 etc. Hence those cannot be used after calling this.
  133. :make_command_arguments
  134. if [%2] == [] goto :eof
  135. if "%1" == "--config" (
  136. shift
  137. shift
  138. )
  139. if "%1" == "--loglevel" (
  140. shift
  141. shift
  142. )
  143. shift
  144. set _mapredarguments=
  145. :MakeCmdArgsLoop
  146. if [%1]==[] goto :EndLoop
  147. if not defined _mapredarguments (
  148. set _mapredarguments=%1
  149. ) else (
  150. set _mapredarguments=!_mapredarguments! %1
  151. )
  152. shift
  153. goto :MakeCmdArgsLoop
  154. :EndLoop
  155. set mapred-command-arguments=%_mapredarguments%
  156. goto :eof
  157. :not_supported
  158. @echo Sorry, the %COMMAND% command is no longer supported.
  159. @echo You may find similar functionality with the "yarn" shell command.
  160. goto print_usage
  161. :print_usage
  162. @echo Usage: mapred [--config confdir] [--loglevel loglevel] COMMAND
  163. @echo where COMMAND is one of:
  164. @echo job manipulate MapReduce jobs
  165. @echo queue get information regarding JobQueues
  166. @echo classpath prints the class path needed for running
  167. @echo mapreduce subcommands
  168. @echo historyserver run job history servers as a standalone daemon
  169. @echo distcp ^<srcurl^> ^<desturl^> copy file or directories recursively
  170. @echo archive -archiveName NAME -p ^<parent path^> ^<src^>* ^<dest^> create a hadoop archive
  171. @echo hsadmin job history server admin interface
  172. @echo
  173. @echo Most commands print help when invoked w/o parameters.
  174. endlocal