Basic SOLR Setup Guide (How-To)

Published on January 2017 | Categories: Documents | Downloads: 47 | Comments: 0 | Views: 221
of 5
Download PDF   Embed   Report

Comments

Content

5/28/13

Knowledge Base (Display)

Basic SOLR setup guide

Print

Description:
This is an introductory guide to setting up Solr and then switching Liferay's indexing method to Solr. Keep in mind that this is only one step in creating a cluster for use with Liferay. Note: If you'd like to see the same process using JBoss on Linux, click here. This is also a good resource if you're unclear on any steps as there are more pictures. 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. Pros 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 Cons 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 Fairly involved configuration/setup

Affected Products:
Liferay Portal 5.2.x EE, 6.0.x EE, 6.1.x EE Windows XP Tomcat 6 Sun JDK 1.6_20 MySQL 5.1.43 Apache Solr 1.4.0 Liferay Solr Plugin Solr Node - the VM running Solr Node 1 - the VM running the first Liferay instance Node 2 - the VM running the second Liferay instance

Resolution:
In this bare-minimum guide, we'll set up three nodes: The Solr node: This is the node that will do the indexing for the Liferay nodes. Node 1: This node is running Liferay and is clustered with node 2. Node 2: This node is running Liferay and is clustered with node 2. Setting up the Solr Node 1. 2. 3. 4. Download Tomcat 6 zip and unzip it. Set your JAVA_HOME Environment variable to the location where you installed the JDK. Download Solr zip and unzip it to a convenient location. Create your $SOLR_HOME directory, for instance C:\Program Files\Solr. Navigate to "apache-solr1.4.0\example" and copy the contents of the "solr" folder into your $SOLR_HOME. 5. 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. Rename the .war file to something easier, such as "solr.war" since the name will matter later. 6. Add following line your $TOMCAT_AS_DIR/bin/catalina.bat. s e tJ A V A _ O P T S = % J A V A _ O P T S %D s o l r . s o l r . h o m e = " C : \ P r o g r a mF i l e s \ S o l r " Note: this only works because we are only running one instance of Solr. For multiple instances on the same
www.liferay.com/group/customer/kbase?p_p_id=2_WAR_knowledgebaseportlet&p_p_lifecycle=0&p_p_state=pop_up&p_p_mode=view&p_p_col_id=column-… 1/5

5/28/13

Knowledge Base (Display)

Tomcat server, you would need to create a Tomcat Context XML file. 7. Run Tomcat. If there are no errors, browse to http://localhost:8080/solr/admin and check if you see the Solr Admin page. Note: the "solr" part of the URL will be whatever you named the .war file

Setting up Node 1 1. Install a database and make sure to allow remote connections 2. Download the Liferay bundle, delete the lucene folder located in $LIFERAY_HOME/data/ just to make sure we are using Solr 3. Setup a portal-ext.properties file with the appropriate JDBC configurations. For informational purposes, you may add this property: web.server.display.node=true which will show which node you are currently logged into. 4. Download the appropriate Solr plugin from http://www.liferay.com/group/customer/downloads/plugins 5. Open the .war archive and edit the file, solr-spring.xml, located in $SOLR_WAR\WEB-INF\classes\META-INF\ Look for the bean class which sets the location(s) of the Solr server. It should look something like this: <bean class="com.liferay.portal.spring.context.PortletBeanFactoryPostProcessor" /> <bean id="solrServer" class="com.liferay.portal.search.solr.server.BasicAuthSolrServer"> <constructor-arg type="java.lang.String" value="http://localhost:8080/solr/" /> Change the value to point to where your $SOLR_HOME is setup. It should look something like this: http://$IP_OF_SOLR_SERVER:8080/solr/ 6. 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 Solr. 7. Put your edited Solr plugin .war file and place it in the Deploy folder, startup the Node 1 Tomcat Server. Setting up Node 2 1. Download and install Liferay to the Tomcat server (a bundle may be used) 2. Setup a portal-ext.properties file with the appropriate JDBC configurations to connect to the database in Node 1. For more information on this, see our article on clustered environments. 3. Deploy the modified Solr .war file that you deployed on Node 1. Testing SOLR Start Liferay on both Nodes. Make sure they both startup correctly before trying to verify if Solr is configured correctly.

www.liferay.com/group/customer/kbase?p_p_id=2_WAR_knowledgebaseportlet&p_p_lifecycle=0&p_p_state=pop_up&p_p_mode=view&p_p_col_id=column-…

2/5

5/28/13

Knowledge Base (Display)

A. Create a User An easy way to test Solr is to create a user in Node 1 and see if the Node2 reflects the changes. Remember to check both ways. If you can see the new user in Node 2, then you have successfully configured Solr. B. Create a wiki Another way you may want to test Solr is to create a wiki in Liferay, then see if you can search for it through the Solr admin console. 1. For example, create a wiki named "chocolate", in the body put "chocolate", and finally add a tag named "chocolate". 2. Navigate to the Solr admin webpage, and search for "chocolate"

3. If Solr was configured correctly, you should see the search result with the wiki we created

www.liferay.com/group/customer/kbase?p_p_id=2_WAR_knowledgebaseportlet&p_p_lifecycle=0&p_p_state=pop_up&p_p_mode=view&p_p_col_id=column-…

3/5

5/28/13

Knowledge Base (Display)

Expected Behavior Each Liferay node sends requests to the search engine to update the search index when needed, and these updates are then queued and handled automatically by the search engine, independently. Here is an example of Solr making changes to the index.

www.liferay.com/group/customer/kbase?p_p_id=2_WAR_knowledgebaseportlet&p_p_lifecycle=0&p_p_state=pop_up&p_p_mode=view&p_p_col_id=column-…

4/5

5/28/13

Knowledge Base (Display)

Additional Information:
http://www.lucidimagination.com/Community/Hear-from-the-Experts/Articles/Scaling-Lucene-and-Solr http://www.craftyfella.com/2009/12/installing-solr-14-on-windows-xp-step.html 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.

Important: Information about products not created by Liferay is provided for informational purposes only and does not constitute Liferay Support recommendation nor endorsement. Liferay also does not assume any responsibility for any instructions herein or referenced regarding these products.

www.liferay.com/group/customer/kbase?p_p_id=2_WAR_knowledgebaseportlet&p_p_lifecycle=0&p_p_state=pop_up&p_p_mode=view&p_p_col_id=column-…

5/5

Sponsor Documents

Or use your account on DocShare.tips

Hide

Forgot your password?

Or register your new account on DocShare.tips

Hide

Lost your password? Please enter your email address. You will receive a link to create a new password.

Back to log-in

Close