Setting up Solr on Linux with JBoss

This is an introductory guide to setting up Solr and then switching Liferay Portal's indexing method to Solr. Keep in mind that this is only one step in creating a cluster for use with Liferay Portal. For further instruction, see Installing Liferay Portal in a Clustered Environment.

Note: Want to see the same process using Tomcat? Read Installing SOLR on a Two-Node Cluster.

Solr is an open source enterprise search server based on the Lucene Java search library, with XML/HTTP and JSON APIs, hit highlighting, faceted search, caching, replication, and a web administration interface. Solr allows the administrator to search structured data without needing to write any custom code.


  • Overall, has the best performance for clustering the indexes
  • Offloads the burden of indexing from the Liferay nodes
  • Centralized index repository
  • Solr has more configuration options that make customization easier


  • If the Solr box goes down, all nodes will have no index. However, there is a distributed/replication setup that gives Solr high availability. Learn More by reading Scaling Lucene and Solr.
  • Fairly involved configuration/setup


In this bare-minimum guide, we'll set up three nodes:

  1. The Solr Node—The node that will do the indexing for the Liferay Portal nodes.
  2. Node 1—This node is running Liferay Portal and is clustered with node 1.
  3. Node 2—This node is running Liferay Portal and is clustered with node 2.

Setting up the Solr Node

  1. Download and unzip its contents.
  2. Create your $SOLR_HOME directory, for instance C:\Program Files\Solr.
    1. Navigate to apache-solr-1.4.0\example and copy the contents of the "solr" folder into your $SOLR_HOME.
  3. Copy the WAR file from the Solr folder you downloaded; it is located in $APACHE-SOLR/dist/apache-solr-${solr.version}.war into $TOMCAT_HOME/webapps where ${solr.version} represents Solr version number, i.e., 1.4.0.
    1. Rename the .war file to something easier, such as solr.war (the name will matter later).
  4. Add the following line to your $TOMCAT_AS_DIR/bin/catalina.bat.
    1. set JAVA_OPTS=%JAVA_OPTS% -Dsolr.solr.home="C:\Program Files\Solr"
  5. Run JBoss and visit the Solr Admin page to verify it runs correctly.

Setting up Node 1

  1. Start a Liferay Portal 6.1 EE GA2 bundle (using tomcat) and deploy solr-web-
  2. Open the .war archive and edit the file solr-spring.xml, which is located in $SOLR_WAR\WEB-INF\classes\META-INF\
  3. Shutdown JBoss / Solr. Copy the Schema located in $SOLR_WAR\WEB-INF\conf\ and place it in the $SOLR_HOME/conf (you may have to create the conf directory) on your Solr box. Now you can go ahead and start JBoss / Solr.
  4. Deploy the Liferay Solr .war with the edited solr-spring.xml into Tomcat-Liferay bundle

Testing SOLR

  1. Create a Wiki.
  2. Navigate to the Solr admin webpage, and search for a term that is contained in your portal's contents.


You should see assets with that term in your search results.

0 人中有 0 人觉得有帮助