Solr and. net series course (7) solr master-slave replication,. netsolr

Source: Internet
Author: User

Solr and. net series course (7) solr master-slave replication,. netsolr

Solr and. net series course (7) solr master-slave Replication

Since solr is a solution to solve the full-text index of a large amount of data, due to the high concurrency problem, we need to consider solr load balancing. solr provides a very simple configuration method for master-slave replication, next we will configure the master-slave replication of solr.

Suppose we have deployed the solr service on 192.168.0.8 and 192.168.0.9, 192.168.0.8 as the master server, and 192.168.0.9 as the slave server,

First, configure the master server to find the solrconfig. xml file under C: \ Program Files \ Apache Software Foundation \ Tomcat 7.0 \ solr \ collection1 \ conf (solr core collection1 installation path ).

Find the <requestHandler name = "/replication" class = "solr. ReplicationHandler"> node in this file. The node is annotated by default and changed:

<RequestHandler name = "/replication" class = "solr. ReplicationHandler"> <lst name = "master"> <! -- When data is written to the master, the commit operation is triggered, and slave initiates a synchronization request --> <str name = "replicateAfter"> commit </str> <! The -- startup parameter does not affect synchronization requests --> <str name = "replicateAfter"> startup </str> <! -- When the master triggers the optimize operation, slave will initiate a synchronization request --> <str name = "replicateAfter"> optimize </str> <! -- In addition to index synchronization, some configuration files are synchronized under the conf directory by default --> <str name = "confFiles"> delimiter, elevate. xml </str> </lst> </requestHandler>

Parameter description:

  • ReplicateAfter: SOLR will perform a copy after the following operations occur: 'commit ', 'startup' 'optimize'. Here we choose commit, that is, after SOLR receives a commit request every time, the replication policy is executed.
  • ConfFiles: the configuration file to be distributed. solr also synchronizes the field configuration files schema.xmland stopwords.txt on the master server, and the solid partition file: elevate. xml to the slave server.
  • CommitReserveDuration: the cycle time for retaining the incremental index after each commit. Set this parameter to 5 minutes.

Next, configure the slave server

Or the node under the same file

<RequestHandler name = "/replication" class = "solr. ReplicationHandler"> <lst name = "slave"> <! -- MasterUrl indicates the solr path of the host. If multiple cores exist, write http: // localhost: 9001/solr/(core name) to the address) you can --> <str name = "masterUrl"> http: // 192.168.0.8/solr/collection1 </str> <! -- Synchronization interval: 10 seconds --> <str name = "pollInterval"> 00:00:10 </str> </lst> </requestHandler>

Parameter description:

  • MasterUrl: synchronization URL of the master server
  • PollInterval: The slave server synchronization interval, that is, the interval at which the master server Synchronizes time.
  • HttpConnTimeout: sets the connection timeout (unit: milliseconds)
  • HttpReadTimeout: If the synchronization index file is too large, increase this value as appropriate. (Unit: milliseconds)
  • HttpBasicAuthUser: the authentication username, which must be consistent with the master server
  • HttpBasicAuthPassword: The verification password, which must be consistent with the master server
  • Compression: external or internal uses SOLR's own compression algorithm or application container's

Finally, do not forget to restart the two solr servers. This completes the configuration. solr supports multiple slave servers.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.