-
Notifications
You must be signed in to change notification settings - Fork 10
/
elasticsearchw-update.cmd
111 lines (92 loc) · 3.96 KB
/
elasticsearchw-update.cmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
@echo off
setlocal
set SERVICE_NAME=elasticsearch
set ES_VERSION=@@ES_VERSION@@
set ES_BITS=@@ES_BITS@@
for %%I in ("%~dp0..") do set ES_HOME=%%~dpfI
set ES_LIB=%ES_HOME%\lib
set PRUNSRV=%ES_HOME%\bin\%SERVICE_NAME%w
rem Initial memory pool size in MB.
set JVM_MS=1024
rem Maximum memory pool size in MB.
set JVM_MX=1024
rem Other options.
rem NB the pound (#) and semicolon (;) are separator characters.
rem Force the JVM to use IPv4 stack
rem JVM_OPTIONS=%JVM_OPTIONS% -Djava.net.preferIPv4Stack=true
rem GC configuration.
set JVM_OPTIONS=%JVM_OPTIONS% -XX:+UseConcMarkSweepGC
set JVM_OPTIONS=%JVM_OPTIONS% -XX:CMSInitiatingOccupancyFraction=75
set JVM_OPTIONS=%JVM_OPTIONS% -XX:+UseCMSInitiatingOccupancyOnly
rem Pre-touch memory pages used by the JVM during initialization.
set JVM_OPTIONS=%JVM_OPTIONS% -XX:+AlwaysPreTouch
REM GC logging options -- uncomment to enable
REM JVM_OPTIONS=%JVM_OPTIONS% -XX:+PrintGCDetails
REM JVM_OPTIONS=%JVM_OPTIONS% -XX:+PrintGCTimeStamps
REM JVM_OPTIONS=%JVM_OPTIONS% -XX:+PrintGCDateStamps
REM JVM_OPTIONS=%JVM_OPTIONS% -XX:+PrintClassHistogram
REM JVM_OPTIONS=%JVM_OPTIONS% -XX:+PrintTenuringDistribution
REM JVM_OPTIONS=%JVM_OPTIONS% -XX:+PrintGCApplicationStoppedTime
REM JVM_OPTIONS=%JVM_OPTIONS% -Xloggc:%ES_HOME%/logs/gc.log
REM By default, the GC log file will not rotate.
REM By uncommenting the lines below, the GC log file
REM will be rotated every 128MB at most 32 times.
REM -XX:+UseGCLogFileRotation
REM -XX:NumberOfGCLogFiles=32
REM -XX:GCLogFileSize=128M
REM Causes the JVM to dump its heap on OutOfMemory.
set JVM_OPTIONS=%JVM_OPTIONS% -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 JVM_OPTIONS=%JVM_OPTIONS% -XX:HeapDumpPath=$ES_HOME/logs/heapdump.hprof
REM Ensure UTF-8 encoding by default (e.g. filenames)
set JVM_OPTIONS=%JVM_OPTIONS% -Dfile.encoding=UTF-8
REM Use our provided JNA always versus the system one
set JVM_OPTIONS=%JVM_OPTIONS% -Djna.nosys=true
REM turn off a JDK optimization that throws away stack traces for common
REM exceptions because stack traces are important for debugging
set JVM_OPTIONS=%JVM_OPTIONS% -XX:-OmitStackTraceInFastThrow
REM use old-style file permissions on JDK9
set JVM_OPTIONS=%JVM_OPTIONS% -Djdk.io.permissionsUseCanonicalPath=true
REM Flags to configure Netty
set JVM_OPTIONS=%JVM_OPTIONS% -Dio.netty.noUnsafe=true
set JVM_OPTIONS=%JVM_OPTIONS% -Dio.netty.noKeySetOptimization=true
set JVM_OPTIONS=%JVM_OPTIONS% -Dio.netty.recycler.maxCapacityPerThread=0
REM log4j 2
set JVM_OPTIONS=%JVM_OPTIONS% -Dlog4j.shutdownHookEnabled=false
set JVM_OPTIONS=%JVM_OPTIONS% -Dlog4j2.disable.jmx=true
set JVM_CLASSPATH=%ES_LIB%\*
set JVM=auto
if exist "%ES_HOME%\jre\bin\server\jvm.dll" set JVM=%ES_HOME%\jre\bin\server\jvm.dll
if exist "%ES_HOME%\jre\bin\client\jvm.dll" set JVM=%ES_HOME%\jre\bin\client\jvm.dll
"%PRUNSRV%" //US//%SERVICE_NAME% ^
--Jvm "%JVM%" ^
--DisplayName "Elasticsearch v%ES_VERSION% (%ES_BITS%-bit)" ^
--StdOutput auto ^
--StdError auto ^
--LogPath "%ES_HOME%\logs" ^
--StartPath "%ES_HOME%" ^
--StartMode jvm ^
--StartClass org.elasticsearch.bootstrap.Elasticsearch ^
--StartMethod main ^
--StartParams --quiet ^
--StopMode jvm ^
--StopClass org.elasticsearch.bootstrap.Elasticsearch ^
--StopMethod close ^
--Classpath "%JVM_CLASSPATH%" ^
--JvmMs %JVM_MS% ^
--JvmMx %JVM_MX% ^
%JVM_OPTIONS: = ++JvmOptions % ^
++JvmOptions "-Des.path.home=%ES_HOME%" ^
++JvmOptions "-Des.path.conf=%ES_HOME%\config" ^
++JvmOptions "-Des.distribution.flavor=oss" ^
++JvmOptions "-Des.distribution.type=zip"
rem These settings are saved in the Windows Registry at:
rem
rem HKEY_LOCAL_MACHINE\SOFTWARE\Apache Software Foundation\Procrun 2.0\elasticsearch
rem
rem OR, on windows 64-bit procrun always uses the 32-bit registry at:
rem
rem HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Apache Software Foundation\Procrun 2.0\elasticsearch
rem
rem See http://commons.apache.org/daemon/procrun.html