Setting up Linode to run as multicore Solr server

This is a step by step on how to setup Solr server running on Jetty on Ubuntu 10.04 LTS.
This step by step is written while setting up a solr server on a Linode server.

Set hostname

  1. echo "your-hostname" > /etc/hostname
  2. hostname -F /etc/hostname

Modify /etc/hosts

  1. vi /etc/hosts

Change to

  1. 127.0.0.1 localhost.localdomain localhost
  2. your.servers.ip your.domain.com your-hostname

Set timezone

  1. dpkg-reconfigure tzdata

Setting Solr multi core, using this guide as base: http://tinyurl.com/2d367rz
Thank you Dave

Install Solr and Jetty

  1. apt-get install solr-jetty openjdk-6-jdk

Configure Jetty
First backup default config

  1. cp -a /etc/default/jetty /etc/default/jetty.bak

Modify /etc/default/jetty

  1. vi /etc/default/jetty
  1. Change NO_START=1 to NO_START=0
  2. Set JETTY_HOST=your.domain.com (use the servers domain)

Configure Solr
create config file to enable multicore

  1. vi /usr/share/solr/solr.xml

add to file:

  1. <solr persistent="true" sharedLib="lib">
  2. <cores adminPath="/admin/cores" shareSchema="true" adminHandler="au.com.davehall.solr.plugins.SolrCoreAdminHandler">
  3. </cores>
  4. </solr>

Make jetty owner

  1. chown jetty:jetty /usr/share/solr
  2. chown jetty:jetty /usr/share/solr/solr.xml
  3. chmod 640 /usr/share/solr/solr.xml
  4. mkdir /usr/share/solr/cores
  5. chown jetty:jetty /usr/share/solr/cores

Create symlink to centralize configs

  1. ln -s /usr/share/solr/solr.xml /etc/solr/

Configure for drupal
backup first

  1. mv /etc/solr/conf/schema.xml /etc/solr/conf/schema.orig.xml
  2. mv /etc/solr/conf/solrconfig.xml /etc/solr/conf/solrconfig.orig.xml

fetch the drupal solr module

  1. wget http://ftp.drupal.org/files/projects/apachesolr-6.x-1.2.tar.gz (check d.o for latest version)
  2. tar xvzf apachesolr-6.x-1.2.tar.gz
  3. mv apachesolr/ drupal-apachesolr

copy drupal configs

  1. cp /etc/solr/drupal-apachesolr/{schema,solrconfig}.xml /etc/solr/conf/

create each of the cores (add more for several domains)

  1. mkdir -p /var/lib/solr/cores/{,subdomain_1_,subdomain_2_}your_domain_com/{data,conf}
  2. chown -R jetty:jetty /var/lib/solr/cores/{,subdomain_1_,subdomain_2_}your_domain_com

Finally fetch this plugin

  1. mkdir /usr/share/solr/lib
  2. cd /usr/share/solr/lib
  3. wget http://tinyurl.com/d2efayp (thank you dave)

Cross your fingers everything is correct and start Jetty

  1. /etc/init.d/jetty start

Goto http://tinyurl.com/cy4n8xw
Did it work? Yeah!
Create a core for domain: http://tinyurl.com/cesdfeg

SETUP SECURITY
Based on http://tinyurl.com/cg4sxlv

  1. vi /etc/jetty/webdefault.xml

goto the very end
add just before closing web-app tag

  1. <security-constraint>
  2. <web-resource-collection>
  3. <web-resource-name>Solr authenticated application</web-resource-name>
  4. <url-pattern>/*</url-pattern>
  5. </web-resource-collection>
  6. <auth-constraint>
  7. <role-name>admin</role-name>
  8. <role-name>solr-role</role-name>
  9. </auth-constraint>
  10. </security-constraint>
  11. <login-config>
  12. <auth-method>BASIC</auth-method>
  13. <realm-name>Solr Realm</realm-name>
  14. </login-config>

Set user and passwd

  1. vi /etc/jetty/realm.properties

add
username: password, solr-role

modify /etc/jetty/jetty.xml

  1. vi /etc/jetty/jetty.xml

Search for Configure Authentication Realms
modify Test Realm change it to Solr Realm

Stop and Start Jetty

  1. $ /etc/init.d/jetty stop
  2. $ /etc/init.d/jetty start

Configure your ApacheSolr Drupal module with the following

  1. Solr host name: username:password@your.domain.com
  2. Solr port: 8080
  3. Solr path: /solr/your_core_name/

Hope you found this guide useful.

I also find the tips in this guide very usefull, http://tinyurl.com/ce66c2s

Tags: 

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <p> <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.