13

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?

Sfairas
  • 932
  • 4
  • 13
  • 21
  • What version of Tomcat and Apache does it relate to? I'm having a similar problem, but I can't locate these files or configuration settings at all. I'm on Tomcat6, Solr 3.6, Ubuntu. – ted.strauss May 29 '12 at 15:20

2 Answers2

10

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.

Pascal Dimassimo
  • 6,908
  • 1
  • 37
  • 34
  • Thanks for the fast answeer Pascal. How can I check what my solr.solr.home is? I'm running solr on Tomcat and not Jetty so cannot set that on the command line when running the start.jar. I tries the above solr.xml but still get the following error when trying to visit http://devel:12345/solr/core0/admin/ type Status report message /solr/core0/admin/ description The requested resource (/solr/core0/admin/) is not available. Any ideas what might be it? – Sfairas Apr 26 '10 at 15:00
  • With Tomcat, you can use the environment variable JAVA_OPTS to set -Dsolr.solr.home before calling the catalina script. – Pascal Dimassimo Apr 26 '10 at 15:17
  • OK I set the JAVA_OPTS='-Dsolr.solr.home=multicore' but still cannot get it to work. I know that it's a configuration issue but I just can't figure out what I'm missing here. – Sfairas Apr 27 '10 at 12:16
  • @PascalDimassimo What should I do If there are two diffirent versions of Solr? – SaidbakR Sep 24 '14 at 00:45
6

This is kind of late in the game, but I just put up a blog post with instructions for a multicore SOLR instance on Tomcat which reads:

  1. Downloaded and installed the 32-bit/64-bit Windows Service Installer for Tomcat
  2. Installed Tomcat on the server (no special instructions here--just run the install and install wherever you wish)
  3. Verified the installation of Tomcat by going to http://localhost:8080
  4. Edit Tomcat's conf/server.xml and add URIEncoding="UTF-8" to the <Connector> element as shown here
  5. Download SOLR from one of the mirrors found here (downloaded the apache-solr-1.4.1.zip package) and unzip the package
  6. Create a directory where SOLR will be hosted from (in my case I used e:\inetpub\solr)
  7. Copy the contents of the example\solr directory to your SOLR host directory (in my case e:\inetpub\solr)
  8. Create directories under your SOLR host directory for each of the cores you wish to create (I created a dozen or so folders for each core I wanted to create in the e:\inetpub\solr directory.  The directories included en-US, en-CA, en-GB, etc.)
  9. Copy the solr.xml file from the example\multicore directory and paste it into your SOLR host directory (e:\inetpub\solr for my example)
  10. Edit the solr.xml file to include the information for each of the cores you created (if you created a folder under your host for a core named en-US, then add the following under the <cores> element in the solr.xml file: <core name="en-US" instanceDir="en-US" />)
  11. Stop the Tomcat Service
  12. Copy the *solr*.war file from the dist directory in the unzipped SOLR package to your Tomcat webapps folder
  13. Rename the *solr*.war file to solr.war
  14. In the notification area in the right-hand side of the Windows task bar, right-click on the Apache Tomcat 7 icon and select Configure
  15. Click the Java tab and add the following to the Java Options text box: -Dsolr.solr.home=e:\inetpub\solr (change e:\inetpub\solr to wherever your SOLR is being hosted)
  16. Click OK in the dialog and then start-up the Tomcat service
  17. Open the conf\solrconfig.xml files under each of the cores you created and change the dataDir element to point to a specific directory.  If this step is not completed, all of your cores will be using the same data store for their data.
  18. Stop and re-start the Tomcat Service
  19. Test that your cores are running by running a query from the web browser http://localhost:8080/solr/en-US/select?q=*:* (replace "en-US" with whatever you've named one of your cores)
kenorb
  • 155,785
  • 88
  • 678
  • 743
Derek Curtis
  • 239
  • 5
  • 7