在Apache.Solr.3.Enterprise.Search.Server中,作者强烈建议使用多内核,并且与其后面的4.0版本多核有可能是默认设置,刚好项目需要用到多核,研究配置成功,其实也很简单。
因为要用到的两个核是不同索引,不同solrconfig和schema,所以要分别把它们的配置、data放到单独目录便于管理。
1. 在solr.home目录下,新建(若有则修改)solr.xml,代码如下:
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!--
All (relative) paths are relative to the installation path
persistent: Save changes made via the API to this file
sharedLib: path to a lib directory that will be shared across all cores
-->
<solr persistent="false" sharedLib="lib">
<!--
adminPath: RequestHandler path to manage cores.
If 'null' (or absent), cores will not be manageable via request handler
-->
<cores adminPath="/admin/cores" shareSchema="true">
<core name="core_bw" instanceDir="core_bw" dataDir="./data" />
<core name="core_bw2" instanceDir="core_bw2" dataDir="./data" />
</cores>
</solr>
当然,这个solr.xml也可以从下载的solr中找到,在example\solr下。
2. 把每个core对应的data、conf文件夹分别copy到solr.home下的instanceDir目录下(core_bw和core_bw2),启动tomcat,则能看到solr管理页面cores栏,会出现两个可选核心。
3. 以前的访问路径需要做相应修改,例如:
前:http://localhost:8080/solr/search1
后:http://localhost:8080/solr/core_bw/search1
原文介绍:
Configuring solr.xml
When Solr starts up, it checks for the presence of a solr.xml file in the solr.home
directory. If one exists, then it loads up all the cores defined in solr.xml . We've used
multiple cores in the sample Solr setup shipped with this book to manage the various
indexes used in the examples.
You can see the multicore configuration at ./examples/cores/solr.xml:
<solr persistent="false" sharedLib="lib">
<coresadminPath="/admin/cores" shareSchema="true">
<core name="mbtracks" instanceDir="mbtype"
dataDir="../../cores_data/mbtracks" />
<core name="mbartists" instanceDir="mbtype"
dataDir="../../cores_data/mbartists" />
<core name="mbreleases" instanceDir="mbtype"
dataDir="../../cores_data/mbreleases" />
<core name="crawler" instanceDir="crawler"
dataDir="../../cores_data/crawler" />
<core name="karaoke" instanceDir="karaoke"
dataDir="../../cores_data/karaoke" />
</cores>
</solr>
Chapter 8
[ 257 ]
Notice that three of the cores: mbtracks , mbartists, and mbreleases all share the
same instanceDir of mbtype? This allows you to make configuration changes in
one location and affect all three cores.
Some of the key multicore configuration values are:
• persistent="false" specifies that any changes we make at runtime to the
cores, like renaming them, are not persisted. If you want to persist changes
to the cores between restarts, then set persistent="true". Note, this means
the solr.xml file is regenerated without any original comments and requires
the user running Solr to have write access to the filesystem.
• sharedLib="lib" specifies the path to the lib directory containing shared
JAR files for all the cores. On the other hand, if you have a core with its own
specific JAR files, then you would place them in the core/lib directory. For
example, the karaoke core uses Solr Cell (see Chapter 3, Indexing Data ) for
indexing rich content, so the JARs for parsing and extracting data from rich
documents are located in ./examples/cores/karaoke/lib/.
• adminPath specifies the URL path at which the cores can be managed at
runtime. There's no need to change it from "/admin/cores". See below for
details on the various operations you perform to cores.
• shareSchema allows you to use a single in-memory representation of the
schema for all the cores that use the same instanceDir. This can cut down
on your memory use and startup time, especially in situations where you
have many cores, like if you are streaming in data and generating cores on
the fly. If you are interested in using many cores, you should keep an eye on
SOLR-1293 which is the umbrella JIRA issue for Solr that fully supports lots
of cores. I have seen Solr run with dozens of cores with no issues beyond
increased startup time.
• defaultCoreName, if present defines the core to use if you don't include the
core name in the URL, that is /solr/select?q=*:* . This makes it easier to
upgrade from a single core Solr to a multicore setup without changing client
URLs.
Each core is configured via a fairly obvious set of properties:
• name specifies the name of the core, and therefore what to put in the URL to
access the core.
• instanceDir specifies the path to the directory that contains the conf
directory for the core, and data directory too, by default. A relative path
is relative to solr.home. In a basic single-core setup, this is typically set to
the same place as solr.home. In the preceding example we have three cores
using the same configuration directory, and two that have their own specific
configuration directories.
Deployment
[ 258 ]
• dataDir specifies where to store the indexes and any other supp orting data,
like spell check dictionaries. If you don't define it, then by default each core
stores its information in the <instanceDir>/data directory.
• properties="test.properties" allows you to specify a properties file
made up of name value pairs to load for the core. This is either an absolute
path or relative to the instanceDir
分享到:
相关推荐
在解压后,我们可以看到多个Solr实例(通常称为“core”),每个实例代表一个独立的搜索域。通过修改这些实例的配置文件,我们可以定制Solr的行为,例如定义字段类型、设置搜索分析器、调整索引策略等。配置文件主要...
本文将详细介绍如何进行 Solr 的安装与配置。 首先,安装 Solr 需要先确保你的系统已经安装了 Java Development Kit (JDK) 1.6 或以上版本,因为 Solr 需要依赖 JDK 来运行。你可以从 Oracle 的官方网站下载并安装...
8. **core.properties**: 每个Solr核心都有一个core.properties文件,用于标识核心的名字和位置。 9. **Tika配置文件**(如tika-config.xml):如果你使用Tika解析器来处理多种格式的文件,Tika的配置文件将定义...
在 Solr 8 中,为了确保系统的安全性和数据的隐私性,配置用户登录验证是非常重要的步骤。本文将详细介绍如何对手动配置 Solr 8 的用户登录验证。 首先,我们需要了解 Solr 的安全组件——Jetty 容器。Solr 默认...
1. **配置SolrCore**:每个Solr实例都包含一个或多个SolrCore,每个SolrCore对应一个单独的索引。 2. **创建新Core**:在Solr管理界面中,选择“Core Admin”,点击“Add Core”按钮,填写Core名称(例如:myexample...
在`D:\Solr\solr1\home`目录下,可以通过编辑`core.properties`文件来配置核心的相关信息。 - **设置核心名称**:在`core.properties`文件中,可以通过`name`属性设置核心的唯一标识符,例如: ```properties name=...
- 将`solr-4.1.0/example/multicore`下的`core0`、`core1`、`solr.xml`和`zoo.cfg`复制到`d:\solr_data`。 - 再次重启Tomcat服务,通过`http://localhost:8080/solr`访问Solr管理界面。 二、集成IK分词器 1. **...
Solr4.4.0是Solr的一个版本号,本篇文章将介绍如何安装和配置Solr4.4.0来搭建一个基本的搜索服务。 安装和配置Solr4.4.0通常包括以下步骤: 第一步,下载Solr4.4.0安装包。可以通过访问Solr的官方网站下载相应的...
Solr 是一个流行的开源全文搜索引擎,它允许开发者通过配置来实现高效的搜索功能。在Solr中,连接数据库是一项重要的配置,这使得我们可以将数据库中的数据导入到Solr中,以便进行快速检索。这篇博客“solr连接...
`core.properties` 文件包含了关于Solr核的一些全局配置信息,这些配置对于核的正常运行至关重要。 - **name**:核的名称。 - **config**:solrconfig.xml的路径。 - **schema**:schema.xml的路径。 - **dataDir**...
本篇文章将深入探讨在Solr5中配置中文分词的过程。 首先,我们要了解的是分词器(Analyzer)。在Solr中,Analyzer是处理文本输入的组件,它负责将输入的文本转换为可搜索的术语。对于中文,我们需要一个能理解并...
当我们谈论“SolrCore的添加和修改控制”时,我们主要关注如何在Solr中创建、配置、更新和管理SolrCore,以及如何实现对这些操作的安全控制。 1. **创建SolrCore** 要创建一个SolrCore,你需要准备一个配置目录,...
你可以根据需求创建自己的核心,只需在`server/solr/configsets`下复制一个配置集,并在`server/solr`目录下创建对应的核心目录,如`my_core`。 五、定义Schema Schema.xml文件是Solr的核心配置文件,用于定义索引...
solr-core-4.9.0.jar
【Solr入门配置说明】 Solr,全称为Apache Solr,是一个开源的、基于Java的企业级搜索应用服务器。它提供了一种高效、可扩展的全文检索能力,支持多种数据源,如XML、JSON等,通过HTTP接口进行通信,使得开发者能够...
在本篇中,我们将深入探讨Solr 7.7.3的配置细节,并了解如何将其与Spring Boot 2.x进行整合,构建一个高效、可扩展的搜索引擎应用。 **一、Solr 7.7.3核心配置** 1. **安装与启动** - 首先,你需要下载Solr 7.7.3...
Solr配置安装(一) Apache Solr是一款基于Java的开源搜索服务器,由Apache软件基金会开发。它提供了全文检索、命中高亮、拼写检查、实时索引和多种数据类型支持等强大功能,常用于构建高性能的搜索应用。本文将...
在本文中,我们将详细探讨如何配置 Solr 5.4 开发环境,包括安装、配置、以及数据导入,同时也会提及 mmseg4j 分词器的使用。 首先,让我们了解 mmseg4j。这是一款适用于Java的中文分词库,它能够有效地对中文文本...
配置 Solr 的分词搜索功能,需要对 Solr 的核心(core)进行设置。在 Solr 的 `example/multicore` 目录下,找到 `schema.xml` 文件,这是定义索引字段和分词器的地方。你需要在这里添加新的字段,确保它们与你的...