Last active
February 10, 2018 17:59
-
-
Save ShepardToTheStars/164cc3c6ae381fb4e166e071a73d3082 to your computer and use it in GitHub Desktop.
Simple Solr ReplicationHandler Snippet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<config> | |
<!-- ... --> | |
<requestHandler name="/replication" class="solr.ReplicationHandler" > | |
<!-- | |
Simple Replication Parameters | |
Solr Master | |
* replication.master.enabled (Default: false) | |
Solr Slave | |
* replication.slave.enable (Default: false) | |
* replication.slave.masterHostProtocol (http or https, Default: http) | |
* replication.slave.masterHostName (Default: localhost) | |
* replication.slave.masterHostPort (Default: 8983) | |
Solr Repeater | |
* Just enable both Master and Slave Replication! :D | |
--> | |
<lst name="master"> | |
<str name="enable">${replication.master.enable:false}</str> | |
<!-- For both replicateAfter and backupAfter, if startup is used, | |
then either commit and/or optimize should be used with it. --> | |
<str name="replicateAfter">startup</str> | |
<str name="replicateAfter">commit</str> | |
<str name="replicateAfter">optimize</str> | |
<!--<str name="backupAfter">startup</str>--> | |
<str name="backupAfter">commit</str> | |
<str name="backupAfter">optimize</str> | |
<!-- Any specific files that should be replicated to the slave instances. | |
Unfortunately, Solr does not support wildcards so all files must be | |
specified explicitly. --> | |
<str name="confFiles">schema.xml,stopwords.txt,elevate.xml</str> | |
<!-- THE FOLLOWING PARAMETERS ARE USUALLY NOT REQUIRED--> | |
<!-- If your commits are very frequent and network is particularly slow, | |
you can tweak an extra attribute <str name="commitReserveDuration">00:00:10</str>. | |
This is roughly the time taken to download 5MB from master to slave. | |
Default is 10 secs. --> | |
<!--<str name="commitReserveDuration">00:00:10</str>--> | |
</lst> | |
<lst name="slave"> | |
<str name="enable">${replication.slave.enable:false}</str> | |
<!-- fully qualified url for the replication handler of master. It is | |
possible to pass on this as a request param for the fetchindex command --> | |
<str name="masterUrl">${replication.slave.masterHostProtocol:http}://${replication.slave.masterHostName:localhost}:${replication.slave.masterHostPort:8983}/solr/${solr.core.name}</str> | |
<!-- Interval in which the slave should poll master. Format is HH:mm:ss . | |
If this is absent slave does not poll automatically. | |
But a fetchindex can be triggered from the admin or the http API --> | |
<str name="pollInterval">00:00:20</str> | |
<!-- THE FOLLOWING PARAMETERS ARE USUALLY NOT REQUIRED--> | |
<!-- To use compression while transferring the index files. The possible | |
values are internal|external. If the value is 'external' make sure | |
that your master Solr has the settings to honor the accept-encoding header. | |
See here for details: http://wiki.apache.org/solr/SolrHttpCompression | |
If it is 'internal' everything will be taken care of automatically. | |
USE THIS ONLY IF YOUR BANDWIDTH IS LOW. | |
THIS CAN ACTUALLY SLOWDOWN REPLICATION IN A LAN --> | |
<!--<str name="compression">internal</str>--> | |
<!-- The following values are used when the slave connects to the master to | |
download the index files. Default values implicitly set as 5000ms and | |
10000ms respectively. The user DOES NOT need to specify these unless the | |
bandwidth is extremely low or if there is an extremely high latency --> | |
<!--<str name="httpConnTimeout">5000</str>--> | |
<!--<str name="httpReadTimeout">10000</str>--> | |
<!-- If HTTP Basic authentication is enabled on the master, then the slave | |
can be configured with the following --> | |
<!--<str name="httpBasicAuthUser">username</str>--> | |
<!--<str name="httpBasicAuthPassword">password</str>--> | |
</lst> | |
<!-- Keep X backups. Using this parameter precludes using the "numberToKeep" | |
request parameter. --> | |
<!--<int name="maxNumberOfBackups">2</int>--> | |
</requestHandler> | |
<!-- ... --> | |
</config> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment