[ 
https://issues.apache.org/jira/browse/SOLR-7105?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15703621#comment-15703621
 ] 

Alex Crome commented on SOLR-7105:
----------------------------------

Unfortunately you can't run any old executable as a windows service - it needs 
to understand how to communicate with the Service Control Manager.  Thus some 
wrapper (nssm or commons daemon wrappers) is required.

I have a script that does a basic install of solr at 
https://gist.github.com/afscrome/e6c4f3c8e9ca89e9882b1b77fde1e2c0 which should 
be a good starting point.  Specifically it:
* Sets up solr as a windows service (through nssm)
* Work around an issue with nssm being unable to gracefully stop solr (due to 
windows stupidity)
* Avoid double logging in both nssm logs & solr logs
* Set up solr with least required privileges (Service specific virtual account 
+ minimal permissions).  (Needs more work as {{solr.cmd}} doesn't support 
everything to provide a clean split between app files & data files, like the 
opt/var split supported in the bash scripts)
* Work around for SOLR-9760 when running with minimal permissions
* Some diagnostics to make troubleshooting service installation failures 
easier.  (Specifically determining whether to look at nssm, solr or windows 
event logs to troubleshoot further).

Work needed
* Probably needs to allow for more configuration options (solr home, log 
directory etc.) Check what the linux script supports)
* Should probably add a {{NoStartService}} option that installs the service, 
but doesn't start it after.
* Any problems with using nssm over Commons Dameon? I'm not familiar with the 
latter.

This script supports Win 8 / Server 2012 +.  Win 7 and Server 2008 R2 will 
work, but will require powershell 3 or higher to be installed.  Might be able 
to support older versions of powershell, but would need more investigation. 

> Running Solr as a windows service
> ---------------------------------
>
>                 Key: SOLR-7105
>                 URL: https://issues.apache.org/jira/browse/SOLR-7105
>             Project: Solr
>          Issue Type: Improvement
>            Reporter: Varun Thacker
>             Fix For: 6.0
>
>
> Since we moved away from shipping a war, it's useful to have scripts to start 
> Solr as a service.
> In 5.0 we already added a script for unix systems, we should also add one for 
> windows.
> The Commons Daemon project seems like a good way to implement it - 
> http://commons.apache.org/proper/commons-daemon/procrun.html



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to