A brief description of Solr master-slave cluster configuration and a brief description of solr master-slave Cluster
Solr clusters are mainly divided into master-slave and SolrCloud clusters. It is applicable to read-dominated scenarios. SolrCloud is suitable for scenarios with large data volumes and updates from time to time. Therefore, the master-slave configuration of solr is very simple. Find <requestHandler name = "/replication" class = "solr. ReplicationHandler"> In solrconfig. xml. Here, replication mainly addresses master-slave replication. It mainly implements data write operations on the master node and read operations on the slave node. When the concurrency is large, you can expand the number of slave nodes to cope with this problem. Multiple slave nodes provide a reverse proxy and Server Load balancer (In this article, we will not explain it. If necessary, nginx, apache, and other load software can be used for query. Now, let's take a look at the master node configuration:
<requestHandler name="/replication" class="solr.ReplicationHandler" > <!-- To enable simple master/slave replication, uncomment one of the sections below, depending on whether this solr instance should be the "master" or a "slave". If this instance is a "slave" you will also need to fill in the masterUrl to point to a real machine. --> <lst name="master"> <str name="replicateAfter">commit</str> <str name="replicateAfter">startup</str> <str name="confFiles">schema.xml,stopwords.txt,spellings.txt,synonyms.txt</str> </lst> <!-- <lst name="slave"> <str name="masterUrl">http://your-master-hostname:8983/solr</str> <str name="pollInterval">00:00:60</str> </lst> -->
Master indicates that the core is the master node. Replication occurs after commit and startup. CofFiles indicates the configuration file copied to the slave node. (Remember, the configurations of solrconfig. xml in the master and slave nodes are different. Do not copy solrconfig. xml to the slave node ).
Let's look at the slave node configuration. The slave configuration is very simple. comment out the master section in the configuration file above. Let go of the slave section. Replace masterUrl with the master url in the format of http: // your-master-host: port/solr/your_core_name. The specific configuration is as follows:
<requestHandler name="/replication" class="solr.ReplicationHandler" > <!-- To enable simple master/slave replication, uncomment one of the sections below, depending on whether this solr instance should be the "master" or a "slave". If this instance is a "slave" you will also need to fill in the masterUrl to point to a real machine. --> <!-- <lst name="master"> <str name="replicateAfter">commit</str> <str name="replicateAfter">startup</str> <str name="confFiles">schema.xml,stopwords.txt</str> </lst> --> <lst name="slave"> <str name="masterUrl">http://192.9.104.116:8090/solr/POI</str> <str name="pollInterval">00:00:20</str> </lst> </requestHandler>
PollInterval indicates how often data is synchronized to the master. The data format is {hour }:{ minute }:{ second }. This depends on your business scenario. If updates are frequent, adjust the value to a smaller value. Otherwise, increase the value. During data synchronization, data between slave instances is not synchronized according to different network and machine configurations. If you have requirements, pay attention to them. In short, any cluster solution is not omnipotent. Solr's Master/Slave Mode currently has many problems, such as single point of failure on the master node. We hope the subsequent versions will be improved.