搜索多个Solr核心的最佳方法 [英] Best way to search multiple solr core

查看:323
本文介绍了搜索多个Solr核心的最佳方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个用作solr客户端的应用程序。我必须进行多核搜索,其中字段完全相同。我不知道实现它的最佳方法。我在Java中使用solrj。
最好是使用solr的分布式搜索或使用应用程序侧的线程在每个单独的核心上进行搜索?



示例

  http:// XXXX:8983 / solr / core1 
http:// XXXX:8983 / solr / core2
http:/ / XXXX:8983 / solr / core3
http:// XXXX:8983 / solr / core4

每个核心的字段都相同。



我想高效搜索所有颜色并得到结果集。




在这种情况下,请查看Cloud菜单,这将向您显示Cluster的网络拓扑以及在SolrJ实现中使用的集合的名称。请参阅所附图片:




  1. 如果缺少云菜单(图1)。您应该将现有核心从独立的Solr配置移动到SolrCloud。

要清楚,您不能将现有的Solr实例从独立实例切换到SolrCloud。我建议的最简单方法是创建一个新的SolrCloud集群并为所有核心重新编制索引。我还建议看看 SolrCloud配置中的Solr术语



以下几行是创建SolrCloud的步骤:




  • create Zookeeper合奏

  • 创建一个或多个Solr实例并以SolrCloud模式启动它们(即,指定zookeeper连接字符串参数 -z zk-node1:2181,zk-node2:2181,zk-在Solr启动时为node3:2181

  • 将您的Solr集合配置上传到Zookeeper(使用 Solr zkcli.sh工具

  • 创建您的收藏集-集合API-创建集合



现在您可以开始将文档移动(重新索引)到ne w您创建的品牌集合。



根据要重新索引的文档的大小和数量,您必须创建多个分片才能拆分集合



我强烈建议您在操场上练习,例如,使用 -cloud -e cloud 参数。这样可以在同一台服务器上启动更多Solr实例和一个Zookeeper独立实例,但是可以将其视为一个玩具,以了解其工作原理。


I'm developing an application that serves as a client for solr. I have to do a multi-core search where the fields are exactly the same. I do not know the best way to implement it. I'm using solrj in java. What would be best to use Distributed Search from solr or search on each separate core using threads on the application side?

Example

http://XXXX:8983/solr/core1
http://XXXX:8983/solr/core2
http://XXXX:8983/solr/core3
http://XXXX:8983/solr/core4

The fields in each core are the same.

I want to search efficiently search in all colors with a resulting result-set.

Solr UI

At this moment I have 26 cores, the largest have Num Docs: 4677529 Size: 56.7 GB

The others have similar values. The number of cores tends to increase.

Thanks

解决方案

As far as I understand from question and comments your scenario is perfect for SolrCloud, which is the name of a configuration that enables a set of new distributed capabilities in Solr.

A collection is a complete logical index that could be physically distributed across more Solr instances.

When you have to submit a query to your collection all you have to do is refer to the collection like previously you did with your cores. The SolrJ client should be built in a different manner, you have to specify the zookeeper connection string, use the CloudSolrClient and specify the default collection.

String zkHostString = "zkServerA:2181,zkServerB:2181,zkServerC:2181/solr";
CloudSolrClient solr = new CloudSolrClient.Builder().withZkHost(zkHostString).build();
solr.setDefaultCollection("collectionName");

This let you to the following options:

  1. Your configuration is already a SolrCloud environment but didn't know anything about. Let's check if your Solr admin (taken from of one of your Solr Instances) and see if there is "Cloud" menu in the left menu. See the attached image

In this case, have a look at Cloud menu, this will show you the network topology of your Cluster and the name of the collection to use in your SolrJ implementation. See the attached image:

  1. In case the "Cloud" menu is missing (image 1). You should move your existing cores from a standalone Solr configuration to SolrCloud.

To be clear you cannot switch your existing Solr instances from standalone to SolrCloud. The simplest way I would suggest is create a new SolrCloud cluster and reindex all your cores. I also suggest to have a look at Solr terminology in a SolrCloud configuration.

In the following lines are the steps to create a SolrCloud:

Now you can start to move (reindex) your documents into the new brand collection you have created.

From the size and the number of documents you're re-indexing you have to create a number of shards in order to split the collection across your SolrCloud instances.

I strongly suggest to make practice with a playground, for example start a recent version of Solr (6.x) with the -cloud -e cloud parameter. This would start more Solr instances and a zookeeper standalone all on the same server, but consider this just as a toy to see how the things work.

这篇关于搜索多个Solr核心的最佳方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆