Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tomcat SOLR multiple cores setup

I have spend all morning trying to set up multiple cores on a SOLR installation that runs under Apache Tomcat server without success. My solr.xml looks like this:

<solr persistent="false" sharedLib="lib">
  <cores adminPath="/admin/cores">
    <core name="core0" instanceDir="/multicore/core0">   
        <property name="dataDir" value="/multicore/core0/data" />
    </core>
    <core name="core1" instanceDir="/multicore/core1">
        <property name="dataDir" value="/multicore/core1/data" />
    </core>
  </cores>
</solr>

What is the correct directory structure? Do I need to do change something in the solrconfig.xml?

like image 881
Sfairas Avatar asked Apr 26 '10 14:04

Sfairas


People also ask

What are Solr cores?

In Solr, the term core is used to refer to a single index and associated transaction log and configuration files (including the solrconfig. xml and Schema files, among others).

What is difference between core and collection in Solr?

Collection is a logical index spread across multiple servers. Core is that part of server which runs one collection. In non-distributed search, Single server running the Solr can have multiple collections and each of those collection is also a core.

What is Solrconfig xml in Solr?

The solrconfig. xml file is the configuration file with the most parameters affecting Solr itself. While configuring Solr, you'll work with solrconfig. xml often, either directly or via the Config API to create "configuration overlays" ( configoverlay. json ) to override the values in solrconfig.

How do I delete a core in Solr?

For the solr delete command the -c <name> option is required while the other options (parameters) are optional. Delete the named Solr core or collection with default options. Solr will delete the specified core and its associated configuration files at the first port number found.


1 Answers

Check that your instanceDir values are relative to -Dsolr.solr.home. If -Dsolr.solr.home is 'multicore', then your instanceDir should be only "core0".

If you put your data folder inside your instanceDir, you should not have to specify its path:

<?xml version='1.0' encoding='UTF-8'?>
<solr persistent="true">
<cores adminPath="/admin/cores">
    <core name="core0" instanceDir="core0" />
    <core name="core1" instanceDir="core1" />
</cores>
</solr>

You should not have to set anything in solrconfig.xml. But if you need to configure an handler independantly of the core location, you can use the variable ${solr.core.instanceDir}.

UPDATE

To set the solr.solr.home variable with Tomcat, use the JAVA_OPTS environment variable before starting Tomcat:

JAVA_OPTS="-Dsolr.solr.home=multicore"
export JAVA_OPTS
tomcat/bin/catalina.sh start

Make sure that "multicore" is correctly set relative to the working directory. Per example, if solr.solr.home='multicore', you have to launch Tomcat from the directory where "multicore" is located.

like image 144
Pascal Dimassimo Avatar answered Sep 18 '22 21:09

Pascal Dimassimo