Solr.xml 4.4 and beyond

As of <!> Solr4.4 there is an alternate structure for the solr.xml config file which will become mandatory for 5.0.

As of <!> Solr4.5, solr.xml may be stored on your ZooKeeper ensemble, see SOLR-4718.

Structure of the new-style solr.xml

Basically, it's mostly a move from the older attributes to a flatter style, and removal of <cores> and <core> tags. Here's a sample file. Note that any of these values can have a system property defined by specifying -Dpropname=propvalue on JVM startup:

Any of these will honor system property substitution following the usual rules of ${propname:default_value}. Remember that a form ${sysprop:} will use the built-in defaults and can be omitted from the config, they're included here to document that they're available. Where it's straightforward to find in the code, the defaults are included. Note that the defaults are subject to change.

<!> This example has many options listed here for reference. You should not change them unless and until you have a need. Start with the solr.xml in the example directory in the distro (<solrHome>/example/solr/solr.xml) and only add in specific options as the need arises.

  <str name="adminHandler">${adminHandler:org.apache.solr.handler.admin.CoreAdminHandler}</str>
  <int name="coreLoadThreads">${coreLoadThreads:3}</int>
  <str name="coreRootDirectory">${coreRootDirectory:}</str> <!-- usually solrHome  -->
  <str name="managementPath">${managementPath:}</str>
  <str name="sharedLib">${sharedLib:}</str>
  <str name="shareSchema">${shareSchema:false}</str>
  <int name="transientCacheSize">${transientCacheSize:Integer.MAX_VALUE}</int> <!-- ignored unless cores are defined with transient=true -->

    <int name="distribUpdateConnTimeout">${distribUpdTimeout:}</int>
    <int name="distribUpdateSoTimeout">${distribUpdateTimeout:}</int>
    <int name="leaderVoteWait">${leaderVoteWait:}</int>
    <str name="host">${host:}</str>
    <str name="hostContext">${hostContext:solr}</str>
    <int name="hostPort">${jetty.port:8983}</int>
    <int name="zkClientTimeout">${zkClientTimeout:15000}</int>
    <str name="zkHost">${zkHost:}</str>
    <bool name="genericCoreNodeNames">${genericCoreNodeNames:true}</bool>

    <str name="class">${loggingClass:}</str>
    <str name="enabled">${loggingEnabled:}</str>
      <int name="size">${loggingSize:}</int>
      <int name="threshold">${loggingThreshold:}</int>

  <shardHandlerFactory name="shardHandlerFactory" class="HttpShardHandlerFactory">
    <int name="socketTimeout">${socketTimeout:}</int>
    <int name="connTimeout">${socketTimeout:}</int>


Core discovery process

See: Core Discovery (4.4 and beyond).

Core discovery happens at startup. Exploration of the core tree terminates when a file named is encountered. Discovery of a file of that name is assumed to define the root of a core. There is no a-priori limit on the depth of the tree. That is, the directories under the core root are explored until a file is encountered, and that directory is assumed to be the instanceDir for that core. Subdirectories of any directory that has a file are NOT examined for additional cores. The file presently recognizes the following entries:

Minimal file

Interestingly, the minimal file is empty. Say an empty file is discovered in /solr/home/core1. The name will default to "core1", the instanceDir to /solr/home/core1, the dataDir to /solr/home/core1/data etc.

Relation with CoreAdmin api

The core discovery process happens only at startup. After startup, Solr does not monitor changes in the core root directory.

Ignoring cores

It's not hard to imagine that people will want to have the core discovery process temporarily ignore one or more cores. The easiest way to accomplish this would be to rename the file, e.g.

Solr.xml 4.4 and beyond (last edited 2013-10-10 06:14:41 by 213)