Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/solr/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Service 如何从用户创建的windows服务启动和停止SOLR_Service_Solr - Fatal编程技术网

Service 如何从用户创建的windows服务启动和停止SOLR

Service 如何从用户创建的windows服务启动和停止SOLR,service,solr,Service,Solr,我有两个bat文件start.bat和stop.bat用于手动启动和停止SOLR服务器, 我是否可以创建一个windows服务,在启动服务时调用start.bat,在停止服务时调用stop.bat,Solr运行在类似Tomcat的Servlet容器上。因此,要启动Solr,您必须使用Servlet容器配置Solr,然后启动 是的,您当然可以创建Windows服务。但是,您还没有提到运行Solr使用哪个Servlet容器 如果是Apache Tomcat,请点击这里: 1. Just go to

我有两个bat文件start.bat和stop.bat用于手动启动和停止SOLR服务器,
我是否可以创建一个windows服务,在启动服务时调用start.bat,在停止服务时调用stop.bat,Solr运行在类似Tomcat的Servlet容器上。因此,要启动Solr,您必须使用Servlet容器配置Solr,然后启动

是的,您当然可以创建Windows服务。但是,您还没有提到运行Solr使用哪个Servlet容器

如果是Apache Tomcat,请点击这里:

1. Just go to tomcat/bin folder from command prompt
2. Say service.bat install
3. You can see the service being listed in the Microsoft Services
Application
4. Right click on the service and add solr home (in Start
parameters). For an example if your Solr home is in D drive then:
-Dsolr.solr.home="D:\solr"
5.You are done. Just right click on the service, start it or even you can set 
it to start automatically when your system starts.

考虑使用Tomcat的Solr多核特性。每个核心就像一个完全成熟的安装,“单独的配置和索引,为不同的应用程序提供各自的配置和模式,但仍然有统一管理的便利性”

即使您不使用多个索引,设置起来也要优雅得多。如果将Tomcat设置为这种方式,则Solr在启动时可用。我假设您使用的是Solr1.4

您需要执行以下步骤:

设置solr根目录 概述

c:\solr 
 |-lib
 |-solr.war
 |-solr.xml
c:\solr 
 |-lib
 |-solr.war
 |-solr.xml
 |-myindexdir
   |-bin
   |-conf
   |-data
  • 创建c:\solr
  • 从Solr包目录,将lib目录复制到root目录
  • 从Solr包目录的\example\webapps中,复制Solr.war
  • xml包含以下内容

    <?xml version="1.0" encoding="UTF-8" ?>
    <solr persistent="false" sharedLib="lib">
      <cores adminPath="/admin/cores">
    
        <core name="myindex" instanceDir="myindexdir" />
    
      </cores>
    </solr>
    
  • 将配置完成后的conf目录复制到myindexdir。不要费心创建垃圾箱和数据,它将自动创建
  • 设置tomcat
  • 安装Tomcat,运行一次(不要跳过此操作)并打开以查看它是否已成功安装
  • 当然,可以使用services.msc将其设置为启动时启动
  • 打开这个目录 Apache软件基金会\Tomcat 6.0\conf\Catalina\localhost
  • 创建文件mysearchapp.xml

    Context docBase="c:\solr\solr.war" debug="0" crossContext="true" >
       <Environment name="solr/home" type="java.lang.String" value="c:\solr\" override="true" />
    </Context>
    
  • 现在,您的核心操作是否像

    Welcome to Solr!
    Solr Admin myindex