The solr.xml
file defines some global configuration options that apply to all or many cores.
This section will describe the default solr.xml
file included with Solr and how to modify it for your needs. For details on how to configure core.properties
, see the section Defining core.properties.
Defining solr.xml
You can find solr.xml
in your $SOLR_HOME
directory (usually server/solr
) in standalone mode or in ZooKeeper when using SolrCloud. The default solr.xml
file looks like this:
<solr>
<solrcloud>
<str name="host">${host:}</str>
<int name="hostPort">${jetty.port:8983}</int>
<str name="hostContext">${hostContext:solr}</str>
<int name="zkClientTimeout">${zkClientTimeout:15000}</int>
<bool name="genericCoreNodeNames">${genericCoreNodeNames:true}</bool>
</solrcloud>
<shardHandlerFactory name="shardHandlerFactory"
class="HttpShardHandlerFactory">
<int name="socketTimeout">${socketTimeout:0}</int>
<int name="connTimeout">${connTimeout:0}</int>
</shardHandlerFactory>
</solr>
As you can see, the discovery Solr configuration is "SolrCloud friendly". However, the presence of the <solrcloud>
element does not mean that the Solr instance is running in SolrCloud mode. Unless the -DzkHost
or -DzkRun
are specified at startup time, this section is ignored.
Solr.xml Parameters
The <solr>
Element
There are no attributes that you can specify in the <solr>
tag, which is the root element of solr.xml
. The tables below list the child nodes of each XML element in solr.xml
.
Node | Description |
---|---|
|
If used, this attribute should be set to the FQN (Fully qualified name) of a class that inherits from CoreAdminHandler. For example, |
|
As above, for custom CollectionsHandler implementations. |
|
As above, for custom InfoHandler implementations. |
|
Specifies the number of threads that will be assigned to load cores in parallel. |
|
The root of the core discovery tree, defaults to |
|
Currently non-operational. |
|
Specifies the path to a common library directory that will be shared across all cores. Any JAR files in this directory will be added to the search path for Solr plugins. This path is relative to |
|
This attribute, when set to true, ensures that the multiple cores pointing to the same Schema resource file will be referring to the same IndexSchema Object. Sharing the IndexSchema Object makes loading the core faster. If you use this feature, make sure that no core-specific property is used in your Schema file. |
|
Defines how many cores with transient=true that can be loaded before swapping the least recently used core for a new core. |
|
The directory under which configsets for Solr cores can be found. Defaults to |
The <solrcloud>
Element
This element defines several parameters that relate so SolrCloud. This section is ignored unless theSolr instance is started with either -DzkRun
or -DzkHost
Node | Description |
---|---|
|
Used to set the underlying "connTimeout" for intra-cluster updates. |
|
Used to set the underlying "socketTimeout" for intra-cluster updates. |
|
The hostname Solr uses to access cores. |
|
The url context path. |
|
The port Solr uses to access cores. In the default |
|
When SolrCloud is starting up, how long each Solr node will wait for all known replicas for that shard to be found before assuming that any nodes that haven’t reported are down. |
|
When trying to elect a leader for a shard, this property sets the maximum time a replica will wait to see conflicting state information to be resolved; temporary conflicts in state information can occur when doing rolling restarts, especially when the node hosting the Overseer is restarted. Typically, the default value of 180000 (ms) is sufficient for conflicts to be resolved; you may need to increase this value if you have hundreds or thousands of small collections in SolrCloud. |
|
A timeout for connection to a ZooKeeper server. It is used with SolrCloud. |
|
In SolrCloud mode, the URL of the ZooKeeper host that Solr should use for cluster state information. |
|
If |
|
Optional parameters that can be specified if you are using ZooKeeper Access Control. |
The <logging>
Element
Node | Description |
---|---|
|
The class to use for logging. The corresponding JAR file must be available to Solr, perhaps through a |
|
true/false - whether to enable logging or not. |
The <logging><watcher>
Element
Node | Description |
---|---|
|
The number of log events that are buffered. |
|
The logging level above which your particular logging implementation will record. For example when using log4j one might specify DEBUG, WARN, INFO, etc. |
The <shardHandlerFactory>
Element
Custom shard handlers can be defined in solr.xml
if you wish to create a custom shard handler.
<shardHandlerFactory name="ShardHandlerFactory" class="qualified.class.name">
Since this is a custom shard handler, sub-elements are specific to the implementation. The default and only shard handler provided by Solr is the HttpShardHandlerFactory in which case, the following sub-elements can be specified:
Node | Description |
---|---|
|
The read timeout for intra-cluster query and administrative requests. The default is the same as the |
|
The connection timeout for intra-cluster query and administrative requests. Defaults to the |
|
URL scheme to be used in distributed search |
|
Maximum connections allowed per host. Defaults to 20 |
|
Maximum total connections allowed. Defaults to 10000 |
|
The initial core size of the threadpool servicing requests. Default is 0. |
|
The maximum size of the threadpool servicing requests. Default is unlimited. |
|
The amount of time in seconds that idle threads persist for in the queue, before being killed. Default is 5 seconds. |
|
If the threadpool uses a backing queue, what is its maximum size to use direct handoff. Default is to use a SynchronousQueue. |
|
A boolean to configure if the threadpool favours fairness over throughput. Default is false to favor throughput. |
Substituting JVM System Properties in solr.xml
Solr supports variable substitution of JVM system property values in solr.xml
, which allows runtime specification of various configuration options. The syntax is ${propertyname[:option default value]
}. This allows defining a default that can be overridden when Solr is launched. If a default value is not specified, then the property must be specified at runtime or the solr.xml
file will generate an error when parsed.
Any JVM system properties usually specified using the -D flag when starting the JVM, can be used as variables in the solr.xml
file.
For example, in the solr.xml
file shown below, the socketTimeout
and connTimeout
values are each set to "0". However, if you start Solr using ‘bin/solr -DsocketTimeout=1000’, the socketTimeout
option of the HttpShardHandlerFactory
to be overridden using a value of 1000ms, while the connTimeout
option will continue to use the default property value of "0".
<solr>
<shardHandlerFactory name="shardHandlerFactory"
class="HttpShardHandlerFactory">
<int name="socketTimeout">${socketTimeout:0}</int>
<int name="connTimeout">${connTimeout:0}</int>
</shardHandlerFactory>
</solr>