What you need to do is copy the solr instance that you have to the slave server and configure the replication handler on solrconfig.xml . It is best to have a different instanceDir directory for each core, as usually each core has its own schema.xml and solrconfig.xml . In any case, you can use the same conf, just setting up solr.xml to point to the same instanceDir , but another dataDir that you set up as dataDir in your solrconfig.xml :
<solr persistent="true" sharedLib="lib"> <cores adminPath="/admin/cores"> <core name="core0" instanceDir="core"> <property name="dataDir" value="/data/core0" /> </core> <core name="core1" instanceDir="core"> <property name="dataDir" value="/data/core1" /> </core> </cores> </solr>
This should be your situation if you currently have several cores, but one solrconfig.xml .
The replication section solrconfig.xml on the slaves must contain the URL of the master, including the kernel name, which, of course, is different for each kernel. But you can use placeholder $ {solr.core.name} as follows:
<requestHandler name="/replication" class="solr.ReplicationHandler" > <lst name="slave"> <str name="masterUrl">http://master_host:port/solr/${solr.core.name}/replication</str> <str name="pollInterval">00:00:20</str> </lst> </requestHandler>
In fact, some properties, such as solr.core.name , are automatically added to the main area , and you can refer to them in your configuration. As a result, the replication section may be the same for each core if you do not have any specific settings.
Alternatively, you can use the same configuration for master and slave with the following configuration and simply change the value (true or false) that you assign to the environment variables enable.master and enable.slave based on what you want to do. I mean, you can use the same file, but, of course, it will work on different machines, since it does not make much sense to have a master and slaves on the same machine.
<requestHandler name="/replication" class="solr.ReplicationHandler" > <lst name="master"> <str name="enable">${enable.master:false}</str> <str name="replicateAfter">commit</str> </lst> <lst name="slave"> <str name="enable">${enable.slave:false}</str> <str name="masterUrl">http://master_host:8983/solr/${solr.core.name}/replication</str> <str name="pollInterval">00:00:60</str> </lst> </requestHandler>