knackforge
July 12, 2012
Many times Drupal Architects prefer to go with Apache Solr instead of Drupal core search. I am no outlander to this scenario, but this time it was a new requirement. By default, the Apache Solr relies on the Jetty server to index and retrieve items during the search. My need was to use the Tomcat server in the place of Jetty. The first glance proved it was an easy task, but later the tough fight started.
Initially, I had references from many sites about how to integrate Apache Solr with Tomcat. Alas, none had the elucidation to provide an end-to-end solution. Hence I would like to write one on my own.
Step 1: Download the Apache Tomcat Server from its official site. I would insist you do this rather than installing it via the packet manager.
Step 2: Extract the folder in the /usr/share/
. In a multi-site environment, this would help to run the tomcat as a single instance.
Step 3: Now get into the Tomcat folder and see for the bin folder. Ensure that you have a bin folder there. If you don't find a bin it implies that you are in the wrong directory.
Step 4: Now cd into the bin folder, and issue $sudo -E ./Startup.sh
, this command will start the tomcat server.
-E gets the Java Environment.
If you are prompted with a message as below, it concludes the proper start of the Tomcat.
Using CATALINA_BASE: /usr/share/tomcat7Using CATALINA_HOME: /usr/share/tomcat7Using CATALINA_TMPDIR: /usr/share/tomcat7/tempUsing JRE_HOME: /usr/lib/jvm/javaUsing CLASSPATH: /usr/share/tomcat7/bin/bootstrap.jar:/usr/share/tomcat7/bin/tomcat-juli.jar
JAVA_HOME or JRE_HOME not being defined
" then you need to do$ sudo export JAVA_HOME=/usr/lib/jvm/java
sudo cp -R apache-solr/example/solr/ /usr/share/tomcat7/solr/sudo nano /etc/tomcat7/Catalina/localhost/solr.xmland paste
sudo cp apachesolr/schema.xml /usr/share/tomcat7/solr/conf/schema.xml
sudo cp apachesolr/solrconfig.xml /usr/share/tomcat7/solr/conf/solrconfig.xml
sudo cp apachesolr/elevate.xml /usr/share/tomcat7/solr/conf/elevate.xml
Now set the port as 8080 in the apache Solr configuration page ie: http://knackforge.com:8080 and test the connection. If you are prompted with no errors, it implies the successful integration of tomcat with Solr.
If not please check the permissions and to be in the best case use the below-mentioned one
sudo chown -R tomcat7:root /usr/share/tomcat7/solr/
Note: You can make use of this blog also with Drupal 6+, Apache Solr 1.3+ and Tomat 6+
Just like how your fellow techies do.
We'd love to talk about how we can work together
Take control of your AWS cloud costs that enables you to grow!