Solr (4.4+) solrconfig.xml when creating kernels

I am trying to configure a multi-core solr server for our web application, but I am having problems creating a new kernel through the coreadmin service.

I use Solr-4.4 because 4.3 ran into problems preserving the kernels in the solr.xml file (datadir was not saved) So I use the new configuration of Solr.xml 4.4 and higher

Now my solr.xml looks like this:

<solr> <str name="coreRootDirectory">default-instance/cores/</str> </solr> 

solrconfig.xml is located in (solrhome) /default-instance/conf/solrconfig.xml

When trying to create a kernel with a url

 http:/example.org/solr/admin/cores?action=CREATE&name=test-name&schema=schema-test.xml&loadOnStartup=false 

gives me an error:

Error CREATEing SolrCore 'test-name': cannot create kernel: test-name Cause: Cannot find resource 'solrconfig.xml' in classpath or 'default-instance / corees / test-name / conf /', cwd = / var / lib / tomcat7

The following seems to work:

 http:/example.org/solr/admin/cores?action=CREATE&name=test-name&schema=schema-test.xml&loadOnStartup=false&config=/absolute/file/path/to/solrconfig.xml 

The problem is that this seems to work only with the absolute path (or perhaps with the relative path from / var / lib / tomcat 7), which is not a workable solution.

What I'm looking for is a way to place the solrconfig.xml file so that it can be used to create new kernels using this configuration (or a way to create these kernels with the current location).

More or less the same will be required for circuits

+6
source share
4 answers

It worked. Ran on the command line and was available for viewing in the admin console:

solr create -c (name for kernel or collection)

See README.txt for more details.

+10
source

In my case, I used the Core Discovery feature in 4.4+, instead of creating a kernel using the web-based management interface.

This simply involves copying the collection1 example from the examples directory (which I usually use as a starting point).

Then I had to make sure that the root of my new kernel has core.properties with name=<new core name> inside. Solr automatically detected a new kernel and allowed me to use it without any problems.

This avoided the need to copy solrconfig.xml and schema.xml to any special place.

+4
source

I had the same problem: solrconfig.xml not in the classpath. I solved this by copying configuration file templates to the classpath.

So, I looked at http://localhost:8983/solr/#/~java-properties to see the solrs path class definition, and then copied the solrconfig.xml and schema.xml template into the C:\servers\solr-4.4.0\example\resources folder C:\servers\solr-4.4.0\example\resources . In addition, I copied all the seconds data ...

This solution is not completely satisfactory, but it works. Adding another path to the classpath should work too. I am a little surprised that no default configuration for new kernels can be declared in solr.xml

+2
source

I recommend the new Config sets for this use case.

If you place your schema.xml and solrconfig.xml (and other configuration files, such as stop words, etc.) in the $SOLR_HOME/configsets/myConfig/conf , you can create a new kernel with this config, by calling:

http: // solr / admin / cores? action = CREATE & name = mycore & instanceDir = my_instance & configSet = myConfig

See https://cwiki.apache.org/confluence/display/solr/Config+Sets

But they are not available until Solr 4.8, see https://issues.apache.org/jira/browse/SOLR-4478

+2
source

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


All Articles