How to use the scheme and configuration between the cores in Solr 4.4+?

I want to transfer from the old solr.xml format to the main autodiscover in 4.4, but I had a problem with sharing the configuration (solrconfig.xml, schema.xml and dependent files) between the kernels, as I'm used to.

My old solr.xml file was something 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 in this way, the whole configuration was divided between the kernels. It worked because the dir instance of all the kernels where they were the same, and the conf directory were under it.

With kernel auto-detection in 4.4, it is not possible to have the same dir instance for all cores. Although, 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 

This works because the conf directory is in the classpath, thanks to the shareLib directive. But this is not entirely satisfactory because I cannot display the configuration files in 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 version 4.4?

+4
source share
1 answer

We had the same problem. We tried to specify the relative path in the core.properties folder, but this did not work.

As a result, we created the conf folder in the SOLRHome folder, and then created symbolic links in the core / conf directory.

Here are the commands that I ran to create the symlink:

 ln -s ../../conf/solrconfig.xml solrconfig.xml ln -s ../../conf/schema.xml schema.xml 
+1
source

Source: https://habr.com/ru/post/1494683/


All Articles