Solrcloud多核配置 [英] Solrcloud multicore configuration
问题描述
我有一个独立的 Solr 实例,该实例具有4个不同的内核,可以使用嵌入式Jetty服务器正常工作.我为v4.10.3配置了内核,但是自从我移至v5.1以来,所有内核似乎都可以正常工作,而无需进行任何更改.
I have a standalone Solr instance with 4 different cores working fine using the embedded Jetty server. I configured the cores for v4.10.3 but since I moved to v5.1 and all seems to work fine without any changes.
在投入生产之前,我需要将其设置为 Solrcloud安装,最初有2个节点(两台不同的机器),每个节点1个分片(为简单起见).我一直在尝试使其工作,但我一直无法做到.
Before going into production, I need to set it up as a Solrcloud installation, initially with 2 nodes (two different machines) with 1 shard per node (to keep it simple). I have been trying to get it to work but I have not been able to do it.
我试图像这样运行它(我认为使用start.jar不是首选的方式),已经阅读了Solr会在任何嵌套文件夹中查找多个配置的内核(适用于独立的Solr):
I tried to run it like this (I think using start.jar is not the preferred way), having read that Solr will look for multiple configured cores in any nested folders (which works for standalone Solr):
java -DzkRun -DnumShards=2 -Dbootstrap_confdir=solr/ -jar start.jar
但这没用,它找不到所需的solrconfig.xml
文件.
but that did not work, it does not find the needed solrconfig.xml
file.
我的Solr目录如下所示:
My Solr directory looks like this:
我的solr.xml文件是标准文件:
My solr.xml file is the standard one:
<solr>
<solrcloud>
<str name="host">${host:}</str>
<int name="hostPort">${jetty.port:8983}</int>
<str name="hostContext">${hostContext:solr}</str>
<int name="zkClientTimeout">${zkClientTimeout:30000}</int>
<bool name="genericCoreNodeNames">${genericCoreNodeNames:true}</bool>
</solrcloud>
<shardHandlerFactory name="shardHandlerFactory"
class="HttpShardHandlerFactory">
<int name="socketTimeout">${socketTimeout:0}</int>
<int name="connTimeout">${connTimeout:0}</int>
</shardHandlerFactory>
</solr>
每个核心看起来像这样:
Each core looks like this:
core.properties仅具有核心名称:
And the core.properties just has the name of the core:
name=users
我的问题是:
- 如何启动Solrcloud v5.1,以便选择4个核心?
推荐答案
在SolrCloud中,每个 Core 都将成为集合.
In SolrCloud each of your Core will become a Collection.
每个集合将具有其自己的一组配置文件和数据.
Each Collection will have its own set of Config Files and data.
您可能会发现这很有帮助移动多核SOLR实例到云
You might find this helpful Moving multi-core SOLR instance to cloud
Solr 5.0(及更高版本)对如何使用分片创建SolrCloud设置以及如何添加集合等进行了一些更改.
Solr 5.0 (onwards) has made some changes on how to create a SolrCloud setup with shards, and how to add collections etc.
下面列出的所有内容都是我对《 Solr参考指南》的理解.我强烈建议您仔细阅读. https://cwiki.apache.org/confluence/display/solr /Apache + Solr + Reference + Guide
Everything listed below is my understanding of the Solr Reference Guide. I will highly recommend going through it thoroughly. https://cwiki.apache.org/confluence/display/solr/Apache+Solr+Reference+Guide
我在Linux(CentOS)服务器上设置了服务器,但是这些步骤也可以用于在Windows系统上设置solr.例如,存在solr.cmd
文件而不是solr.sh
I setup my servers on a Linux(CentOS) server, but the steps can be used to setup solr on Windows system also. For example, there is solr.cmd
file instead of solr.sh
这是我创建一个简单的两个碎片SolrCloud设置所遵循的步骤.
Here are the steps I followed to create a simple two shard SolrCloud setup.
-
设置动物园管理员合奏.我假设您正在尝试使用 在solr中嵌入ZK.对于生产系统,它是高度 建议创建一个外部ZK合奏.您可以在此中找到安装外部集成的步骤.参考guid部分
Setup the zookeeper ensemble. I am assuming you are trying to use the embedded ZK in solr. For a production system, it is highly recommended to create a external ZK ensemble. You can find steps to install a external ensemble in this section of reference guid
将solr下载到/opt
文件夹.
Download solr to /opt
folder.
仅提取安装文件.
tar xzf solr-5.0.0.tgz solr-5.0.0/bin/install_solr_service.sh --strip components=2
此命令将在系统上安装 solr
This command will install solr on your system
sudo bash ./install_solr_service.sh solr-5.0.0.tgz
上面的命令将创建一个名为"solr"的新用户(如果不存在).
The above command will create a new user called "solr" if it does not exist.
这些是它将采用的一些默认选项.您可以在/var/solr/solr.in.sh
中查看.这是包含文件,您可以在其中指定其他选项.
These are some of the default options it will assume. You can view this in /var/solr/solr.in.sh
. This is the include file where you can specify other options.
* SOLR_PID_DIR=/var/solr
* SOLR_HOME=/var/solr/data
* LOG4J_PROPS=/var/solr/log4j.properties
* SOLR_LOGS_DIR=/var/solr/logs
* SOLR_PORT=8983
在上述步骤中运行install_solr_service start
将启动solr服务器.在执行以下任何更改之前,请使用service solr stop
停止服务器.
Running install_solr_service start
in the above step will start a solr server. Stop the server using service solr stop
before doing any of the changes below.
更改Java堆值
SOLR_HEAP="3g"
这会将Xmx和Xms设置为3GB. (选修的) Solr 5.1的solr.in.sh文件中未提及此变量.其错误并已修复,将在下一版本中发布.
This will set Xmx and Xms as 3GB . (optional) This variable is not mentioned in the solr.in.sh file in Solr 5.1 . Its a bug and has been fixed, will be released in next version.
SOLR_MODE="solrcloud"
必需
这是您需要在云模式下启动solr的内容.
this is what you need start solr in cloud mode.
ZK_HOST=ZK1:2181,ZK2:2181,ZK3:2181
必需
(用您的zookeeper主机名替换zk)
(replace zk with you zookeeper host names)
运行install_solr_service.sh
命令还会创建一个/etc/init.d/solr
Running the install_solr_service.sh
command also creates a init.d file as /etc/init.d/solr
此init.d
脚本依次调用/opt/solr/bin/solr
脚本,并包含/var/solr/solr.in.sh
This init.d
script in turn calls the /opt/solr/bin/solr
script and includes all the variables from /var/solr/solr.in.sh
完成上述更改后,请使用service solr start
Once you have made the above changes, start solr again using service solr start
创建集合碎片和副本 -现在,所有与分片,集合,副本相关的命令都是使用Collections API完成的.
Creating Collections Shards and Replicas - All shard, collection, replica related commands are now made using Collections API.
-
在创建集合之前,应将config文件夹上载到ZK. 可以使用solr文件夹中的zkcli.sh脚本(不在zookeeper服务器上)完成此操作 文件夹:
/opt/solr/server/scripts/cloud-scripts
Before creating a collection a config folder should be uploaded to ZK . This can be done using the zkcli.sh script in the solr folder (not on the zookeeper servers) Folder:
/opt/solr/server/scripts/cloud-scripts
上载confg文件夹的命令是
The command to upload the confg folder is
sh zkcli.sh -cmd upconfig -zkhost zk1:2181,zk2:2181,zk3:2181 -confname yourconfigname -confdir /var/solr/configs/conf
您将为4个内核中的每个内核运行4次此命令,每次更改conf文件夹的路径和配置名称.
- 这将在zookeeper中将所有配置文件上传到conf文件夹中,名称为"yourconfigname".
创建收藏集 我使用以下命令创建了一个新集合.
Creating a collection I used the following command to create a new collection.
这篇关于Solrcloud多核配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!