How to configure Solr replication with multiple cores

I have Solr working with multiple cores. Due to the heavy load, I want to configure a slave device that contains the same indexes.

The documentation at http://wiki.apache.org/solr/SolrReplication says: "Add a replication request handler to the solrconfig.xml file for each core," but I only have one solrconfig.xml file.

My configuration:
Config: / data / solr / web / solr / conf / config files
Data: / data / solr / data / solr / core data dirs

Is it really necessary to copy the solrconfig.xml file for each core?
And where should I put these few solrconfig files?

solr.xml

<?xml version="1.0" encoding="UTF-8" ?> <solr persistent="true"> <property name="dih.username" value="user"/> <property name="dih.password" value="passwd"/> <property name="jdbclib" value="/usr/progress/dlc102b/java"/> <property name="dih.dburl" value="jdbc:datadirect:openedge://172.20.7.218:31380;databaseName=easource"/> <cores adminPath="/admin/cores"> <core instanceDir="/data/solr/web/trunk/" name="product" dataDir="/data/solr/data/trunk/product-swap"> <property name="dih-config" value="dih-config-product.xml"/> </core> <core instanceDir="/data/solr/web/trunk/" name="product-swap" dataDir="/data/solr/data/trunk/product"> <property name="dih-config" value="dih-config-product.xml"/> </core> <core instanceDir="/data/solr/web/trunk/" name="periodp" dataDir="/data/solr/data/trunk/periodp"> <property name="dih.config" value="dih-config-periodp.xml"/> </core> <core instanceDir="/data/solr/web/trunk/" name="periodp-swap" dataDir="/data/solr/data/trunk/periodp-swap"> <property name="dih.config" value="dih-config-periodp.xml"/> </core> </cores> </solr> 
+8
replication solr
source share
2 answers

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> 
+16
source share

Yes, you must have an exact copy of the files in each copy of the kernel you are replicating.

To offload even more of your solr instances, I suggest that you use the wizard for indexing only and the 2 slaves replicated from the wizard used to query your documents.

+1
source share

All Articles