Since SOLR is a solution to a large number of full-text indexing of data, because of the high concurrency problem, we need to consider SOLR's load balancing, SOLR provides a very easy master-slave replication configuration method, then we will configure the SOLR master-slave replication
If we deployed the SOLR service on 192.168.0.8 and 192.168.0.9 two servers, 192.168.0.8 as the primary server,192.168.0.9 as the slave server,
First configure the primary server to locate C:\Program Files\apache software foundation\tomcat 7.0\solr\collection1\conf (SOLR core Collection1 installation path) Under the Solrconfig.xml file
Under this file, find the <requesthandler name= "/replication" class= "SOLR. Replicationhandler "> node, default is stare, instead:
<RequestHandlername= "/replication"class= "SOLR." Replicationhandler " > <LSTname= "Master"> <!--the commit action is triggered when there is data write on master. Slave will initiate a synchronization request - <Strname= "Replicateafter">Commit</Str> <!--startup parameters do not affect synchronization requests - <Strname= "Replicateafter">Startup</Str> <!--Master triggers the optimize operation, slave initiates a synchronization request - <Strname= "Replicateafter">Optimize</Str> <!--In addition to index synchronization, some configuration files are synchronized by default in the Conf folder - <Strname= "Conffiles">Schema.xml,mapping-isolatin1accent.txt,protwords.txt,stopwords.txt,synonyms.txt,elevate.xml</Str> </LST> </RequestHandler>
The meaning of the parameters:
- REPLICATEAFTER:SOLR will run replication on its own after the following actions have occurred: ' Commit ', ' startup ' ' optimize ', here we choose Commit, which is that SOLR runs the replication policy every time the commit request is accepted.
- Conffiles: The configuration file to be distributed. SOLR will also place the field profiles on the primary server: Schema.xml and stopwords.txt, fixed files: elevate.xml synchronized to the secondary server.
- Commitreserveduration: After each commit. Keep the incremental index cycle time, set here to 5 minutes.
next Configure the server
Or the same node under the same file?
<RequestHandlername= "/replication"class= "SOLR." Replicationhandler " > <LSTname= "Slave"> <!--MasterUrl represents the SOLR path for the host. Assuming that there are multiple cores, address write http://localhost:9001/solr/(core name) can - <Strname= "MasterUrl">Http://192.168.0.8/solr/collection1</Str> <!--Synchronization time interval 10 seconds - <Strname= "PollInterval">00:00:10</Str> </LST> </RequestHandler>
parameter description:
- masterurl: Primary server Sync URL address
- pollinterval: synchronization interval from server, That is, how often the primary server
- httpconntimeout is synchronized every once in a while: Set connection timeout (in milliseconds)
- httpreadtimeout: Assuming that the settings synchronization index file is too large, you should increase this value appropriately. (unit: milliseconds)
- httpbasicauthuser: Validation username. Need to be consistent with the primary server
- httpbasicauthpassword: Verify the password. Need to be consistent with the primary server
- compression:external or Internal uses SOLR's own compression algorithm or the
of the application container
Finally, don't forget to restart the two solrserver, this configuration is complete, SOLR supports multiple slave servers
Copyright notice: This article blog original article. Blogs, without consent, may not be reproduced.
SOLR and. NET courses (vii) SOLR master-slave replication