SOLR and. NET Series courses (vii) SOLR master-slave replication
Since SOLR is a solution to a large number of full-text indexing of data, due to the high concurrency problem, we have to consider SOLR's load balancing, SOLR provides a very simple master-slave replication configuration method, then we will configure the SOLR master-slave replication
Suppose we deployed the SOLR service on the 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 find 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, which is commented by default, instead:
<RequestHandlername= "/replication"class= "SOLR." Replicationhandler " > <LSTname= "Master"> <!--A commit action is triggered when data is written on master, and slave initiates a synchronization request - <Strname= "Replicateafter">Commit</Str> <!--The startup parameter does not affect the synchronization request - <Strname= "Replicateafter">Startup</Str> <!--Master triggers the optimize operation, slave initiates a synchronization request - <Strname= "Replicateafter">Optimize</Str> <!--In addition to the index synchronization, some configuration file synchronization, the default is in the Conf directory - <Strname= "Conffiles">Schema.xml,mapping-isolatin1accent.txt,protwords.txt,stopwords.txt,synonyms.txt,elevate.xml</Str> </LST> </RequestHandler>
Parameter meaning:
- REPLICATEAFTER:SOLR will perform replication on its own after the following actions have occurred: ' Commit ', ' startup ' ' optimize ', here we choose Commit, that is, each time SOLR accepts a commit request, it executes the replication policy.
- 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, the cycle time of the incremental index is preserved, which is set to 5 minutes.
Next Configure the slave server
Or the same node under the same file?
<RequestHandlername= "/replication"class= "SOLR." Replicationhandler " > <LSTname= "Slave"> <!--MasterUrl represents the SOLR path for the host, and if multiple cores are present, address write http://localhost:9001/solr/(core name) - <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: master server sync URL address
- PollInterval: Synchronization interval from the server, that is, how often the primary server is synchronized every time
- Httpconntimeout: Set connection timeout (in milliseconds)
- Httpreadtimeout: If you set the synchronization index file too large, you should increase this value appropriately. (Unit: milliseconds)
- Httpbasicauthuser: Verify user name, need to be consistent with primary server
- Httpbasicauthpassword: Verify the password and be consistent with the primary server
- Compression:external or internal using SOLR's own compression algorithm or application container
Finally, don't forget to restart the two SOLR servers so that the configuration is complete and SOLR supports multiple slave servers
SOLR and. NET Series courses (vii) SOLR master-slave replication