Apache Solr Index Replication

                   Smart Techie

                  In the last Apache Solr related articles we have discussed “How to setup Apache Solr?“, “How to configure Apache Solr to index data from database?” , etc.. In this article we will see “how to setup Apache Solr replication?“. Before getting into the configuration details, we will discuss a use case to use replication. In most of the  online sites, the data will get update so frequently. To make this data available to search, the Apache Solr server requires to do delta indexing so frequently. So, the Solr server used for indexing will be always busy with the indexing. If we use the same indexing server for searching, then the search functionality has performance hit. To isolate the search with the indexing and to achieve the better search performance, we need to go with replication. To setup indexing replication we require at least two Solr instances. The below diagram will depict the replication setup.

Apache Solr Indexing Replication

                   From the above diagram, the master Solr instance will do indexing. The Salve Solr instances will serve the content to the web. The index from master to slave instances will get replicate based on the replication interval. Now we will see the configuration details.

Master configuration:

             To make Apache Solr instance as “Master”, we need to do the below configuration in solrconfig.xml.

<requestHandler name="/replication" class="solr.ReplicationHandler" >
 <lst name="master">
    <str name="replicateAfter">commit</str>
    <str name="replicateAfter">startup</str>
 </lst>
</requestHandler>

You can find more details of master configuration here.

Slave configuration:

To make Apache Solr instance as “Slave”, we need to do the below configuration in solrconfig.xml.

<requestHandler name="/replication" class="solr.ReplicationHandler" >
 <lst name="slave">
    <str name="masterUrl">http://localhost:8180/solr/samplecatalog</str>
    <str name="pollInterval">12:00:00</str>
 </lst>
</requestHandler>

You can find more details of slave configuration here.

Now, we will see the admin consoles of master and slave instances.

Master Solr Admin Console

                     From the “Master” Solr instance admin console, we can disable the replication to all the “Slave” Solr instances by clicking on “Disable Replication” button.

Now, we will see the salve solr instance admin console.

Slave Admin Console

                     From the “Slave” Solr instance admin console, we will come to know the replication polling time, the master instance, the master and slave index statuses and the last iteration replication failures and success details. If we want to disable the polling from the slave, we can use “Disable Polling” button. If we want to replicate the index from master on demand basis, we can use “Replicate Now” button.

                If you want more details about Solr replication, you can find here.

Advertisements

I am Siva Prasad Rao Janapati. Working as a software developer. Has hands on experience on ATG Commerce(DAS/DPS/DCS), Mozu commerce, Broadleaf Commerce, Java, JEE, Spring, Play, JPA, Hibernate, Velocity, JMS, Jboss, Weblogic,Tomcat, Jetty, Apache, Apache Solr, Spring Batch, JQuery, NodeJS, SOAP, REST, MySQL, Oracle, Mongo DB, Memcached, HazelCast, Git, SVN, CVS, Ant, Maven, Gradle, Amazon Web services, Rackspace, Quartz, JMeter, Junit, Open NLP, Facebook Graph,Twitter4J, YouTube Gdata, Bazzarvoice,Yotpo, 4-Tell, Alatest, Shopzilla, Linkshare. I have hands on experience on open sources and commercial technologies.

Tagged with: , , , , ,
Posted in Apache Solr, Solr Replication
One comment on “Apache Solr Index Replication
  1. Anonymous says:

    Nice information on Apache Solr

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

DZone

DZone MVB

Java Code Geeks
Java Code Geeks
%d bloggers like this: