What is Distributed Search?
当一个索引越来越大,达到一个单一的系统无法满足磁盘需求的时候,或者一次简单的查询实在要耗费很多的时间的时候,我们就可以使用solr的分布式索引了。在分布式索引中,原来的大索引,将会分成多个小索引(索引并不定规模小,之前称之为小索引相对于之前的整个索引来讲的),solr可以将从这些小索引返回的结果合并,然后返回给客户端。
如果当前的solr查询请求能够很快被处理,而你只是希望整个搜索系统的处理能力,那么你可以看看这篇文章http://wiki.apache.org/solr/CollectionDistribution。
#make a copy
cd solr
cp -r example example7574
#change the port number
perl -pi -e s/8983/7574/g example7574/etc/jetty.xml example7574/exampledocs/post.sh
#in window 1, start up the server on port 8983
cd example
java -server -jar start.jar
#in window 2, start up the server on port 7574
cd example7574
java -server -jar start.jar
#in window 3, index some example documents to each server
cd example/exampledocs
./post.sh [a-m]*.xml
cd ../../example7574/exampledocs
./post.sh [n-z]*.xml
#now do a distributed search across both servers with your browser or curl
curl 'http://localhost:8983/solr/select?shards=localhost:8983/solr,localhost:7574/solr&indent=true&q=ipod+solr'