Changes between Initial Version and Version 1 of SolrIntegration


Ignore:
Timestamp:
Apr 23, 2013, 10:51:26 PM (11 years ago)
Author:
tristano
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • SolrIntegration

    v1 v1  
     1= Integrating Apache Solr Search =
     2
     3Solr is a standalone, full text search server that is considerably more powerful than the core search module provided by Drupal. Integrating an existing Solr server is accomplished by installing the Apache Solr Search Integration module. Download the 6.x-3.x version from http://drupal.org/project/apachesolr
     4
     5== Setting Up a Solr Server ==
     6
     7(If a Solr server is already running, skip ahead to [#configsolr Configure Solr Integration].)
     8
     9Download the latest 3.x version tarball of Apache Solr and extract it to /opt (or another appropriate location on the filesystem). Copy three configuration files from the solr-conf directory of the apachesolr Drupal module to the example/solr/conf of the Solr installation: schema.xml, solrconfig.xml, and protwords.text. Then, create a directory at example/solr/data and give the apache user (www-data, apache2, etc.) write access to the directory.
     10
     11Solr can be started as a test by changing to the example directory of the Solr installation and running the service as the apache user: sudo -u www-data java -jar start.jar
     12
     13This example configuration may be sufficient in some cases, while in others it may be more appropriate to configure Solr to run in Tomcat or another application server. If the simple example implementation is acceptable, it can be made into an init service by creating an executable script at /etc/init.d/solr similar to the following:
     14
     15{{{
     16#!/bin/sh
     17
     18# Prerequisites:
     19# 1. Solr needs to be installed at /usr/local/solr/example
     20# 2. daemon needs to be installed
     21# 3. Script needs to be executed by root
     22
     23# This script will launch Solr in a mode that will automatically respawn if it
     24# crashes. Output will be sent to /var/log/solr/solr.log. A PID file will be
     25# created in the standard location.
     26
     27start () {
     28    echo -n "Starting solr..."
     29
     30    # Start daemon
     31    daemon --user=www-data --chdir='/usr/local/solr/example' --command "java -jar start.jar" --respawn --output=/var/log/solr/solr.log --name=solr --verbose
     32
     33    RETVAL=$?
     34    if [ $RETVAL = 0 ]
     35    then
     36        echo "done."
     37    else
     38        echo "failed. See error code for more information."
     39    fi
     40    return $RETVAL
     41}
     42
     43stop () {
     44    # Stop daemon
     45    echo -n "Stopping solr..."
     46
     47    daemon --stop --name=solr  --verbose
     48    RETVAL=$?
     49
     50    if [ $RETVAL = 0 ]
     51    then
     52        echo "Done."
     53    else
     54        echo "Failed. See error code for more information."
     55    fi
     56    return $RETVAL
     57}
     58
     59
     60restart () {
     61    daemon --restart --name=solr  --verbose
     62}
     63
     64
     65status () {
     66    # Report on the status of the daemon
     67    daemon --running --verbose --name=solr
     68    return $?
     69}
     70
     71
     72case "$1" in
     73    start)
     74        start
     75    ;;
     76    status)
     77        status
     78    ;;
     79    stop)
     80        stop
     81    ;;
     82    restart)
     83        restart
     84    ;;
     85    *)
     86        echo $"Usage: solr {start|status|stop|restart}"
     87        exit 3
     88    ;;
     89esac
     90
     91exit $RETVAL
     92}}}
     93
     94This script can then be enabled on a debian system with: update-rc.d solr defaults
     95
     96On a redhat system: /usr/sbin/chkconfig --add solr
     97
     98[=#configsolr Configure Solr Integration]
     99== Configure Solr Integration ==
     100
     101The Solr admin interface should now be available at: http://localhost:8983/solr/admin/
     102
     103If so, enable the "Apache Solr framework" and "Apache Solr search" modules in Drupal. There should now be an Apache Solr search menu item in administration under Site Configuration. That page gives the current status of the index and replaces core Drupal indexing. The Indexing throttle on the core Search settings page should be set to zero to disable it. If the Solr index status shows zero items indexed and zero remaining, try clicking the button to Queue all content for reindexing. Actions can then be taken to begin indexing or it can be handled in the background via cron.
     104
     105Check other settings for Apache Solr search as appropriate. By default, the new search functionality will be available at the /search/site path of the website.