开发者

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 ne开发者_Go百科ed to do change something in the solrconfig.xml?


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.


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)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜