java 如何在 Windows 服务器上运行 solr 使其自动启动?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2531038/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to run solr on a windows server so it starts up automatically?
提问by Blankman
How can I run solr on a windows server, so it starts up automatically?
如何在 Windows 服务器上运行 solr,使其自动启动?
I run it with:
我运行它:
java -jar start.jar
but I need the server to do this automatically.
但我需要服务器自动执行此操作。
回答by Tomislav Nakic-Alfirevic
Create a batch file with the command you need and run it on startup: some of theseideas might be of use.
创建你需要并在启动时运行该命令的批处理文件:一些这些想法可能是有用的。
If you ran solr inside tomcat, you could start tomcat as a windows service and set the service to start automatically.
如果您在 tomcat 中运行 solr,您可以将 tomcat 作为 Windows 服务启动并将该服务设置为自动启动。
回答by Tom Lianza
I've had good luck with the "Non-Sucking Service Manager" to do this exact thing. Very simple and lightweight: http://nssm.cc/
我很幸运能与“非吮吸服务经理”一起完成这件事。非常简单和轻量级:http: //nssm.cc/
回答by Josh
The Scheduled Tasks feature in Windows Server will let you configure your command to be executed at startup, without the use of a batch file.
Windows Server 中的计划任务功能可让您将命令配置为在启动时执行,而无需使用批处理文件。
回答by Stéphane
I will add the small solr windwos service installer that I found and updated recently :
我将添加我最近发现并更新的小型 solr windwos 服务安装程序:
https://github.com/serbrech/SolrWindowsService
https://github.com/serbrech/SolrWindowsService
First Update the App.config
首先更新App.config
<add key="JavaExecutable" value="C:\Program Files (x86)\Java\jre6\bin\java.exe" />
<add key="WorkingDirectory" value="C:\Solr\apache-solr-4.0\example" />
<add key="Solr.Home" value="solr" />
<add key="CommandLineArgs" value="-Djava.util.logging.config.file=logging.properties" />
<add key="ShowConsole" value="false" />
<add key="Port" value="8983" />
<add key="InstanceName" value="Pageplanner" />
<add key="ClientSettingsProvider.ServiceUri" value="" />
Then run install.bat That's all there is to it.
然后运行 install.bat 这就是它的全部内容。

