Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm setting up solr locally for my development purposes and integration with Drupal 7. I'm not very familiar with tomcat. My background has primarily been LAMP setups.

So I went and installed the package provided by ubuntu for apache solr following this guide.

  • sudo apt-get install tomcat6 tomcat6-admin tomcat6-common tomcat6-user tomcat6-docs tomcat6-examples
  • sudo apt-get install solr-tomcat

I've got that working. The apt-get package manager does a great job and allows me to setup solr but with one core.

What steps need to be taken to enable multi core setup for apache solr?

And below is my solr.xml file:

sudo nano /var/lib/tomcat6/conf/Catalina/localhost/solr.xml

<!--
    Context configuration file for the Solr Web App
-->

<Context path="/solr" docBase="/usr/share/solr"
   debug="0" privileged="true" allowLinking="true" crossContext="true">
  <!-- make symlinks work in Tomcat -->
  <Resources className="org.apache.naming.resources.FileDirContext" allowLinking="true" />

  <Environment name="solr/home" type="java.lang.String" value="/usr/share/solr" override="true" />
</Context>
share|improve this question
add comment

1 Answer

up vote 1 down vote accepted
+50

The guide in OP is a quick start quide and does not touch on multi-core configuration.

There is an official guide in solr site: http://wiki.apache.org/solr/CoreAdmin

It is very long. I will quote the initial setup portion.

Partial Quote

Configuration

To enable support for dynamic SolrCore administration, place a file named solr.xml in the solr.home directory. Here is an example solr.xml file:

<solr persistent="true" sharedLib="lib">
 <cores adminPath="/admin/cores">
  <core name="core0" instanceDir="core0" />
  <core name="core1" instanceDir="core1" />
 </cores>
</solr>

You can also specify properties in solr.xml which can be used in the solrconfig.xml and schema.xml files.

<solr persistent="true" sharedLib="lib">
 <property name="snapshooter" value="/home/solr-user/solr/bin/snapshooter.sh" />
 <cores adminPath="/admin/cores">
  <core name="core0" instanceDir="core0">
    <property name="dataDir" value="/data/core0" />
  </core>
  <core name="core1" instanceDir="core1" />
 </cores>
</solr>

The properties can be container scope (i.e. specified after < solr > but outside of a < core > element) in which case it is automatically inherited by each core. Therefore, they can be used in any of the cores' configuration files.

The properties can also be defined in a core's scope (inside the < core > element) in which case they can be used only in that core's scope. If a property by that name already exists in the container scope then it will be overridden.

Besides them, a few properties are automatically added in the core scope. They are:

solr.core.name -- The core's name as defined in solr.xml

solr.core.instanceDir -- The core's instance directory (i.e. the directory under which that core's conf/ and data/ directory are located)

solr.core.dataDir -- The core's data directory (i.e. the directory under which that core's index directory are located)

solr.core.configName -- The name of the core's config file (solrconfig.xml by default)

solr.core.schemaName -- The name of the core's schema file (schema.xml by default) 

Such properties can be used inside solrconfig.xml and schema.xml files by specifying an expression with optionally, a default value.

// Without a default value
${snapshooter}
// With a default value
${snapshooter:./solr/bin/snapshooter.sh}

The above expression will evaluate to the value specified in solr.xml for the property name "solr.snapshooter". If no value is defined in solr.xml, it will check if a system property by that name exists otherwise it will use the specified default value. If no default value is specified, a runtime exception will be thrown and the core may fail to startup.

share|improve this answer
    
Does this help? –  John Siu Feb 3 '13 at 23:42
    
While waiting for an answer, I got things working on my own, so I haven't followed your advice. However, I feel like I would be cheating you if you didn't get the bounty, so I assigned it. Thanks for taking the time. –  user50849 Feb 5 '13 at 12:53
    
I see. Thank you!. –  John Siu Feb 5 '13 at 14:31
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.