Apache Solr Setting on Drupal 7 (With error info)

  • Posted on: 7 September 2016
  • By: jmu

  In this blog, I will give a tutorial that how to set up apache solr on Drupal 7, and share some solutions for common problems such as the error message: 'An error occurred while indexing: "500" Status: Internal Server Error: Internal Server Error HTTP Status 500 - /var/solr/example/solr/data/index/_0.fdt (Permission denied) java.io.FileNotFoundException: /var/solr/example/solr/data/index/_0.fdt (Permission denied)'

Before setting apache solr:

  1. Make sure you have Java Runtime version 6 or higher.
      ---Command line for checking version: `java -version`

    java version

  2. Need to add Search API Solr Search in your drupal.
  3. Decide where you want your apache solr to be set.
      ---Reference: Basic setup Suggestion

 

Ready to start setting up:

  1. Download the lastest version of Solr (or any version you want)

    solr download

  2. Copy and paste the example folder, then rename the example folder to whatever name you want to set. (all the solr setting files will put in this new folder)

    solr config folder

  3. Next ‹ the most important step › go to the Search API Solr Search Module folder, copy all the files from "solr-conf/" directory in this module to Solr's configuration directory ($SOLR/example/solr/collection1/conf).
    Hint: the mapping-ISOLatin1Accent.txt file in Solr's example application is even better than the one provided with Search Module.
  4. After the third step, you can start the solr server.
      --- Go to "$SOLR/example/", then, issue the following command (make sure you set the Java correctly !!DO NOT FORGET '&'!!)
    `java -jar start.jar &`OR `sudo /usr/bin/java -jar start.jar &`(root as username)
     
  5. Solr Server should run correctly right now.
      - Go to 'admin/config/search' and click 'Apache Solr search'. You will see something similar with:

    search index content

      
    - You can find your Solr Admin with "http://yourwebsite:8983/solr"

 

ERRORS I GOT:

  1. Solr Server cannot find suddenly - 404 Error: (case 1)
      Usually happens after reboot the server or move the entire server.
      MY SOLUTION: check if solr server can be found. If not, find the solr-config directory and start the solr server again. (no need to reset)
  2. Solr Server cannot find suddenly - 404 Error: (case 2)
      Usually happens after run solr in shell script but server stops automatically.
      MY SOLUTION: use `nohup java jar start.jar &` instead of `java jar start.jar` or `java -jar start.jar &`
      REFERENCE: run jar on the server as background process
  3. Error message: "An error occurred while indexing: "500" Status: Internal Server Error: Internal Server Error HTTP Status 500 - /var/solr/example/solr/data/index/_0.fdt (Permission denied) java.io.FileNotFoundException: /var/solr/example/solr/data/index/_0.fdt (Permission denied)
      MY SOLUTION: once you got the permission problem, the very first thing is that you have to make sure the solr-config-setting folder have the "WRITE" permission

 

Some Suggestions:

  1. How to check apache solr process IP?
      ---`ps aux | grep java`
      APACHE SOLR Process IP: the number after your username( which is the first number: eg. 22863 in this example)

    process IP example

  2. How to stop apache solr server?
      ---`sudo kill -9 [process IP]`
      The process IP can be found by using `ps aux | grep java`

 

REPERENCES:

  1. SETTING UP SOLE (DRUPAL ORG): This is a really good reference for you to follow.
  2. ASK QUESTIONS (DRUPAL STACK): I asked a lot of questions relevant to solr here.
  3. NICK VEENHOF BLOG: His blog is also a very good reference on this topic.
  4. Ivan Zugec: How to setup Search API with Apache Solr (very nice tutorial)

 

 

Add new comment

CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.