You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Guillaume Belrose <Gu...@quantel.com> on 2015/06/04 11:52:18 UTC

Running Solr 5.1.0 as a Service on Windows

Hi, 

I've successfully used procrun (see http://commons.apache.org/proper/commons-daemon/procrun.html) to wrap Solr 5.1 solr.cmd script as a Windows service (I’ve only tested on Windows 2008 R2). Previously, I was using Procrun to manage Jetty services running the Solr.war from older versions but with a bit a tweaking, I was able to wrap the new Solr 5.1.0 scripts.

I roughly did the following:
-download and unzip the Solr 5.1.0 distribution to a local folder (i.e. c:\opt )
-download and unzip the Apache Commons Daemon .zip file (from http://commons.apache.org/proper/commons-daemon/download_daemon.cgi) in my solr local folder (i.e. c:\opt\solr-5.1.0)
-run the batch file [1].

All of this was done through Ansible Playbooks which is the tool I use for configuration management on Windows and Linux.

Cheers, 

Guillaume.

[1] 
@echo off
set SERVICE_NAME=solr
set SERVICE_HOME=c:\opt\solr-5.1.0
set PR_INSTALL=%SERVICE_HOME%\amd64\prunsrv.exe

@REM Service Log Configuration
set PR_LOGPREFIX=%SERVICE_NAME%
set PR_LOGPATH=%SERVICE_HOME%\logs
set PR_STDOUTPUT=auto
set PR_STDERROR=auto
set PR_LOGLEVEL=Debug

set PR_STARTUP=auto
set PR_STARTMODE=exe
set PR_STARTIMAGE=%SERVICE_HOME%\bin\solr.cmd
set PR_STARTPARAMS=start

@REM Shutdown Configuration
set PR_STOPMODE=exe
set PR_STOPIMAGE=%SERVICE_HOME%\bin\solr.cmd
set PR_STOPPARAMS=stop -p 8983

%PR_INSTALL% //IS/%SERVICE_NAME% ^
  --Description="Solr-5.1.0" ^
  --DisplayName="%SERVICE_NAME%" ^
  --Install="%PR_INSTALL%" ^
  --Startup="%PR_STARTUP%" ^
  --LogPath="%PR_LOGPATH%" ^
  --LogPrefix="%PR_LOGPREFIX%" ^
  --LogLevel="%PR_LOGLEVEL%" ^
  --StdOutput="%PR_STDOUTPUT%" ^
  --StdError="%PR_STDERROR%" ^
  --StartMode="%PR_STARTMODE%" ^
  --StartImage="%PR_STARTIMAGE%" ^
  --StartParams="%PR_STARTPARAMS%" ^
  --StopMode="%PR_STOPMODE%" ^
  --StopImage="%PR_STOPIMAGE%" ^
  --StopParams="%PR_STOPPARAMS%"

if not errorlevel 1 goto installed
echo Failed to install "%SERVICE_NAME%" service.  Refer to log in %PR_LOGPATH%
exit /B 1

:installed
echo The Service "%SERVICE_NAME%" has been installed
exit /B 0
---------------------------------------------------------------------------------------
This email has been scanned for email related threats and delivered safely by Mimecast.
For more information please visit http://www.mimecast.com
---------------------------------------------------------------------------------------


Re: Running Solr 5.1.0 as a Service on Windows

Posted by William Bell <bi...@gmail.com>.
https://issues.apache.org/jira/browse/SOLR-7644

On Sun, Jun 7, 2015 at 11:54 AM, William Bell <bi...@gmail.com> wrote:

> Why don't we change the bin/run -d to have Common Daemons? This would be a
> great enhancement to SOLR 5.x.
>
> We would switch to this if it was integrated. We currently use RunIt. But
> love Common Daemons.
>
> http://smarden.org/runit/
> http://commons.apache.org/proper/commons-daemon/
>
>
> On Thu, Jun 4, 2015 at 3:52 AM, Guillaume Belrose <
> Guillaume.Belrose@quantel.com> wrote:
>
>>
>> Hi,
>>
>> I've successfully used procrun (see
>> http://commons.apache.org/proper/commons-daemon/procrun.html) to wrap
>> Solr 5.1 solr.cmd script as a Windows service (I’ve only tested on Windows
>> 2008 R2). Previously, I was using Procrun to manage Jetty services running
>> the Solr.war from older versions but with a bit a tweaking, I was able to
>> wrap the new Solr 5.1.0 scripts.
>>
>> I roughly did the following:
>> -download and unzip the Solr 5.1.0 distribution to a local folder (i.e.
>> c:\opt )
>> -download and unzip the Apache Commons Daemon .zip file (from
>> http://commons.apache.org/proper/commons-daemon/download_daemon.cgi) in
>> my solr local folder (i.e. c:\opt\solr-5.1.0)
>> -run the batch file [1].
>>
>> All of this was done through Ansible Playbooks which is the tool I use
>> for configuration management on Windows and Linux.
>>
>> Cheers,
>>
>> Guillaume.
>>
>> [1]
>> @echo off
>> set SERVICE_NAME=solr
>> set SERVICE_HOME=c:\opt\solr-5.1.0
>> set PR_INSTALL=%SERVICE_HOME%\amd64\prunsrv.exe
>>
>> @REM Service Log Configuration
>> set PR_LOGPREFIX=%SERVICE_NAME%
>> set PR_LOGPATH=%SERVICE_HOME%\logs
>> set PR_STDOUTPUT=auto
>> set PR_STDERROR=auto
>> set PR_LOGLEVEL=Debug
>>
>> set PR_STARTUP=auto
>> set PR_STARTMODE=exe
>> set PR_STARTIMAGE=%SERVICE_HOME%\bin\solr.cmd
>> set PR_STARTPARAMS=start
>>
>> @REM Shutdown Configuration
>> set PR_STOPMODE=exe
>> set PR_STOPIMAGE=%SERVICE_HOME%\bin\solr.cmd
>> set PR_STOPPARAMS=stop -p 8983
>>
>> %PR_INSTALL% //IS/%SERVICE_NAME% ^
>>   --Description="Solr-5.1.0" ^
>>   --DisplayName="%SERVICE_NAME%" ^
>>   --Install="%PR_INSTALL%" ^
>>   --Startup="%PR_STARTUP%" ^
>>   --LogPath="%PR_LOGPATH%" ^
>>   --LogPrefix="%PR_LOGPREFIX%" ^
>>   --LogLevel="%PR_LOGLEVEL%" ^
>>   --StdOutput="%PR_STDOUTPUT%" ^
>>   --StdError="%PR_STDERROR%" ^
>>   --StartMode="%PR_STARTMODE%" ^
>>   --StartImage="%PR_STARTIMAGE%" ^
>>   --StartParams="%PR_STARTPARAMS%" ^
>>   --StopMode="%PR_STOPMODE%" ^
>>   --StopImage="%PR_STOPIMAGE%" ^
>>   --StopParams="%PR_STOPPARAMS%"
>>
>> if not errorlevel 1 goto installed
>> echo Failed to install "%SERVICE_NAME%" service.  Refer to log in
>> %PR_LOGPATH%
>> exit /B 1
>>
>> :installed
>> echo The Service "%SERVICE_NAME%" has been installed
>> exit /B 0
>>
>> ---------------------------------------------------------------------------------------
>> This email has been scanned for email related threats and delivered
>> safely by Mimecast.
>> For more information please visit http://www.mimecast.com
>>
>> ---------------------------------------------------------------------------------------
>>
>>
>
>
> --
> Bill Bell
> billnbell@gmail.com
> cell 720-256-8076
>



-- 
Bill Bell
billnbell@gmail.com
cell 720-256-8076

Re: Running Solr 5.1.0 as a Service on Windows

Posted by William Bell <bi...@gmail.com>.
Why don't we change the bin/run -d to have Common Daemons? This would be a
great enhancement to SOLR 5.x.

We would switch to this if it was integrated. We currently use RunIt. But
love Common Daemons.

http://smarden.org/runit/
http://commons.apache.org/proper/commons-daemon/


On Thu, Jun 4, 2015 at 3:52 AM, Guillaume Belrose <
Guillaume.Belrose@quantel.com> wrote:

>
> Hi,
>
> I've successfully used procrun (see
> http://commons.apache.org/proper/commons-daemon/procrun.html) to wrap
> Solr 5.1 solr.cmd script as a Windows service (I’ve only tested on Windows
> 2008 R2). Previously, I was using Procrun to manage Jetty services running
> the Solr.war from older versions but with a bit a tweaking, I was able to
> wrap the new Solr 5.1.0 scripts.
>
> I roughly did the following:
> -download and unzip the Solr 5.1.0 distribution to a local folder (i.e.
> c:\opt )
> -download and unzip the Apache Commons Daemon .zip file (from
> http://commons.apache.org/proper/commons-daemon/download_daemon.cgi) in
> my solr local folder (i.e. c:\opt\solr-5.1.0)
> -run the batch file [1].
>
> All of this was done through Ansible Playbooks which is the tool I use for
> configuration management on Windows and Linux.
>
> Cheers,
>
> Guillaume.
>
> [1]
> @echo off
> set SERVICE_NAME=solr
> set SERVICE_HOME=c:\opt\solr-5.1.0
> set PR_INSTALL=%SERVICE_HOME%\amd64\prunsrv.exe
>
> @REM Service Log Configuration
> set PR_LOGPREFIX=%SERVICE_NAME%
> set PR_LOGPATH=%SERVICE_HOME%\logs
> set PR_STDOUTPUT=auto
> set PR_STDERROR=auto
> set PR_LOGLEVEL=Debug
>
> set PR_STARTUP=auto
> set PR_STARTMODE=exe
> set PR_STARTIMAGE=%SERVICE_HOME%\bin\solr.cmd
> set PR_STARTPARAMS=start
>
> @REM Shutdown Configuration
> set PR_STOPMODE=exe
> set PR_STOPIMAGE=%SERVICE_HOME%\bin\solr.cmd
> set PR_STOPPARAMS=stop -p 8983
>
> %PR_INSTALL% //IS/%SERVICE_NAME% ^
>   --Description="Solr-5.1.0" ^
>   --DisplayName="%SERVICE_NAME%" ^
>   --Install="%PR_INSTALL%" ^
>   --Startup="%PR_STARTUP%" ^
>   --LogPath="%PR_LOGPATH%" ^
>   --LogPrefix="%PR_LOGPREFIX%" ^
>   --LogLevel="%PR_LOGLEVEL%" ^
>   --StdOutput="%PR_STDOUTPUT%" ^
>   --StdError="%PR_STDERROR%" ^
>   --StartMode="%PR_STARTMODE%" ^
>   --StartImage="%PR_STARTIMAGE%" ^
>   --StartParams="%PR_STARTPARAMS%" ^
>   --StopMode="%PR_STOPMODE%" ^
>   --StopImage="%PR_STOPIMAGE%" ^
>   --StopParams="%PR_STOPPARAMS%"
>
> if not errorlevel 1 goto installed
> echo Failed to install "%SERVICE_NAME%" service.  Refer to log in
> %PR_LOGPATH%
> exit /B 1
>
> :installed
> echo The Service "%SERVICE_NAME%" has been installed
> exit /B 0
>
> ---------------------------------------------------------------------------------------
> This email has been scanned for email related threats and delivered safely
> by Mimecast.
> For more information please visit http://www.mimecast.com
>
> ---------------------------------------------------------------------------------------
>
>


-- 
Bill Bell
billnbell@gmail.com
cell 720-256-8076