Apache Solr Setting on Drupal 7 (With error info)
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:
- Make sure you have Java Runtime version 6 or higher.
---Command line for checking version: `java -version`
- Need to add Search API Solr Search in your drupal.
- Decide where you want your apache solr to be set.
---Reference: Basic setup Suggestion
Ready to start setting up:
- Download the lastest version of Solr (or any version you want)
- 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)
- 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.
- 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)
- Solr Server should run correctly right now.
- Go to 'admin/config/search' and click 'Apache Solr search'. You will see something similar with:
- You can find your Solr Admin with "http://yourwebsite:8983/solr"
ERRORS I GOT:
- 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)
- 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
- 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
- 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)
- How to stop apache solr server?
---`sudo kill -9 [process IP]`
The process IP can be found by using `ps aux | grep java`
- SETTING UP SOLE (DRUPAL ORG): This is a really good reference for you to follow.
- ASK QUESTIONS (DRUPAL STACK): I asked a lot of questions relevant to solr here.
- NICK VEENHOF BLOG: His blog is also a very good reference on this topic.
- Ivan Zugec: How to setup Search API with Apache Solr (very nice tutorial)