Setting up Solr master-slave
We can set up Solr replication where the master Solr server is used for indexing and both master and slave Solr servers can be used for searches. Setting up replication is pretty simple in Solr. Check out the requestHandler
named/replication
. Simply create a copy of the example
folder inside Solr as example3
and empty the index files from the example3
folder with the following command:
cp -r example example3 rm -rf example3/solr/collection1/data
In the master server (example
folder), change the solrconfig.xml
file to add configuration parameters for the replication master with the following code:
<lst name="master"> <str name="replicateAfter">commit</str> <str name="replicateAfter">startup</str> <str name="confFiles">schema.xml,stopwords.txt</str> </lst>
Here, we have specified that replication should happen after a start up and after a commit on Solr. And the schema.xml
and stopwords.txt
files should...