You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by pt...@apache.org on 2013/12/19 07:25:15 UTC

[03/12] git commit: storm cmd scripts

storm cmd scripts


Project: http://git-wip-us.apache.org/repos/asf/incubator-storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-storm/commit/ed7e0f85
Tree: http://git-wip-us.apache.org/repos/asf/incubator-storm/tree/ed7e0f85
Diff: http://git-wip-us.apache.org/repos/asf/incubator-storm/diff/ed7e0f85

Branch: refs/heads/master
Commit: ed7e0f85b25d58bf08bf3c7cb28c1e7b40956f49
Parents: 2be4a08
Author: David Lao <da...@microsoft.com>
Authored: Fri Jun 21 11:23:48 2013 -0700
Committer: David Lao <da...@microsoft.com>
Committed: Fri Jun 21 11:23:48 2013 -0700

----------------------------------------------------------------------
 bin/storm-config.cmd |  95 +++++++++++++++++++++++
 bin/storm.cmd        | 186 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 281 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-storm/blob/ed7e0f85/bin/storm-config.cmd
----------------------------------------------------------------------
diff --git a/bin/storm-config.cmd b/bin/storm-config.cmd
new file mode 100644
index 0000000..9b3d777
--- /dev/null
+++ b/bin/storm-config.cmd
@@ -0,0 +1,95 @@
+@echo off
+
+set STORM_HOME=%~dp0
+for %%i in (%STORM_HOME%.) do (
+  set STORM_HOME=%%~dpi
+)
+if "%STORM_HOME:~-1%" == "\" (
+  set STORM_HOME=%STORM_HOME:~0,-1%
+)
+
+if not exist %STORM_HOME%\storm*.jar (
+    @echo +================================================================+
+    @echo ^|      Error: STORM_HOME is not set correctly                   ^|
+    @echo +----------------------------------------------------------------+
+    @echo ^| Please set your STORM_HOME variable to the absolute path of   ^|
+    @echo ^| the directory that contains the storm distribution            ^|
+    @echo +================================================================+
+    exit /b 1
+)
+
+set STORM_BIN_DIR=%STORM_HOME%\bin
+set STORM_SBIN_DIR=%STORM_HOME%\sbin
+
+if not defined STORM_CONF_DIR (
+  set STORM_CONF_DIR=%STORM_HOME%\conf
+)
+
+@rem
+@rem setup java environment variables
+@rem
+
+if not defined JAVA_HOME (
+  set JAVA_HOME=c:\apps\java\openjdk7
+)
+
+if not exist %JAVA_HOME%\bin\java.exe (
+  echo Error: JAVA_HOME is incorrectly set.
+  goto :eof
+)
+
+set JAVA=%JAVA_HOME%\bin\java
+set JAVA_HEAP_MAX=-Xmx1024m
+
+@rem
+@rem check envvars which might override default args
+@rem
+
+if defined STORM_HEAPSIZE (
+  set JAVA_HEAP_MAX=-Xmx%STORM_HEAPSIZE%m
+)
+
+@rem
+@rem CLASSPATH initially contains %STORM_CONF_DIR%
+@rem
+
+set CLASSPATH=%STORM_HOME%\*;%STORM_CONF_DIR%
+set CLASSPATH=!CLASSPATH!;%JAVA_HOME%\lib\tools.jar
+
+@rem
+@rem add libs to CLASSPATH
+@rem
+
+set CLASSPATH=!CLASSPATH!;%STORM_HOME%\lib\*
+
+@rem
+@rem add sbin to CLASSPATH
+@rem
+
+set CLASSPATH=!CLASSPATH!;%STORM_HOME%\sbin\*
+
+if not defined STORM_LOG_DIR (
+  set STORM_LOG_DIR=%STORM_HOME%\logs
+)
+
+if not defined STORM_LOGFILE (
+  set STORM_LOGFILE=storm.log
+)
+
+if not defined STORM_ROOT_LOGGER (
+  set STORM_ROOT_LOGGER=INFO,console,DRFA
+)
+
+set STORM_OPTS=-Dstorm.home=%STORM_HOME% -Djava.library.path=sbin -Dlog4j.configuration=storm.log.properties
+set STORM_OPTS=%STORM_OPTS% -Dstorm.log.dir=%STORM_LOG_DIR%
+set STORM_OPTS=%STORM_OPTS% -Dstorm.root.logger=%STORM_ROOT_LOGGER%
+
+if not defined STORM_SERVER_OPTS (
+  set STORM_SERVER_OPTS=-server
+)
+
+if not defined STORM_CLIENT_OPTS (
+  set STORM_CLIENT_OPTS=-client
+)
+
+:eof

http://git-wip-us.apache.org/repos/asf/incubator-storm/blob/ed7e0f85/bin/storm.cmd
----------------------------------------------------------------------
diff --git a/bin/storm.cmd b/bin/storm.cmd
new file mode 100644
index 0000000..5d97753
--- /dev/null
+++ b/bin/storm.cmd
@@ -0,0 +1,186 @@
+@echo off
+@rem The storm command script
+@rem
+@rem Environment Variables
+@rem
+@rem   JAVA_HOME        The java implementation to use.  Overrides JAVA_HOME.
+@rem
+@rem   STORM_CLASSPATH Extra Java CLASSPATH entries.
+@rem
+@rem   STORM_HEAPSIZE  The maximum amount of heap to use, in MB.
+@rem                    Default is 1000.
+@rem
+@rem   STORM_OPTS      Extra Java runtime options.
+@rem
+@rem   STORM_CONF_DIR  Alternate conf dir. Default is ${STORM_HOME}/conf.
+@rem
+@rem   STORM_ROOT_LOGGER The root appender. Default is INFO,console
+@rem
+
+:main
+  setlocal enabledelayedexpansion
+
+  call %~dp0storm-config.cmd
+
+  set storm-command=%1
+  if not defined storm-command (
+      goto print_usage
+  )
+
+  call :make_command_arguments %*
+
+  set shellcommands=classpath help version
+  for %%i in ( %shellcommands% ) do (
+    if %storm-command% == %%i set shellcommand=true
+  )
+  if defined shellcommand (
+    call :%storm-command%
+    goto :eof
+  )
+
+  set corecommands=activate deactivate dev-zookeeper drpc kill list nimbus rebalance repl shell supervisor ui zookeeper
+  for %%i in ( %corecommands% ) do (
+    if %storm-command% == %%i set corecommand=true  
+  )
+  if defined corecommand (
+    call :%storm-command% %storm-command-arguments%
+  ) else (
+    set CLASS=%storm-command%
+  )
+
+  if %storm-command% == jar (
+    set STORM_OPTS=%STORM_CLIENT_OPTS% %STORM_OPTS% -Dstorm.jar=%2
+    set CLASS=%3
+    set storm-command-arguments=%4 %5 %6 %7 %8 %9
+  )
+  
+  if not defined STORM_LOG_FILE (
+    set STORM_LOG_FILE=-Dlogfile.name=%storm-command%.log
+  )
+
+  if defined STORM_DEBUG ( 
+    %JAVA% %JAVA_HEAP_MAX% %STORM_OPTS% %STORM_LOG_FILE% %CLASS% %storm-command-arguments%
+  )
+  set path=%STORM_BIN_DIR%;%STORM_SBIN_DIR%;%windir%\system32;%windir%
+  call %JAVA% %JAVA_HEAP_MAX% %STORM_OPTS% %STORM_LOG_FILE% %CLASS% %storm-command-arguments%
+  goto :eof
+
+:activate
+  set CLASS=backtype.storm.command.activate
+  set STORM_OPTS=%STORM_CLIENT_OPTS% %STORM_OPTS%
+  goto :eof
+
+:classpath
+  echo %CLASSPATH% 
+  goto :eof
+
+:deactivate
+  set CLASS=backtype.storm.command.deactivate
+  set STORM_OPTS=%STORM_CLIENT_OPTS% %STORM_OPTS%
+  goto :eof
+
+:dev-zookeeper
+  set CLASS=backtype.storm.command.dev_zookeeper
+  set STORM_OPTS=%STORM_SERVER_OPTS% %STORM_OPTS%
+  goto :eof
+
+:drpc
+  set CLASS=backtype.storm.daemon.drpc
+  set STORM_OPTS=%STORM_SERVER_OPTS% %STORM_OPTS%
+  goto :eof
+
+:help
+  call :print_usage
+  goto :eof
+
+:kill
+  set CLASS=backtype.storm.command.kill_topology
+  set STORM_OPTS=%STORM_CLIENT_OPTS% %STORM_OPTS%
+  goto :eof
+
+:list
+  set CLASS=backtype.storm.command.list
+  set STORM_OPTS=%STORM_CLIENT_OPTS% %STORM_OPTS%
+  goto :eof
+
+:nimbus
+  set CLASS=backtype.storm.daemon.nimbus
+  set STORM_OPTS=%STORM_SERVER_OPTS% %STORM_OPTS%
+  goto :eof
+
+:rebalance
+  set CLASS=backtype.storm.command.rebalance
+  set STORM_OPTS=%STORM_CLIENT_OPTS% %STORM_OPTS%
+  goto :eof
+
+:repl
+  set CLASS=clojure.main
+  set STORM_OPTS=%STORM_CLIENT_OPTS% %STORM_OPTS%
+  goto :eof
+
+:shell
+  set CLASS=backtype.storm.command.shell_submission
+  set STORM_OPTS=%STORM_CLIENT_OPTS% %STORM_OPTS% 
+  goto :eof
+  
+:supervisor
+  set CLASS=backtype.storm.daemon.supervisor
+  set STORM_OPTS=%STORM_SERVER_OPTS% %STORM_OPTS%
+  goto :eof
+
+:ui
+  set CLASS=backtype.storm.ui.core
+  set STORM_OPTS=%STORM_SERVER_OPTS% %STORM_OPTS%
+  goto :eof
+
+:zookeeper
+  set CLASS=org.apache.zookeeper.server.quorum.QuorumPeerMain
+  set STORM_OPTS=%STORM_SERVER_OPTS% %STORM_OPTS%
+  goto :eof
+
+:version
+  type RELEASE
+  goto :eof
+
+:make_command_arguments
+  if "%2" == "" goto :eof
+  set _count=0
+  set _shift=1
+  for %%i in (%*) do (
+    set /a _count=!_count!+1
+    if !_count! GTR %_shift% ( 
+	if not defined _arguments (
+	  set _arguments=%%i
+	) else (
+          set _arguments=!_arguments! %%i
+	)
+    )
+  )
+  set storm-command-arguments=%_arguments%
+  goto :eof
+
+:print_usage
+  @echo Usage: storm COMMAND
+  @echo where COMMAND is one of:
+  @echo   activate             activates the specified topology's spouts
+  @echo   classpath            prints the classpath used by the storm client when running commands
+  @echo   deactivatea          deactivates the specified topology's spouts
+  @echo   dev-zookeeper        launches a fresh dev/test Zookeeper server
+  @echo   drpc                 launches a DRPC daemon
+  @echo   help
+  @echo   jar ^<jar^>            run a jar file
+  @echo   kill                 kills the topology with the name topology-name
+  @echo   list                 list the running topologies and their statuses
+  @echo   nimbus               launches the nimbus daemon
+  @echo   rebalance            redistribute or change the parallelism of a running topology
+  @echo   repl                 opens up a Clojure REPL
+  @echo   shell                storm shell
+  @echo   supervisor           launches the supervisor daemon
+  @echo   ui                   launches the UI daemon
+  @echo   version              print the version
+  @echo.
+  @echo  or
+  @echo   CLASSNAME            run the class named CLASSNAME
+  @echo Most commands print help when invoked w/o parameters.
+
+endlocal