wiki:apachesolr

Version 19 (modified by Bart, 14 years ago) ( diff )

--

Apache Solr on mirabal.mayfirst.org

Apache Solr is an indexing and searching program that can replace the Drupal core search engine with a much improved system.

mirabal.mayfirst.org is a dedicated Apache Solr Server that is available for use by any May First/People Link member.

Web site Administrators

If you run a Drupal web site, you can use Solr. The first step is to determine if you primary host is connected to our Solr server. The following hosts are currently connected:

  • lucy.mayfirst.org

If your primary server is not listed, please open a ticket or contact the support team to request having your primary host added.

Once your host is solr-enabled then you can then connect to the Apache Solr server with:

Solr host name: localhost
Solr port: 9080
Solr path: /solr/<sitename>

Administrators

Below are the steps administrators must take to provide solr access.

On the primary server

Create a new user on the server (called $server from now on) with the user name solr-ssh and add:

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDK9Rnog/DuOeFN0gusPadGHtAFs/vrfuNyxsNpakycA/+hkKbgEid/xR4Tbbs25ak03bBJePdCf/PpORcB2rgiFwte4fOAfoXX/VHBnqZLFizhZKPCtG0gstQXTwdvOkx+8p5yPODVQvkqeOJCxF7EAI5B9VgcoJWdh2tQX+e07v/DgRtTs+01re0ZmVxmpGpgRWICdaPms9Hh/DwJT7gs19TpPv1qBgzDTN/z12b/6BRsShk/eEGVwslGF3meFA5+saWPmCSJKKK3Pg0btp3LxLkZfWUtdnVr7ASeJlevnthOPlSMp0ITs6oznhQEjycWK+nBYNUrK+cguiMepe/t solr-ssh@mirabal

to the new user's ~/.ssh/authorized_keys file. mirabal will connect to $server with these credentials and provide an ssh tunnel to the Apache Solr server.

On Mirabal

There are two things to do on mirabal.mayfirst.org: add a ssh tunnel to $server and create a new Apache Solr site in Apache Tomcat.

Create SSH tunnel

Log as solr-ssh into the host server from solr-ssh on mirabal.mayfirst.org

sudo -u solr-ssh ssh solr-ssh@$server.mayfirst.org

End the connection with exit

On mirabal, add a SSH tunnel by adding the login credentials (solr-ssh@$server.mayfirst.org) to

/etc/default/solr-autossh

Restart the script with

service solr-autossh restart

Test SSH tunnel

Check with

service solr-autossh status

that the tunnel exists.

Log as solr-ssh into $server and download with

wget localhost:9080

the Apache Tomcat welcome page from mirabal.mayfirst.org.

Create new Solr configuration

Let's assume your site is called <sitename>. Copy the configuration directory

cp -a /etc/solr/conf /etc/solr/<sitename>/conf

If you need a different configuration than that provided by Apache Solr Drupal module you probably have to change at least schema.xml and solrconfig.xml. If you have a multilingual Drupal site then install Apache Solr Drupal multilingual module and go to admin/settings/apachesolr/schema_generator on your Drupal site to download the site specific schema files which you have to put into your conf directory.

Create new Solr core

Copy an existing Solr core

cp -a /usr/share/solr/testsite /usr/share/solr/<sitename>

Change the symbolic link to the new configuration directory

ln -sf /etc/solr/<sitename>/conf /usr/share/solr/<sitename>/conf

Create a new data directory

mkdir /var/lib/solr/data/<sitename>

Change ownership to tomcat6

chown -R tomcat6:tomcat6 /var/lib/solr/data

Change the symbolic link to the new data directory

ln -sf /var/lib/solr/data/<sitename> /usr/share/solr/<sitename>/data

Register new Solr core

Register a new core

<core name="<sitename>" instanceDir="<sitename>" />

in

/etc/solr/solr-multicore.xml

Restart Apache Tomcat

Restart Apache Tomcat with

service tomcat6 restart

Test new Solr site

Check that the new core is accessible with:

links http://localhost:8080/solr/<sitename>/admin
Note: See TracWiki for help on using the wiki.