如何在apache tomcat 7中集成apache solr?

How to integrate apache solr in apache tomcat 7?

有什么方法可以在 tomcat 7 中集成 apache solr 还是我必须 运行 在我的应用程序中有两个服务器?可以在 运行 apache solr 中 tomcat 而不是单独的服务器吗?

官方回答是:运行它是一个独立的应用程序。

No Longer Supported

Beginning with Solr 5.0, Support for deploying Solr as a WAR in servlet containers like Tomcat is no longer supported.

For information on how to install Solr as a standalone server, please see Installing Solr.

可以找到有关此举决定的背景 on the Solr Wiki

Solr is intended to be a server not a Java web application, similar to mysql or the Apache web server. When Solr was first created, designing it as a web application was a convenient choice, to avoid writing a lot of tricky code to build a network layer. These days, this design decision has become a limiting factor.

When you download Solr and install it onto your machine, it should be Solr that gets started. It should not be necessary to install Solr into a third-party application (servlet container) before it will work.

At this time, Solr is still a webapp, but this is an internal implementation detail, not an immutable property. The intention is to make Solr into a completely standalone application. Startup scripts that start the included container are the first step towards that goal. Jetty might still be the technology used once Solr is a standalone application, but if that happens, it will be internally embedded.

Solr 仍然是一个网络应用程序。他们建议不要在另一个 servlet 容器中使用它,因为他们没有推荐和测试它。

他们提供了一个经过全面测试的系统,不希望其他人(开发人员)花时间用其他容器对其进行测试。

我用的是solr 3.4版本,部署在tomcat服务器的8080端口。 我的应用程序部署在另一个 tomcat 的 8080 端口,并且在另一台机器上。

我创建了 solr war 并在 tomcat 中部署了它。并且只有该服务器的 8080 端口被打开并且只能被我们的应用程序访问。

我不确定 solr 版本 5 ...即是否可以部署在 jetty 以外的其他容器中...但我认为它可以部署在 tomcat 中...您需要尝试相同的...

另一件事是不要在同一个容器或单个容器中部署应用程序 war 和 solr war。原因是,如果其中一个应用程序出现故障,一切都会出现故障。

就像如果 solr 宕机那么应用程序可能会宕机,这对应用程序来说不是一件好事。