2010-02-08 08:30:06 -05:00
|
|
|
@echo off
|
|
|
|
|
|
|
|
SETLOCAL
|
|
|
|
|
|
|
|
if NOT DEFINED JAVA_HOME goto err
|
|
|
|
|
|
|
|
set SCRIPT_DIR=%~dp0
|
|
|
|
for %%I in ("%SCRIPT_DIR%..") do set ES_HOME=%%~dpfI
|
|
|
|
|
|
|
|
|
|
|
|
REM ***** JAVA options *****
|
|
|
|
|
2011-03-23 12:07:00 -04:00
|
|
|
if "%ES_MIN_MEM%" == "" (
|
|
|
|
set ES_MIN_MEM=256m
|
|
|
|
)
|
|
|
|
|
|
|
|
if "%ES_MAX_MEM%" == "" (
|
|
|
|
set ES_MAX_MEM=1g
|
|
|
|
)
|
|
|
|
|
2012-02-06 15:09:32 -05:00
|
|
|
if NOT "%ES_HEAP_SIZE%" == "" (
|
|
|
|
set ES_MIN_MEM=%ES_HEAP_SIZE%
|
|
|
|
set ES_MAX_MEM=%ES_HEAP_SIZE%
|
|
|
|
)
|
|
|
|
|
2011-03-23 12:07:00 -04:00
|
|
|
set JAVA_OPTS=%JAVA_OPTS% -Xms%ES_MIN_MEM% -Xmx%ES_MAX_MEM%
|
2012-02-06 15:09:32 -05:00
|
|
|
|
|
|
|
if NOT "%ES_HEAP_NEWSIZE%" == "" (
|
|
|
|
set JAVA_OPTS=%JAVA_OPTS% -Xmn%ES_HEAP_NEWSIZE%
|
|
|
|
)
|
|
|
|
|
2012-07-31 09:06:21 -04:00
|
|
|
if NOT "%ES_DIRECT_SIZE%" == "" (
|
|
|
|
set JAVA_OPTS=%JAVA_OPTS% -XX:MaxDirectMemorySize=%ES_DIRECT_SIZE%
|
|
|
|
)
|
|
|
|
|
2012-04-29 10:16:41 -04:00
|
|
|
set JAVA_OPTS=%JAVA_OPTS% -Xss256k
|
2011-03-23 12:07:00 -04:00
|
|
|
|
|
|
|
REM Enable aggressive optimizations in the JVM
|
|
|
|
REM - Disabled by default as it might cause the JVM to crash
|
|
|
|
REM set JAVA_OPTS=%JAVA_OPTS% -XX:+AggressiveOpts
|
|
|
|
|
|
|
|
set JAVA_OPTS=%JAVA_OPTS% -XX:+UseParNewGC
|
|
|
|
set JAVA_OPTS=%JAVA_OPTS% -XX:+UseConcMarkSweepGC
|
2012-02-06 15:11:22 -05:00
|
|
|
|
2011-03-23 12:07:00 -04:00
|
|
|
set JAVA_OPTS=%JAVA_OPTS% -XX:CMSInitiatingOccupancyFraction=75
|
|
|
|
set JAVA_OPTS=%JAVA_OPTS% -XX:+UseCMSInitiatingOccupancyOnly
|
|
|
|
|
2012-01-26 06:52:43 -05:00
|
|
|
REM When running under Java 7
|
|
|
|
REM JAVA_OPTS=%JAVA_OPTS% -XX:+UseCondCardMark
|
|
|
|
|
2011-03-23 12:07:00 -04:00
|
|
|
REM GC logging options -- uncomment to enable
|
|
|
|
REM JAVA_OPTS=%JAVA_OPTS% -XX:+PrintGCDetails
|
|
|
|
REM JAVA_OPTS=%JAVA_OPTS% -XX:+PrintGCTimeStamps
|
|
|
|
REM JAVA_OPTS=%JAVA_OPTS% -XX:+PrintClassHistogram
|
|
|
|
REM JAVA_OPTS=%JAVA_OPTS% -XX:+PrintTenuringDistribution
|
|
|
|
REM JAVA_OPTS=%JAVA_OPTS% -XX:+PrintGCApplicationStoppedTime
|
|
|
|
REM JAVA_OPTS=%JAVA_OPTS% -Xloggc:/var/log/elasticsearch/gc.log
|
|
|
|
|
|
|
|
REM Causes the JVM to dump its heap on OutOfMemory.
|
|
|
|
set JAVA_OPTS=%JAVA_OPTS% -XX:+HeapDumpOnOutOfMemoryError
|
|
|
|
REM The path to the heap dump location, note directory must exists and have enough
|
|
|
|
REM space for a full heap dump.
|
|
|
|
REM JAVA_OPTS=%JAVA_OPTS% -XX:HeapDumpPath=$ES_HOME/logs/heapdump.hprof
|
|
|
|
|
2014-06-27 07:02:26 -04:00
|
|
|
REM Disables explicit GC
|
|
|
|
set JAVA_OPTS=%JAVA_OPTS% -XX:+DisableExplicitGC
|
|
|
|
|
2012-06-26 10:45:29 -04:00
|
|
|
set ES_CLASSPATH=%ES_CLASSPATH%;%ES_HOME%/lib/${project.build.finalName}.jar;%ES_HOME%/lib/*;%ES_HOME%/lib/sigar/*
|
2011-11-16 14:00:48 -05:00
|
|
|
set ES_PARAMS=-Delasticsearch -Des-foreground=yes -Des.path.home="%ES_HOME%"
|
2010-02-08 08:30:06 -05:00
|
|
|
|
2014-07-06 05:30:11 -04:00
|
|
|
TITLE Elasticsearch ${project.version}
|
|
|
|
|
2014-01-06 15:58:46 -05:00
|
|
|
"%JAVA_HOME%\bin\java" %JAVA_OPTS% %ES_JAVA_OPTS% %ES_PARAMS% %* -cp "%ES_CLASSPATH%" "org.elasticsearch.bootstrap.Elasticsearch"
|
2010-02-08 08:30:06 -05:00
|
|
|
goto finally
|
|
|
|
|
|
|
|
|
|
|
|
:err
|
|
|
|
echo JAVA_HOME environment variable must be set!
|
|
|
|
pause
|
|
|
|
|
|
|
|
|
|
|
|
:finally
|
|
|
|
|
2014-01-06 15:58:46 -05:00
|
|
|
ENDLOCAL
|