Frontier
In the search engine, the cache is considered an indispensable part, but in many cases, the implementation of the cache over-reliance on the distributor and webserver will greatly aggravate the burden of webserver, the specific performance is the recurrent suspended animation, denial of service, so in order to liberate the front-end forwarding server, We will implement the cache using the SOLR + memcache backend partner combination.
Pre-preparation conditions:
Click below to download the Memcache Essentials Toolkit and Java class to your local
Memcached-2.2.jar
Spy-2.4.jar
:
Http://solr-side.googlecode.com/files/solr-memcache.zip
Operation Steps:
- Unzip the solr-memcache.zip into a folder, open the folder
- Cut the Memcached-2.2.jar and Spy-2.4.jar in the Lib folder under the Solr-memcache folder to the Lib folder in the SOLR project and make the relevant references.
- Place the Memcachedcache.java file in Src/main/java/org/apache/solr/search in this Solr-memcahe folder in the location of the package specified in the SOLR project: Org.apache.solr.search
- Org.apache.solr.search found Docset.java in the SOLR project
- Enables the Docsetbase class in the file to implement the Serializable interface to support serialization.
- Modify the Solrconfig.xml file, locate the Queryresultcache portal, comment out this node, and add the following nodes:
- <queryresultcache
- class=
- memcachedhosts=" 192.168.0.100,192.168.0.101:1234,192.168.0.103 "
- exptime=" 21600 "&NBSP;&NBSP;&NBSP;&NBSP;
- < span class= "attribute" >defaultport= "11211" &NBSP;&NBSP;&NBSP;&NBSP;
- keyprefix= "" />
Restart SOLR, open SOLR's status display page to see if the previous LRUCache was replaced by Memcachecache
http://192.168.1.109:8080/solr/novel/admin/stats.jsp
View Plaincopy
- Name:queryresultcache
- Class:org.apache.solr.search.MemcachedCache
- Version: 1.0
- Description:memcachedcache ([192.168. 1.109], Defaultport:11211, Exptime:21600, Keyprefix:)
- Stats:lookups: 2
- Hits: 0
- Hitratio: 0.00
- Inserts: 3
- Evictions: 0
- Size: 0
- Warmuptime: 0
- Cumulative_lookups: 2
- Cumulative_hits: 0
- Cumulative_hitratio: 0.00
- Cumulative_inserts: 2
- Cumulative_evictions: 0
- Indexversion: 0
Parameter indication
- memcachedhosts:memcached server IP, multiple intermediate "," number separated
- Exptime: Failure time (in seconds)
- Defaultport:memcached using port numbers
Use memcached cache instead of LRUCache cache in SOLR