2013-10-14 13:01:33 -04:00
|
|
|
@echo off
|
|
|
|
@rem Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
@rem contributor license agreements. See the NOTICE file distributed with
|
|
|
|
@rem this work for additional information regarding copyright ownership.
|
|
|
|
@rem The ASF licenses this file to You under the Apache License, Version 2.0
|
|
|
|
@rem (the "License"); you may not use this file except in compliance with
|
|
|
|
@rem the License. You may obtain a copy of the License at
|
|
|
|
@rem
|
|
|
|
@rem http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
@rem
|
|
|
|
@rem Unless required by applicable law or agreed to in writing, software
|
|
|
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
@rem See the License for the specific language governing permissions and
|
|
|
|
@rem limitations under the License.
|
|
|
|
|
|
|
|
@rem The Hadoop command script
|
|
|
|
@rem
|
|
|
|
@rem Environment Variables
|
|
|
|
@rem
|
|
|
|
@rem JAVA_HOME The java implementation to use. Overrides JAVA_HOME.
|
|
|
|
@rem
|
|
|
|
@rem YARN_CLASSPATH Extra Java CLASSPATH entries.
|
|
|
|
@rem
|
|
|
|
@rem YARN_HEAPSIZE The maximum amount of heap to use, in MB.
|
|
|
|
@rem Default is 1000.
|
|
|
|
@rem
|
|
|
|
@rem YARN_{COMMAND}_HEAPSIZE overrides YARN_HEAPSIZE for a given command
|
|
|
|
@rem eg YARN_NODEMANAGER_HEAPSIZE sets the heap
|
|
|
|
@rem size for the NodeManager. If you set the
|
|
|
|
@rem heap size in YARN_{COMMAND}_OPTS or YARN_OPTS
|
|
|
|
@rem they take precedence.
|
|
|
|
@rem
|
|
|
|
@rem YARN_OPTS Extra Java runtime options.
|
|
|
|
@rem
|
|
|
|
@rem YARN_CLIENT_OPTS when the respective command is run.
|
|
|
|
@rem YARN_{COMMAND}_OPTS etc YARN_NODEMANAGER_OPTS applies to NodeManager
|
|
|
|
@rem for e.g. YARN_CLIENT_OPTS applies to
|
|
|
|
@rem more than one command (fs, dfs, fsck,
|
|
|
|
@rem dfsadmin etc)
|
|
|
|
@rem
|
|
|
|
@rem YARN_CONF_DIR Alternate conf dir. Default is ${HADOOP_YARN_HOME}/conf.
|
|
|
|
@rem
|
|
|
|
@rem YARN_ROOT_LOGGER The root appender. Default is INFO,console
|
|
|
|
@rem
|
|
|
|
|
|
|
|
setlocal enabledelayedexpansion
|
|
|
|
|
|
|
|
if not defined HADOOP_BIN_PATH (
|
|
|
|
set HADOOP_BIN_PATH=%~dp0
|
|
|
|
)
|
|
|
|
|
|
|
|
if "%HADOOP_BIN_PATH:~-1%" == "\" (
|
|
|
|
set HADOOP_BIN_PATH=%HADOOP_BIN_PATH:~0,-1%
|
|
|
|
)
|
|
|
|
|
|
|
|
set DEFAULT_LIBEXEC_DIR=%HADOOP_BIN_PATH%\..\libexec
|
|
|
|
if not defined HADOOP_LIBEXEC_DIR (
|
|
|
|
set HADOOP_LIBEXEC_DIR=%DEFAULT_LIBEXEC_DIR%
|
|
|
|
)
|
|
|
|
|
|
|
|
call %DEFAULT_LIBEXEC_DIR%\yarn-config.cmd %*
|
|
|
|
if "%1" == "--config" (
|
|
|
|
shift
|
|
|
|
shift
|
|
|
|
)
|
2014-11-13 00:41:19 -05:00
|
|
|
if "%1" == "--loglevel" (
|
|
|
|
shift
|
|
|
|
shift
|
|
|
|
)
|
2013-10-14 13:01:33 -04:00
|
|
|
|
|
|
|
:main
|
|
|
|
if exist %YARN_CONF_DIR%\yarn-env.cmd (
|
|
|
|
call %YARN_CONF_DIR%\yarn-env.cmd
|
|
|
|
)
|
|
|
|
|
|
|
|
set yarn-command=%1
|
|
|
|
call :make_command_arguments %*
|
|
|
|
|
|
|
|
if not defined yarn-command (
|
|
|
|
goto print_usage
|
|
|
|
)
|
|
|
|
|
|
|
|
@rem JAVA and JAVA_HEAP_MAX and set in hadoop-config.cmd
|
|
|
|
|
|
|
|
if defined YARN_HEAPSIZE (
|
|
|
|
@rem echo run with Java heapsize %YARN_HEAPSIZE%
|
|
|
|
set JAVA_HEAP_MAX=-Xmx%YARN_HEAPSIZE%m
|
|
|
|
)
|
|
|
|
|
|
|
|
@rem CLASSPATH initially contains HADOOP_CONF_DIR & YARN_CONF_DIR
|
|
|
|
if not defined HADOOP_CONF_DIR (
|
|
|
|
echo No HADOOP_CONF_DIR set.
|
|
|
|
echo Please specify it either in yarn-env.cmd or in the environment.
|
|
|
|
goto :eof
|
|
|
|
)
|
|
|
|
|
|
|
|
set CLASSPATH=%HADOOP_CONF_DIR%;%YARN_CONF_DIR%;%CLASSPATH%
|
|
|
|
|
|
|
|
@rem for developers, add Hadoop classes to CLASSPATH
|
|
|
|
if exist %HADOOP_YARN_HOME%\yarn-api\target\classes (
|
|
|
|
set CLASSPATH=%CLASSPATH%;%HADOOP_YARN_HOME%\yarn-api\target\classes
|
|
|
|
)
|
|
|
|
|
|
|
|
if exist %HADOOP_YARN_HOME%\yarn-common\target\classes (
|
|
|
|
set CLASSPATH=%CLASSPATH%;%HADOOP_YARN_HOME%\yarn-common\target\classes
|
|
|
|
)
|
|
|
|
|
|
|
|
if exist %HADOOP_YARN_HOME%\yarn-mapreduce\target\classes (
|
|
|
|
set CLASSPATH=%CLASSPATH%;%HADOOP_YARN_HOME%\yarn-mapreduce\target\classes
|
|
|
|
)
|
|
|
|
|
|
|
|
if exist %HADOOP_YARN_HOME%\yarn-master-worker\target\classes (
|
|
|
|
set CLASSPATH=%CLASSPATH%;%HADOOP_YARN_HOME%\yarn-master-worker\target\classes
|
|
|
|
)
|
|
|
|
|
|
|
|
if exist %HADOOP_YARN_HOME%\yarn-server\yarn-server-nodemanager\target\classes (
|
|
|
|
set CLASSPATH=%CLASSPATH%;%HADOOP_YARN_HOME%\yarn-server\yarn-server-nodemanager\target\classes
|
|
|
|
)
|
|
|
|
|
|
|
|
if exist %HADOOP_YARN_HOME%\yarn-server\yarn-server-common\target\classes (
|
|
|
|
set CLASSPATH=%CLASSPATH%;%HADOOP_YARN_HOME%\yarn-server\yarn-server-common\target\classes
|
|
|
|
)
|
|
|
|
|
|
|
|
if exist %HADOOP_YARN_HOME%\yarn-server\yarn-server-resourcemanager\target\classes (
|
|
|
|
set CLASSPATH=%CLASSPATH%;%HADOOP_YARN_HOME%\yarn-server\yarn-server-resourcemanager\target\classes
|
2014-01-25 23:51:10 -05:00
|
|
|
)
|
2014-05-10 20:04:49 -04:00
|
|
|
|
2014-01-25 23:51:10 -05:00
|
|
|
if exist %HADOOP_YARN_HOME%\yarn-server\yarn-server-applicationhistoryservice\target\classes (
|
|
|
|
set CLASSPATH=%CLASSPATH%;%HADOOP_YARN_HOME%\yarn-server\yarn-server-applicationhistoryservice\target\classes
|
2013-10-14 13:01:33 -04:00
|
|
|
)
|
2014-05-10 20:04:49 -04:00
|
|
|
|
2013-10-14 13:01:33 -04:00
|
|
|
if exist %HADOOP_YARN_HOME%\build\test\classes (
|
|
|
|
set CLASSPATH=%CLASSPATH%;%HADOOP_YARN_HOME%\build\test\classes
|
|
|
|
)
|
|
|
|
|
|
|
|
if exist %HADOOP_YARN_HOME%\build\tools (
|
|
|
|
set CLASSPATH=%CLASSPATH%;%HADOOP_YARN_HOME%\build\tools
|
|
|
|
)
|
|
|
|
|
|
|
|
set CLASSPATH=%CLASSPATH%;%HADOOP_YARN_HOME%\%YARN_DIR%\*
|
|
|
|
set CLASSPATH=%CLASSPATH%;%HADOOP_YARN_HOME%\%YARN_LIB_JARS_DIR%\*
|
|
|
|
|
2013-10-28 13:49:40 -04:00
|
|
|
if %yarn-command% == classpath (
|
|
|
|
@echo %CLASSPATH%
|
|
|
|
goto :eof
|
|
|
|
)
|
|
|
|
|
2014-01-25 23:51:10 -05:00
|
|
|
set yarncommands=resourcemanager nodemanager proxyserver rmadmin version jar ^
|
2014-05-10 20:04:49 -04:00
|
|
|
application applicationattempt container node logs daemonlog historyserver ^
|
|
|
|
timelineserver
|
2013-10-28 13:49:40 -04:00
|
|
|
for %%i in ( %yarncommands% ) do (
|
|
|
|
if %yarn-command% == %%i set yarncommand=true
|
|
|
|
)
|
|
|
|
if defined yarncommand (
|
|
|
|
call :%yarn-command%
|
|
|
|
) else (
|
|
|
|
set CLASSPATH=%CLASSPATH%;%CD%
|
|
|
|
set CLASS=%yarn-command%
|
|
|
|
)
|
2013-10-14 13:01:33 -04:00
|
|
|
|
|
|
|
if defined JAVA_LIBRARY_PATH (
|
|
|
|
set YARN_OPTS=%YARN_OPTS% -Djava.library.path=%JAVA_LIBRARY_PATH%
|
|
|
|
)
|
|
|
|
|
|
|
|
set java_arguments=%JAVA_HEAP_MAX% %YARN_OPTS% -classpath %CLASSPATH% %CLASS% %yarn-command-arguments%
|
|
|
|
call %JAVA% %java_arguments%
|
|
|
|
|
|
|
|
goto :eof
|
|
|
|
|
|
|
|
:classpath
|
|
|
|
@echo %CLASSPATH%
|
|
|
|
goto :eof
|
|
|
|
|
|
|
|
:rmadmin
|
2013-10-22 01:38:42 -04:00
|
|
|
set CLASS=org.apache.hadoop.yarn.client.cli.RMAdminCLI
|
2013-10-14 13:01:33 -04:00
|
|
|
set YARN_OPTS=%YARN_OPTS% %YARN_CLIENT_OPTS%
|
|
|
|
goto :eof
|
|
|
|
|
|
|
|
:application
|
|
|
|
set CLASS=org.apache.hadoop.yarn.client.cli.ApplicationCLI
|
|
|
|
set YARN_OPTS=%YARN_OPTS% %YARN_CLIENT_OPTS%
|
2014-01-25 23:51:10 -05:00
|
|
|
set yarn-command-arguments=%yarn-command% %yarn-command-arguments%
|
2013-10-14 13:01:33 -04:00
|
|
|
goto :eof
|
|
|
|
|
2014-01-25 23:51:10 -05:00
|
|
|
:applicationattempt
|
|
|
|
set CLASS=org.apache.hadoop.yarn.client.cli.ApplicationCLI
|
|
|
|
set YARN_OPTS=%YARN_OPTS% %YARN_CLIENT_OPTS%
|
|
|
|
set yarn-command-arguments=%yarn-command% %yarn-command-arguments%
|
|
|
|
goto :eof
|
|
|
|
|
|
|
|
:container
|
|
|
|
set CLASS=org.apache.hadoop.yarn.client.cli.ApplicationCLI
|
|
|
|
set YARN_OPTS=%YARN_OPTS% %YARN_CLIENT_OPTS%
|
|
|
|
set yarn-command-arguments=%yarn-command% %yarn-command-arguments%
|
|
|
|
goto :eof
|
|
|
|
|
2013-10-14 13:01:33 -04:00
|
|
|
:node
|
|
|
|
set CLASS=org.apache.hadoop.yarn.client.cli.NodeCLI
|
|
|
|
set YARN_OPTS=%YARN_OPTS% %YARN_CLIENT_OPTS%
|
|
|
|
goto :eof
|
|
|
|
|
2014-11-06 23:48:31 -05:00
|
|
|
:queue
|
|
|
|
set CLASS=org.apache.hadoop.yarn.client.cli.QueueCLI
|
|
|
|
set YARN_OPTS=%YARN_OPTS% %YARN_CLIENT_OPTS%
|
|
|
|
goto :eof
|
|
|
|
|
2013-10-14 13:01:33 -04:00
|
|
|
:resourcemanager
|
|
|
|
set CLASSPATH=%CLASSPATH%;%YARN_CONF_DIR%\rm-config\log4j.properties
|
|
|
|
set CLASS=org.apache.hadoop.yarn.server.resourcemanager.ResourceManager
|
2013-11-11 22:58:14 -05:00
|
|
|
set YARN_OPTS=%YARN_OPTS% %YARN_RESOURCEMANAGER_OPTS%
|
2013-10-14 13:01:33 -04:00
|
|
|
if defined YARN_RESOURCEMANAGER_HEAPSIZE (
|
|
|
|
set JAVA_HEAP_MAX=-Xmx%YARN_RESOURCEMANAGER_HEAPSIZE%m
|
|
|
|
)
|
|
|
|
goto :eof
|
|
|
|
|
2014-01-25 23:51:10 -05:00
|
|
|
:historyserver
|
2014-05-10 20:04:49 -04:00
|
|
|
@echo DEPRECATED: Use of this command to start the timeline server is deprecated. 1>&2
|
|
|
|
@echo Instead use the timelineserver command for it. 1>&2
|
2014-01-25 23:51:10 -05:00
|
|
|
set CLASSPATH=%CLASSPATH%;%YARN_CONF_DIR%\ahs-config\log4j.properties
|
|
|
|
set CLASS=org.apache.hadoop.yarn.server.applicationhistoryservice.ApplicationHistoryServer
|
|
|
|
set YARN_OPTS=%YARN_OPTS% %HADOOP_HISTORYSERVER_OPTS%
|
2014-02-03 23:44:00 -05:00
|
|
|
if defined YARN_HISTORYSERVER_HEAPSIZE (
|
2014-01-25 23:51:10 -05:00
|
|
|
set JAVA_HEAP_MAX=-Xmx%YARN_HISTORYSERVER_HEAPSIZE%m
|
|
|
|
)
|
|
|
|
goto :eof
|
|
|
|
|
2014-05-10 20:04:49 -04:00
|
|
|
:timelineserver
|
|
|
|
set CLASSPATH=%CLASSPATH%;%YARN_CONF_DIR%\timelineserver-config\log4j.properties
|
|
|
|
set CLASS=org.apache.hadoop.yarn.server.applicationhistoryservice.ApplicationHistoryServer
|
|
|
|
set YARN_OPTS=%YARN_OPTS% %HADOOP_TIMELINESERVER_OPTS%
|
|
|
|
if defined YARN_TIMELINESERVER_HEAPSIZE (
|
|
|
|
set JAVA_HEAP_MAX=-Xmx%YARN_TIMELINESERVER_HEAPSIZE%m
|
|
|
|
)
|
|
|
|
goto :eof
|
|
|
|
|
2013-10-14 13:01:33 -04:00
|
|
|
:nodemanager
|
|
|
|
set CLASSPATH=%CLASSPATH%;%YARN_CONF_DIR%\nm-config\log4j.properties
|
|
|
|
set CLASS=org.apache.hadoop.yarn.server.nodemanager.NodeManager
|
|
|
|
set YARN_OPTS=%YARN_OPTS% -server %HADOOP_NODEMANAGER_OPTS%
|
|
|
|
if defined YARN_NODEMANAGER_HEAPSIZE (
|
|
|
|
set JAVA_HEAP_MAX=-Xmx%YARN_NODEMANAGER_HEAPSIZE%m
|
|
|
|
)
|
|
|
|
goto :eof
|
|
|
|
|
|
|
|
:proxyserver
|
|
|
|
set CLASS=org.apache.hadoop.yarn.server.webproxy.WebAppProxyServer
|
|
|
|
set YARN_OPTS=%YARN_OPTS% %HADOOP_PROXYSERVER_OPTS%
|
|
|
|
if defined YARN_PROXYSERVER_HEAPSIZE (
|
|
|
|
set JAVA_HEAP_MAX=-Xmx%YARN_PROXYSERVER_HEAPSIZE%m
|
|
|
|
)
|
|
|
|
goto :eof
|
|
|
|
|
|
|
|
:version
|
|
|
|
set CLASS=org.apache.hadoop.util.VersionInfo
|
|
|
|
set YARN_OPTS=%YARN_OPTS% %YARN_CLIENT_OPTS%
|
|
|
|
goto :eof
|
|
|
|
|
|
|
|
:jar
|
|
|
|
set CLASS=org.apache.hadoop.util.RunJar
|
|
|
|
set YARN_OPTS=%YARN_OPTS% %YARN_CLIENT_OPTS%
|
|
|
|
goto :eof
|
|
|
|
|
|
|
|
:logs
|
2013-10-22 01:38:42 -04:00
|
|
|
set CLASS=org.apache.hadoop.yarn.client.cli.LogsCLI
|
2013-10-14 13:01:33 -04:00
|
|
|
set YARN_OPTS=%YARN_OPTS% %YARN_CLIENT_OPTS%
|
|
|
|
goto :eof
|
|
|
|
|
|
|
|
:daemonlog
|
|
|
|
set CLASS=org.apache.hadoop.log.LogLevel
|
|
|
|
set YARN_OPTS=%YARN_OPTS% %YARN_CLIENT_OPTS%
|
|
|
|
goto :eof
|
|
|
|
|
|
|
|
@rem This changes %1, %2 etc. Hence those cannot be used after calling this.
|
|
|
|
:make_command_arguments
|
|
|
|
if "%1" == "--config" (
|
|
|
|
shift
|
|
|
|
shift
|
|
|
|
)
|
2014-11-13 00:41:19 -05:00
|
|
|
if "%1" == "--loglevel" (
|
|
|
|
shift
|
|
|
|
shift
|
|
|
|
)
|
2013-10-14 13:01:33 -04:00
|
|
|
if [%2] == [] goto :eof
|
|
|
|
shift
|
|
|
|
set _yarnarguments=
|
|
|
|
:MakeCmdArgsLoop
|
|
|
|
if [%1]==[] goto :EndLoop
|
|
|
|
|
|
|
|
if not defined _yarnarguments (
|
|
|
|
set _yarnarguments=%1
|
|
|
|
) else (
|
|
|
|
set _yarnarguments=!_yarnarguments! %1
|
|
|
|
)
|
|
|
|
shift
|
|
|
|
goto :MakeCmdArgsLoop
|
|
|
|
:EndLoop
|
|
|
|
set yarn-command-arguments=%_yarnarguments%
|
|
|
|
goto :eof
|
|
|
|
|
|
|
|
:print_usage
|
2014-11-13 00:41:19 -05:00
|
|
|
@echo Usage: yarn [--config confdir] [--loglevel loglevel] COMMAND
|
2013-10-14 13:01:33 -04:00
|
|
|
@echo where COMMAND is one of:
|
|
|
|
@echo resourcemanager run the ResourceManager
|
|
|
|
@echo nodemanager run a nodemanager on each slave
|
2014-05-10 20:04:49 -04:00
|
|
|
@echo timelineserver run the timeline server
|
2013-10-14 13:01:33 -04:00
|
|
|
@echo rmadmin admin tools
|
|
|
|
@echo version print the version
|
|
|
|
@echo jar ^<jar^> run a jar file
|
|
|
|
@echo application prints application(s) report/kill application
|
2014-01-25 23:51:10 -05:00
|
|
|
@echo applicationattempt prints applicationattempt(s) report
|
|
|
|
@echo container prints container(s) report
|
2013-10-14 13:01:33 -04:00
|
|
|
@echo node prints node report(s)
|
2014-11-06 23:48:31 -05:00
|
|
|
@echo queue prints queue information
|
2013-10-14 13:01:33 -04:00
|
|
|
@echo logs dump container logs
|
|
|
|
@echo classpath prints the class path needed to get the
|
|
|
|
@echo Hadoop jar and the required libraries
|
|
|
|
@echo daemonlog get/set the log level for each daemon
|
|
|
|
@echo or
|
|
|
|
@echo CLASSNAME run the class named CLASSNAME
|
|
|
|
@echo Most commands print help when invoked w/o parameters.
|
|
|
|
|
|
|
|
endlocal
|