Solr服务安装(Windows)

简介: Solr是一个独立的企业级搜索应用服务器,它对外提供类似于Web-service的API接口。用户可以通过http请求,向搜索引擎服务器提交一定格式的XML文件,生成索引;也可以通过Http Get操作提出查找请求,并得到XML格式的返回结果。 资源准备 jdk1.7.0_60-x64、apache-tomcat-7.0.55、solr-4.10.2。相关资源下载地址:http:/


Solr是一个独立的企业级搜索应用服务器,它对外提供类似于Web-service的API接口。用户可以通过http请求,向搜索引擎服务器提交一定格式的XML文件,生成索引;也可以通过Http Get操作提出查找请求,并得到XML格式的返回结果。

资源准备

jdk1.7.0_60-x64、apache-tomcat-7.0.55、solr-4.10.2。相关资源下载地址:http://pan.baidu.com/s/1bnCVGTp

提示:Solr是运行在某servlet容器(Tomcat、Jboss、Jetty等)中的web服务,而此版本官方教程——solr-4.10.2/docs/tutorial.html中的实例是基于Jetty容器描述的,此文主要是想将教程中的example实例运行在Tomcat容器里。根文件目录如下:

根文件目录

部署Solr服务

将solr-4.10.2/dlist/solr-4.10.2.war解压到apache-tomcat-7.0.55/webapps下,并将solr-4.10.2文件夹重命名为solr。

指定solr.home

将solr-4.10.2/example/solr/*放到solr/home文件夹下。solr/home文件目录如下:

solr文件目录


指定solr.home的方式有多种:通过JAVA_OPTS设置Tomcat的运行环境变量。

  • JAVA_OPTS(start-solr-4.10.2.bat批处理文件)
    <span style="font-size:18px;">set CURRENT_DIR=%CD%
    set JAVA_HOME=%CURRENT_DIR%\jdk1.7.0_60-x64
    CD %CURRENT_DIR%\apache-tomcat-7.0.55\bin
    set JAVA_OPTS=-Dsolr.solr.home=%CURRENT_DIR%\solr\home -Dsolr.log=%CURRENT_DIR%\solr\home\logs
    call startup.bat start</span>

运行Solr服务及问题解决

依据实际出现顺序

  • 问题01:日志异常

    异常现象

    <span style="font-size:18px;">
    java.lang.NoClassDefFoundError: Failed to initialize Apache Solr: Could not find necessary SLF4j logging jars. If using Jetty, the SLF4j logging jars need to go in the jetty lib/ext directory. For other containers, the corresponding directory should be used. For more information, see: http://wiki.apache.org/solr/SolrLogging
    	at org.apache.solr.servlet.CheckLoggingConfiguration.check(CheckLoggingConfiguration.java:28)
    	at org.apache.solr.servlet.BaseSolrFilter.<clinit>(BaseSolrFilter.java:31)
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    	at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    	at java.lang.Class.newInstance(Class.java:374)
    </clinit></span>

    异常分析

    缺少日志相关JAR包。Solr从V4.3开始将日志相关JAR包与WAR包分离。可以访问提示链接:http://wiki.apache.org/solr/SolrLogging,获得更多信息。

    解决方案

    将solr-4.10.2/example/lib/ext下的*.jar以及solr-4.10.2/example/resources/log4j.properties文件复制到apache-tomcat-7.0.55/lib下。

  • 问题02:JAR包未找到警告

    异常现象

    <span style="font-size:18px;">
    WARN  - 2015-05-22 12:58:58.509; org.apache.solr.core.SolrResourceLoader; Can't find (or read) directory to add to classloader: ../../../contrib/extraction/lib (resolved as: D:\Applications\solr\home\collection1\..\..\..\contrib\extraction\lib).
    WARN  - 2015-05-22 12:58:58.510; org.apache.solr.core.SolrResourceLoader; Can't find (or read) directory to add to classloader: ../../../dist/ (resolved as: D:\Applications\solr\home\collection1\..\..\..\dist).
    WARN  - 2015-05-22 12:58:58.510; org.apache.solr.core.SolrResourceLoader; Can't find (or read) directory to add to classloader: ../../../contrib/clustering/lib/ (resolved as: D:\Applications\solr\home\collection1\..\..\..\contrib\clustering\lib).
    WARN  - 2015-05-22 12:58:58.511; org.apache.solr.core.SolrResourceLoader; Can't find (or read) directory to add to classloader: ../../../dist/ (resolved as: D:\Applications\solr\home\collection1\..\..\..\dist).
    WARN  - 2015-05-22 12:58:58.511; org.apache.solr.core.SolrResourceLoader; Can't find (or read) directory to add to classloader: ../../../contrib/langid/lib/ (resolved as: D:\Applications\solr\home\collection1\..\..\..\contrib\langid\lib).
    WARN  - 2015-05-22 12:58:58.512; org.apache.solr.core.SolrResourceLoader; Can't find (or read) directory to add to classloader: ../../../dist/ (resolved as: D:\Applications\solr\home\collection1\..\..\..\dist).
    WARN  - 2015-05-22 12:58:58.513; org.apache.solr.core.SolrResourceLoader; Can't find (or read) directory to add to classloader: ../../../contrib/velocity/lib (resolved as: D:\Applications\solr\home\collection1\..\..\..\contrib\velocity\lib).
    WARN  - 2015-05-22 12:58:58.514; org.apache.solr.core.SolrResourceLoader; Can't find (or read) directory to add to classloader: ../../../dist/ (resolved as: D:\Applications\solr\home\collection1\..\..\..\dist).
    
    </span>

    异常分析

    在solr/home/collection1/conf/solrconfig.xml配置中要求引入一下JAR包:


    解决方案

    将solr-4.10.2/contrib文件夹和solr-4.10.2/dist文件夹复制到solr文件夹下。将solrconfig.xml文件中的../../../替换为../../。

运行成功

访问路径一下路径:http://localhost:8080/solr,看是否成功?!

Best Wishes For You!

目录
相关文章
|
1月前
|
监控 搜索推荐 开发工具
2025年1月9日更新Windows操作系统个人使用-禁用掉一下一些不必要的服务-关闭占用资源的进程-禁用服务提升系统运行速度-让电脑不再卡顿-优雅草央千澈-长期更新
2025年1月9日更新Windows操作系统个人使用-禁用掉一下一些不必要的服务-关闭占用资源的进程-禁用服务提升系统运行速度-让电脑不再卡顿-优雅草央千澈-长期更新
156 2
2025年1月9日更新Windows操作系统个人使用-禁用掉一下一些不必要的服务-关闭占用资源的进程-禁用服务提升系统运行速度-让电脑不再卡顿-优雅草央千澈-长期更新
|
1月前
|
存储 Cloud Native Java
Windows下Minio的安装以及基本使用
MinIO 是一个开源的云原生分布式对象存储系统,兼容亚马逊S3接口,适合存储大容量非结构化数据。本文介绍Windows下MinIO的安装与基本使用:通过以上步骤,您可以在Windows环境中成功安装并使用MinIO。
246 17
|
2月前
|
关系型数据库 MySQL 数据库
【MySQL基础篇】MySQL概述、Windows下载MySQL8.0超详细图文安装教程
在这一章节,主要介绍两个部分,数据库相关概念及MySQL数据库的介绍、下载、安装、启动及连接。接着,详细描述了MySQL 8.0的版本选择与下载,推荐使用社区版(免费)。安装过程包括自定义安装路径、配置环境变量、启动和停止服务、以及客户端连接测试。此外,还提供了在同一台电脑上安装多个MySQL版本的方法及卸载步骤。最后,解释了关系型数据库(RDBMS)的特点,即基于二维表存储数据,使用SQL语言进行操作,格式统一且便于维护。通过具体的结构图展示了MySQL的数据模型,说明了数据库服务器、数据库、表和记录之间的层次关系。
【MySQL基础篇】MySQL概述、Windows下载MySQL8.0超详细图文安装教程
|
2月前
|
安全 关系型数据库 MySQL
Windows Server 安装 MySQL 8.0 详细指南
安装 MySQL 需要谨慎,特别注意安全配置和权限管理。根据实际业务需求调整配置,确保数据库的性能和安全。
301 9
|
2月前
|
机器学习/深度学习 并行计算 异构计算
WINDOWS安装eiseg遇到的问题和解决方法
通过本文的详细步骤和问题解决方法,希望能帮助你顺利在 Windows 系统上安装和运行 EISeg。
143 2
|
3月前
|
网络安全 Windows
Windows server 2012R2系统安装远程桌面服务后无法多用户同时登录是什么原因?
【11月更文挑战第15天】本文介绍了在Windows Server 2012 R2中遇到的多用户无法同时登录远程桌面的问题及其解决方法,包括许可模式限制、组策略配置问题、远程桌面服务配置错误以及网络和防火墙问题四个方面的原因分析及对应的解决方案。
237 4
|
3月前
|
NoSQL Linux PHP
如何在不同操作系统上安装 Redis 服务器,包括 Linux 和 Windows 的具体步骤
本文介绍了如何在不同操作系统上安装 Redis 服务器,包括 Linux 和 Windows 的具体步骤。接着,对比了两种常用的 PHP Redis 客户端扩展:PhpRedis 和 Predis,详细说明了它们的安装方法及优缺点。最后,提供了使用 PhpRedis 和 Predis 在 PHP 中连接 Redis 服务器及进行字符串、列表、集合和哈希等数据类型的基本操作示例。
160 4
|
XML JSON 负载均衡
Windows 安装solr 8版本并简单测试
Windows 安装solr 8版本并简单测试
490 0
Windows 安装solr 8版本并简单测试
|
5天前
|
安全 Unix 虚拟化
Windows 7 & Windows Server 2008 R2 简体中文版下载 (2025 年 2 月更新)
Windows 7 & Windows Server 2008 R2 简体中文版下载 (2025 年 2 月更新)
32 11
Windows 7 & Windows Server 2008 R2 简体中文版下载 (2025 年 2 月更新)
|
5天前
|
Unix 虚拟化 Windows
Windows Server 2025 中文版、英文版下载 (2025 年 2 月更新)
Windows Server 2025 中文版、英文版下载 (2025 年 2 月更新)
27 7
Windows Server 2025 中文版、英文版下载 (2025 年 2 月更新)