Index replication in SOLR distributed configuration (original)

Source: Internet
Author: User
Tags solr

SOLR index replication: Copies an index from the master server to multiple servers.
Index replication reason: when many customers access a SOLR server concurrently, this may cause the SOLR server to crash (the SOLR server cannot meet the concurrent access requirements of these customers ), in this case, SOLR index replication is required to reduce the performance requirements on the server.
The following describes the simplest configuration of the Master/Slave server (the following configuration has been verified in the project ):
My environment: SOLR master (10.148.73.83), SOLR slave (10.148.74.72), JDK 1.6.0 _ 13, Master (APACHE-Tomcat-6.0.28), slave (APACHE-Tomcat-6.0.29), apache-solr-3.6.0
First, integrate SOLR with Tomcat. You can refer to the integration of solr3.6 and tomcat.
Configure the master server SOLR master (10.148.73.83) and add the following content to solrconfig. xml:

<requestHandler name="/replication" class="solr.ReplicationHandler" >  <lst name="master">  <str name="replicateAfter">commit</str> <str name="replicateAfter">optimize</str><str name="backupAfter">optimize</str><int name="numberToKeep">2</int><str name="confFiles">schema.xml,stopwords.txt,elevate.xml</str>  <str name="commitReserveDuration">00:00:30</str> <str name="httpBasicAuthUser">admin</str>  <str name="httpBasicAuthPassword">admin</str></lst>  </requestHandler>

Replicateafter: SOLR automatically performs the following copy operations: 'commit ', 'startup', 'optimize'. You can enter multiple values.
Backupafter: SOLR executes the backup index after the following operations occur: 'commit ', 'startup', 'optimize'. You can enter multiple values.
Numbertokeep: specifies the number of files backed up. The default value is max_value.
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, which is set to 30 seconds.


Configure the slave server SOLR slave (10.148.74.72) and add the following content to solrconfig. xml:

<Requesthandler name = "/replication" class = "SOLR. replicationhandler "> <lst name =" slave "> <STR name =" masterurl "> http: // 10.148.73.83: 8080/SOLR/replication </STR> <STR name = "pollinterval"> 00:00:30 </STR> <! -- The following parameters are not commonly used, optional parameter --> <STR name = "compression"> internal </STR> <STR name = "httpconntimeout"> 100000 </STR> <STR name = "httpreadtimeout"> 1000000 </STR> <STR name = "httpbasicauthuser"> admin </STR> <STR name = "httpbasicauthpassword"> admin </STR> </lst> </requesthandler>

Masterurl: the URL of the primary index. The secondary index will synchronize the index from the primary index address.
Pollinterval: The slave server synchronization interval, that is, the interval at which the master server Synchronizes time, in the format of HH: mm: Ss. if this parameter is set to null, the index will not be automatically synchronized from the primary index. in addition, the index pulling request can also be triggered through the admin page or http api.
Compression: compression is used during index transmission. The optional values include internal and external.
If the value is 'external ', make sure that the accept-encoding header has been set for the SOLR of the primary index.
If the value is 'internal', the index data will be automatically compressed, which is mainly used in the case of low bandwidth, please do not use it in the LAN, use in the LAN will reduce the replication efficiency
Httpconntimeout: sets the connection timeout (unit: milliseconds)
Httpreadtimeout: Set read timeout. If the synchronization index file is too large, increase the 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

Note: there can be multiple slave servers, and the configurations of multiple slave servers are the same.

So far, the configuration of SOLR index replication is complete. Now you can start two servers and view the master server's replication page through http: // 10.148.73.83: 8080/SOLR/admin/replication /.


You can view the replication control page of the slave server through http: // 10.148.74.72: 8080/SOLR/admin/replication /.


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.