在Windows服务器上运行
Windows用户可以配置Elasticsearch作为服务运行在后台运行,或在启动时自动启动,无需任何用户交互。这可以通过实现service.bat 脚本在 bin/ 文件夹下,它允许一个安装,删除,管理或配置服务和潜在的启动和停止服务,所有的命令行。
c:\elasticsearch-2.3.3\bin>service
Usage: service.bat install|remove|start|stop|manager [SERVICE_ID]
该脚本需要一个参数(要执行的命令),后跟一个可选一表示服务ID(用于安装多个Elasticsearch服务时)。
可用的命令如下:
install
Install Elasticsearch as a service
remove
Remove the installed Elasticsearch service (and stop the service if started)
start
Start the Elasticsearch service (if installed)
stop
Stop the Elasticsearch service (if started)
manager
Start a GUI for managing the installed service
注意,在安装过程中可用的环境配置选项被复制,并将服务生命周期期间使用。这意味着在安装后对他们所做的任何更改将不被拾起,除非该服务被重新安装。
根据现有的JDK / JRE(通过设置的结构JAVA_HOME),相应的64位(x64)或32位(x86)的服务将被安装。此信息是安装过程中提供:
c:\elasticsearch-{version}bin>service install
Installing service : "elasticsearch-service-x64"
Using JAVA_HOME (64-bit): "c:\jvm\jdk1.8"
The service 'elasticsearch-service-x64' has been installed.
Note 而JRE可用于Elasticsearch服务,由于其使用的客户机虚拟机(作为反对服务器JVM这对于长期运行的应用提供了更好的性能)其使用不鼓励和一个将发出警告。
定制服务设置
有两种方式来定制服务设置:
管理器GUI
通过访问管理员命令,图形用户界面提供了洞察安装的服务,包括其状态,启动类型,JVM,除其他事项外启动和停止设置。简单地调用service.bat从上述选项将打开管理器窗口的命令行:
定制service.bat 其核心,service.bat依赖于Apache的百科全书守护工程安装服务。对于完全的灵活性,如定制在其下运行的服务用户,可以修改安装参数进行相应调整所有参数。请注意,这需要重新安装该服务以应用新设置。
Note 也有社会的支持可自定义的MSI安装程序可供选择:https://github.com/salyh/elasticsearch-msi-installer(亨德里克·萨莱)。