Solr 3.5.0 setup guide

The following article outlines a step-by-step guide of connecting Liferay 6.2 EE to Solr 3.5.0 for the purpose of testing.

Please note that for Liferay Portal 6.2 EE, the supported version of Solr 3 is version 3.5.0.

Resolution

You can follow the below steps to start Solr, Liferay 6.2 EE, and connect them via the Solr 3 EE plugin available on Liferay Marketplace.

  1. Download and unzip Solr 3.5.0 to a convenient location. Treat the root of the unzipped Solr as $solr_home.
  2. Navigate to $solr_home/example and execute java -jar start.jar
  3. Your solr server is now running (on Jetty) on port 8983. You can change the port in $solr_home/example/etc/jetty.xml if you wish to do so. This article assumes you have not changed the port from the default value.
    1. Navigate to http://localhost:8983/solr/admin to validate if Solr is running properly.
    2. You should see Solr’s admin page.Screenshot_2014-11-27_09.00.46.png
  4. Once you’ve confirmed that the server is running, stop the Solr server.
  5. Start up Liferay Portal 6.2 EE SP8. Treat the root of the bundle as $liferay-home.
  6. Download the Solr 3 EE plugin from the marketplace and deploy it to the portal.
  7. Once the plugin is deployed, stop the portal.
  8. Navigate to $liferay-home/tomcat-7.0.42/webapps/solr3-web/WEB-INF/classes/META-INF and edit the file called solr-spring.xml.
    1. Look for the following snippet: 8080/solr" />and change the port to 8983
    2. i.e. 8983/solr" />
  9. Copy the $liferay-home/webapps/solr3-web/WEB-INF/conf/schema.xml to $solr-home/example/solr/conf
  10. Copy the $liferay-home/webapps/solr3-web/WEB-INF/conf/solrconfig.xml to $solr-home/example/solr/conf
  11. Start the Solr server.
  12. Start Liferay Portal
  13. Navigate to the control panel of Liferay, Server Administration section, and execute a full reindex.Screenshot_2014-11-27_09.48.07.png

To test whether the connection is alive, check Solr’s log. Every 10 seconds, Liferay pings the Solr server, which shows up in Solr’s log as such:

Nov 27, 2014 9:34:43 AM org.apache.solr.core.SolrCore execute

INFO: [] webapp=/solr path=/admin/ping params={wt=javabin&version=2} hits=0 status=0 QTime=2

Nov 27, 2014 9:34:43 AM org.apache.solr.core.SolrCore execute

INFO: [] webapp=/solr path=/admin/ping params={wt=javabin&version=2} status=0 QTime=2

To see if the reindex was successful, navigate to Solr’s admin page and click on Search.

Solr should show you everything it has indexed so far:

Screenshot_2014-11-27_09.32.23.png

Common Issues

Not Enough Memory

By default, Jetty starts with 4g heap size and 82mb Perm size. If for some reason this is not enough for your test scenario, you can change the allocated memory by specifying additional parameters:

java -jar -Xmx8g -XX:MaxPermSize=128m start.jar

Note: you can check the memory allocations by running jmap -heap.

In Liferay’s Log

10:42:41,353 WARN [liferay/search_writer/SYSTEM_ENGINE-2][ProxyMessageListener:81] com.liferay.portal.kernel.search.SearchException: Not Found__Not Found__request: http://localhost:8080/solr/update?wt=javabin&version=2 [Sanitized]
  • Make sure you modified the solr-spring.xml to point to the correct location (see step 8 above).
  • If you modified the solr-spring.xml, you’ll need to restart Liferay Portal.

Additional Information

  1. Why do I need to install Solr on a separate application server? Can't I install it in conjunction with Liferay?

    Sure you could, but that defeats the purpose of using Solr, because the goal is to offload search indexing to another box in order to free up processing for your Liferay installation(s).

  2. Why do I get "SolrException: Bad Request" errors?

    You most likely forgot add the Schema.xml from the Liferay Solr plugin .war to the $SOLR_HOME/conf.

  3. Why do I get "SolrException: Not Found" errors?

    You most likely set the URL of the Solr home incorrectly in the Solr-Spring.xml.

  4. How do I migrate from Lucene?

    Simply follow the above steps and reindex (there aren't any special "migration" steps). In regards to the reindex:

  5. How long will the reindexing take?

    It depends on many factors: the size of the data to be re-indexed, the Solr server's JVM settings and application configurations as well as the deployment type of your Solr instance: single-node or SolrCloud. The usual time it takes to reindex your full portal using the default Lucene engine can provide a rough estimation.

    Click the link for more information about Solr's Performance Factors.

  6. Is there a way to reindex without taking the production down?

    Yes. Switching to Solr on a running Liferay server is a seamless process and doesn't require to take the production server down as long as both Liferay's Solr plugin and the Solr server are properly configured.

  7. What will happen to my portal while the reindexing has taken place?

    There is no difference between the default Lucene engine and Solr server in terms of Liferay portal's availability during reindexing: until the process is finished, searches may yield zero results or incorrect counts. Therefore, it's better to schedule the full-server reindex at a time when the load on your server is lowest.

这篇文章有帮助吗?
0 人中有 0 人觉得有帮助