mapred.cmd 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  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. :main
  34. if exist %MAPRED_CONF_DIR%\mapred-env.cmd (
  35. call %MAPRED_CONF_DIR%\mapred-env.cmd
  36. )
  37. set mapred-command=%1
  38. call :make_command_arguments %*
  39. if not defined mapred-command (
  40. goto print_usage
  41. )
  42. @rem JAVA and JAVA_HEAP_MAX are set in hadoop-confg.cmd
  43. if defined MAPRED_HEAPSIZE (
  44. @rem echo run with Java heapsize %MAPRED_HEAPSIZE%
  45. set JAVA_HEAP_SIZE=-Xmx%MAPRED_HEAPSIZE%m
  46. )
  47. @rem CLASSPATH initially contains HADOOP_CONF_DIR and MAPRED_CONF_DIR
  48. if not defined HADOOP_CONF_DIR (
  49. echo NO HADOOP_CONF_DIR set.
  50. echo Please specify it either in mapred-env.cmd or in the environment.
  51. goto :eof
  52. )
  53. set CLASSPATH=%HADOOP_CONF_DIR%;%MAPRED_CONF_DIR%;%CLASSPATH%
  54. @rem for developers, add Hadoop classes to CLASSPATH
  55. if exist %HADOOP_MAPRED_HOME%\build\classes (
  56. set CLASSPATH=%CLASSPATH%;%HADOOP_MAPRED_HOME%\build\classes
  57. )
  58. if exist %HADOOP_MAPRED_HOME%\build\webapps (
  59. set CLASSPATH=%CLASSPATH%;%HADOOP_MAPRED_HOME%\build
  60. )
  61. if exist %HADOOP_MAPRED_HOME%\build\test\classes (
  62. set CLASSPATH=%CLASSPATH%;%HADOOP_MAPRED_HOME%\build\test\classes
  63. )
  64. if exist %HADOOP_MAPRED_HOME%\build\tools (
  65. set CLASSPATH=%CLASSPATH%;%HADOOP_MAPRED_HOME%\build\tools
  66. )
  67. @rem Need YARN jars also
  68. set CLASSPATH=%CLASSPATH%;%HADOOP_YARN_HOME%\%YARN_DIR%\*
  69. @rem add libs to CLASSPATH
  70. set CLASSPATH=%CLASSPATH%;%HADOOP_MAPRED_HOME%\%MAPRED_LIB_JARS_DIR%\*
  71. @rem add modules to CLASSPATH
  72. set CLASSPATH=%CLASSPATH%;%HADOOP_MAPRED_HOME%\modules\*
  73. call :%mapred-command% %mapred-command-arguments%
  74. set java_arguments=%JAVA_HEAP_MAX% %HADOOP_OPTS% -classpath %CLASSPATH% %CLASS% %mapred-command-arguments%
  75. call %JAVA% %java_arguments%
  76. goto :eof
  77. :classpath
  78. @echo %CLASSPATH%
  79. goto :eof
  80. :job
  81. set CLASS=org.apache.hadoop.mapred.JobClient
  82. set HADOOP_OPTS=%HADOOP_OPTS% %HADOOP_CLIENT_OPTS%
  83. goto :eof
  84. :queue
  85. set CLASS=org.apache.hadoop.mapred.JobQueueClient
  86. set HADOOP_OPTS=%HADOOP_OPTS% %HADOOP_CLIENT_OPTS%
  87. goto :eof
  88. :sampler
  89. set CLASS=org.apache.hadoop.mapred.lib.InputSampler
  90. set HADOOP_OPTS=%HADOOP_OPTS% %HADOOP_CLIENT_OPTS%
  91. goto :eof
  92. :historyserver
  93. set CLASS=org.apache.hadoop.mapreduce.v2.hs.JobHistoryServer
  94. set HADOOP_OPTS=%HADOOP_OPTS% -Dmapred.jobsummary.logger=%HADOOP_JHS_LOGGER% %HADOOP_JOB_HISTORYSERVER_OPTS%
  95. if defined HADOOP_JOB_HISTORYSERVER_HEAPSIZE (
  96. set JAVA_HEAP_MAX=-Xmx%HADOOP_JOB_HISTORYSERVER_HEAPSIZE%m
  97. )
  98. goto :eof
  99. :distcp
  100. set CLASS=org.apache.hadoop.tools.DistCp
  101. set CLASSPATH=%CLASSPATH%;%TOO_PATH%
  102. set HADOOP_OPTS=%HADOOP_OPTS% %HADOOP_CLIENT_OPTS%
  103. goto :eof
  104. :archive
  105. set CLASS=org.apache.hadop.tools.HadoopArchives
  106. set CLASSPATH=%CLASSPATH%;%TOO_PATH%
  107. set HADOOP_OPTS=%HADOOP_OPTS% %HADOOP_CLIENT_OPTS%
  108. :hsadmin
  109. set CLASS=org.apache.hadoop.mapreduce.v2.hs.client.HSAdmin
  110. set HADOOP_OPTS=%HADOOP_OPTS% %HADOOP_CLIENT_OPTS%
  111. :pipes
  112. goto not_supported
  113. :mradmin
  114. goto not_supported
  115. :jobtracker
  116. goto not_supported
  117. :tasktracker
  118. goto not_supported
  119. :groups
  120. goto not_supported
  121. @rem This changes %1, %2 etc. Hence those cannot be used after calling this.
  122. :make_command_arguments
  123. if [%2] == [] goto :eof
  124. if "%1" == "--config" (
  125. shift
  126. shift
  127. )
  128. shift
  129. set _mapredarguments=
  130. :MakeCmdArgsLoop
  131. if [%1]==[] goto :EndLoop
  132. if not defined _mapredarguments (
  133. set _mapredarguments=%1
  134. ) else (
  135. set _mapredarguments=!_mapredarguments! %1
  136. )
  137. shift
  138. goto :MakeCmdArgsLoop
  139. :EndLoop
  140. set mapred-command-arguments=%_mapredarguments%
  141. goto :eof
  142. :not_supported
  143. @echo Sorry, the %COMMAND% command is no longer supported.
  144. @echo You may find similar functionality with the "yarn" shell command.
  145. goto print_usage
  146. :print_usage
  147. @echo Usage: mapred [--config confdir] COMMAND
  148. @echo where COMMAND is one of:
  149. @echo job manipulate MapReduce jobs
  150. @echo queue get information regarding JobQueues
  151. @echo classpath prints the class path needed for running
  152. @echo mapreduce subcommands
  153. @echo historyserver run job history servers as a standalone daemon
  154. @echo distcp ^<srcurl^> ^<desturl^> copy file or directories recursively
  155. @echo archive -archiveName NAME -p ^<parent path^> ^<src^>* ^<dest^> create a hadoop archive
  156. @echo hsadmin job history server admin interface
  157. @echo
  158. @echo Most commands print help when invoked w/o parameters.
  159. endlocal