SolrCloud Wiki翻译(4)Distributed Requests

One of the advantages of using SolrCloud is the ability to distribute requests among various shards that may or may not contain the data that you're looking for.  You have the option of searching over all of your data or just parts of it.

使用SolrCloud的一个优势是,SolrCloud能够把你的请求分发到多个shard上面,当然每个shard上面有可能包含也有可能不包含你需要查询的数据。你可以选择在全部数据上进行搜索或者是在一部分数据上搜索。

Querying all shards for a collection should look familiar; it's as though SolrCloud didn't even come into play:

查询一个collection所有shard的url看起来相当眼熟;好像SolrCloud根本没有参与到搜索过程中来一样:

http://localhost:8983/solr/collection1/select?q=*:*

If, on the other hand, you wanted to search just one shard, you can specify that shard, as in:

另一方面,如果你只是想要在单独一个shard里面搜索的话,你可以指定一个shard来进行搜索,如下所示:

http://localhost:8983/solr/collection1/select?q=*:*&shards=localhost:7574/solr

If you want to search a group of shards, you can specify them together:

如果你想要在一系列的shard上面进行搜索的话,你可以把他们声明在一起:

http://localhost:8983/solr/collection1/select?q=*:*&shards=localhost:7574/solr,localhost:8983/solr

Or you can specify a list of servers to choose from for load balancing purposes by using the pipe symbol (|):

或者说你可以通过使用(|)符号来声明一个服务器的的列表供Solr选择达到负载均衡的目的:

http://localhost:8983/solr/collection1/select?q=*:*&shards=localhost:7574/solr|localhost:7500/solr

(If you have explicitly created your shards using ZooKeeper and have shard IDs, you can use those IDs rather than server addresses.)

(如果你明确的通过ZooKeeper用一系列的shard id创建了shard的话,你可以使用这些id来代替,而不是使用服务器地址)

You also have the option of searching multiple collections. For example:

你也可以选择在多个collection上进行搜索,例如:

http://localhost:8983/solr/collection1/select?collection=collection1,collection2,collection3
本文完

你可能感兴趣的:(zookeeper,Lucene,Solr,solrCloud)