如何从用户创建的 Windows 服务启动和停止 SOLR
我有两个bat文件start.bat和stop.bat用于手动启动和停止SOLR服务器, 我是否可以创建一个 Windows 服务,它将在启动服务时调用 start.bat,并在停止服务时调用 stop.bat
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
考虑使用 Tomcat 的 Solr 多核功能。每个核心就像一个完全成熟的安装,“单独的配置和索引,对于非常不同的应用程序具有自己的配置和模式,但仍然具有统一管理的便利” http://wiki.apache.org/solr/CoreAdmin
即使您不使用多个索引,设置起来也要优雅得多。如果 Tomcat 如此设置,则 Solr 在启动时可用。我假设您使用的是 Solr 1.4。
您需要执行以下步骤:
设置 solr 根目录
概述
solr.xml有以下内容
core 参数指定一个新的 core。这些属性指定,对于服务 http//localhost:8080/mysearchapp/myindex,索引目录为 myindexdir,这将我们带入下一步。
创建实际的核心
概述
设置tomcat
Apache Software Foundation\Tomcat 6.0\conf\Catalina\localhost
创建文件 mysearchapp.xml
重新启动tomcat并打开 http://localhost:8080/mysearchapp/
如果一切顺利,它将显示
Now do your actions on your core like http://本地主机:8080/mysearchapp/myindex/select?q=MY-QUERY
Consider Solr Multicore feature with Tomcat. Each core is like a fully fledged installation, "separate configurations and indexes, with their own config and schema for very different applications, but still have the convenience of unified administration" http://wiki.apache.org/solr/CoreAdmin
Even if you dont use multiple indexes, it's much more elegant to set up. Solr is available on startup if Tomcat is set that way. I assume you are using Solr 1.4.
You need to do these steps:
Set up a solr root directory
Overview
solr.xml has the following contents
The core parameter specifies a new core. The attributes specify that for serving http//localhost:8080/mysearchapp/myindex, the index directory is myindexdir, which brings us to the next step.
Create the actual core
Overview
Set up tomcat
Apache Software Foundation\Tomcat 6.0\conf\Catalina\localhost
Create the file mysearchapp.xml
Restart tomcat and open http://localhost:8080/mysearchapp/
If all goes well it will display
Now do your operations on your core like http://localhost:8080/mysearchapp/myindex/select?q=MY-QUERY
Solr 运行在 Tomcat 等 Servlet 容器之上。因此,要启动 Solr,您必须使用 Servlet 容器配置 Solr,然后启动。
是的,您当然可以创建 Windows 服务。但是您没有提到您使用哪个 Servlet 容器来运行 Solr?
如果是 Apache Tomcat,请执行以下操作:
Solr runs on top of a Servlet container like Tomcat. So for starting Solr you have to configure Solr with your Servlet container and then start.
Yes you can of course create a Windows Service. However you have not mentioned which Servlet container are you using for running Solr?
If it is Apache Tomcat here you go: