A service wrapper execution for elasticsearch using Java Service Wrapper.
Simply place the service
directory under the elasticsearch bin
directory and edit the elasticsearch.conf
file to point to the correct elasticsearch home path.
ElasticSearch can be run as a service using the elasticsearch
script located under bin/service
location. The script accepts a single parameter with the following values:
Parameter | Description |
---|---|
console | Run the elasticsearch in the foreground. |
start | Run elasticsearch in the background. |
stop | Stops elasticsearch if its running. |
install | Install elasticsearch to run on system startup (init.d / service). |
remove | Removes elasticsearch from system startup (init.d / service). |
The service uses Java Service Wrapper which is a small native wrapper around the Java virtual machine which also monitors it.
Note, passing JVM level configuration (such as -X parameters) should be set within the elasticsearch.conf
file.
The ES_HEAP_SIZE
environment variable controls the maximum memory allocation for the JVM (set in megabytes). It defaults to 1024
.
This requires a commercial license for Java Service Wrapper. Licenses are bound to a specific machine, so make sure you send the correct host id when ordering the license.
Once you have your license information, paste the extra wrapper.license.*
lines into the elasticsearch.conf
file. Then download the corresponding windows x86 64 bit build of the JSW.
Copy bin\wrapper.exe
to bin\service\exec\elasticsearch-windows-x86-64.exe
, and lib\wrapper.dll
and lib\wrapper.jar
to bin\service\lib
in your elasticsearch directory. Also make sure you have a 64-bit JRE installed. The service can then be installed and started as described above.