4
votes

I want to migrate from the old solr.xml format to the core auto discovery in 4.4, but i'm having a problem sharing the config (solrconfig.xml, schema.xml and dependant files) between cores as I used to.

My old solr.xml was like this :

<?xml version="1.0" encoding="UTF-8" ?>
<solr persistent="true">
  <cores defaultCoreName="core1" adminPath="/admin/cores">
    <core instanceDir="."name="core1" dataDir="core/core1"/>
    <core instanceDir="."name="core2" dataDir="core/core2"/>
    ...
  </cores>
</solr>

Directory structure :

solr.xml
conf
   schema.xml
   solrconfig.xml
   ...
core
    core1
    core2
    ...

Everything worked perfectly this way, the whole configuration was shared between the cores. It was working because the instance dir of all the cores where the same, and the conf directory was under it.

With the core autodiscovery in 4.4, it is not possible to have the same instance dir for all cores. Though, I found a solution that works :

Directory structure :

solr.xml
common
    conf
        schema.xml
        solrconfig.xml
        ...
core
    core1
        core.properties
        data
    core2
        core.properties
        data
    ...

solr.xml :

<solr>
    <str name="sharedLib">common</str>
</solr>

core.properties :

name=core1

It works because the conf directory is in the classpath, thanks to the shareLib directive. But it is not completely satisfying, because I can't display the config files in the admin webapp, I get the following exception :

java.lang.NullPointerException
    at org.apache.solr.handler.admin.ShowFileRequestHandler.showFromFileSystem(ShowFileRequestHandler.java:210)
    at org.apache.solr.handler.admin.ShowFileRequestHandler.handleRequestBody(ShowFileRequestHandler.java:122)
    at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:135)
    at org.apache.solr.core.SolrCore.execute(SolrCore.java:1904)

Is there a better way to share configuration between all cores in 4.4 ?

1

1 Answers

1
votes

We had the same issue. We tried to specify a relative path in the core.properties folder, but that didn't work.

What we ended up doing is creating a conf folder in the SOLRHome folder and then creating symbolic links in the core/conf directory.

Here are the commands I executed to create the symbolic link:

ln -s ../../conf/solrconfig.xml solrconfig.xml
ln -s ../../conf/schema.xml schema.xml