Search on Drupal 7 using Apache Solr Part 6 - configure apache solr + tomcat

  • Tutorial

After a long break, I decided to write another article about apache solr and drupal. This time we will talk about configuring tomcat so that apache solr can work like a daemon. There are already many different tomcat configuration manuals on the Internet, but they are not always suitable for working with drupal. In particular, I configured tomcat and apache solr worked fine. But after I replaced the standard sol configs with drupal configs, the sol stopped working (java executions started to crash).


So let's get down to business.

My configuration

Ubuntu server 12.04
Apache solr 3.6.1
Drupal 7
Search Modules - search api and search_api_solr

And now the installation

Install tomcat

sudo apt-get install tomcat6

Download and unpack apache solr in a temporary directory

mkdir /tmp/solr/ 
cd /tmp/solr/
wget http://archive.apache.org/dist/lucene/solr/3.6.1/apache-solr-3.6.1.tgz
tar xzvf apache-solr-3.6.1.tgz

Then create a directory in which it will work on the Apache solr server and copy the necessary files there
sudo mkdir /var/solr
Копируем war файл
sudo cp apache-solr-3.6.1/dist/apache-solr-3.6.1.war /var/solr/solr.war
Примеры ядер и конфиг для использования нескольких ядер.
sudo cp -R apache-solr-3.6.1/example/multicore/* /var/solr/
sudo chown -R tomcat6 /var/solr/

We connect tomcat with our Apache solr server
echo -e '\n\n' | sudo tee -a /etc/tomcat6/Catalina/localhost/solr.xml
echo 'TOMCAT6_SECURITY=no' | sudo tee -a /etc/default/tomcat6

Now in the file / etc / default / tomcat6 you need to specify the home directory solr - / var / solr. To do this, edit the JAVA_OPTS parameter
sudo nano /etc/default/tomcat6

And put it there:
JAVA_OPTS="$JAVA_OPTS -Dsolr.home=/var/solr"

After that reboot tomcat:
sudo /etc/init.d/tomcat6 restart

We make sure that everything works, for this you can go to the localhost url : 8080 / solr /

If successful, you should see something like this


By default, there are already two kernels, but in order to use the config and scheme from search_api for Drupal, we’ll create new core.
First, enter it in /var/solr/solr.xml

At the end of the file, the kernels are described, in my case, after adding the kernel, the config looks like this:


Then copy the files from the downloaded apache solr for our kernel, which will work with Drupal.

sudo mkdir /var/solr/drupal
sudo cp -R /tmp/solr/apache-solr-3.6.1/example/solr/* /var/solr/drupal

We put the config and the scheme from the search_api_solr module there.

We reload the tomcat command again
sudo /etc/init.d/tomcat6 restart

Set the solor settings in Drupal


Now we index the content and enjoy the search!

Articles seem to be good, but there is little activity. Some articles from this series do not even have comments, is it suddenly not interesting to anyone? I will be glad to constructive comments in the comments.

Only registered users can participate in the survey. Please come in.

Are you interested in articles about Drupal + Apache Solr?

  • 88.8% Interesting and useful articles 40
  • 8.8% for C grade 4
  • 2.2% These articles are not needed 1

Also popular now: