Master Slave Configuration (Replication) :
Java based replication is implemented as RequestHandler. Using single solrconfig.xml for master and slave.
changes in solrconfig.xml
<requestHandler name="/replication" class="solr.ReplicationHandler" >
If a server needs to be turned into a master from a slave or if you wish to use the same solrconfig.xml for both master and slave. When the master is started, pass in -Denable.master=true and in the slave pass in -Denable.slave=true
Replicate on give value. Valid values are "commit", "startup", "optimize". You can give multiple values. If only the startup option is given, replication will not be triggered on subsequent commits/optimizes after it is done for the first time at the start.
Configuration files names mentioned will be replicated. The files that are to be replicated have to be mentioned explicitly in using the 'confFiles' parameter. Only files in the 'conf' dir of the solr instance are replicated. The files are replicated only along with a fresh index.
If your commits are very frequent and network is particularly slow, you can tweak an extra attribute <str name="commitReserveDuration">00:00:20</str>. Default is 10 secs.
Create a backup after action specified in backupAfter. Valid values are 'optimize', 'commit', 'startup'. It is possible to have multiple entries of this config string. Note that this is just for backup, replication does not require this.
Same as of master. pass in -Denable.slave=true to run the solr in slave mode.
Master apache solr server url.
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
The possible values are internal|external if the value is 'external' make sure that your master Solr has the settings to honour the accept-encoding header. If it is 'internal' everything will be taken care of automatically. Use this only if you bandwidth is low
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.
If HTTP Basic authentication is enabled on the master we need to specify these parameters other not.
Just copy the above xml fragment to solrconfig.xml
Starting apache solr in master mode.
$ java -jar -Dmaster.enable=true start.jar
Starting apache solr in slave mode
$ java -jar -Dslave.enable=true start.jar
For More information please refer :