The following description is based on a recent client experience where I installed and configured Lucidworks Fusion in a 3 virtual server farm, in a very Microsoft dependent environment. My client required that each piece of software run as a self-sufficient Windows Service, which can start itself automatically upon server restart.
Software
Use | Software |
---|---|
Operating System | Windows Server R2 |
Solr | 5.2.1 |
Zookeeper | 3.5.1 |
Lucidworks Fusion | 2.1.1 |
Java | jdk-7u79-windows-x64 |
Windows Services | https://nssm.cc/ |
Important | NSSM does NOT work with JDK 8 |
Install Windows Services script
Next to the nssm.exe executable, create this installWindowsServices.bat file.
NOTE: Obviously change the paths to the paths you installed on.
echo --------------------------------------------------------
echo - Install Windows Service : ApacheZookeeper
echo --------------------------------------------------------
nssm.exe install ApacheZookeeper Application D:\apache\zookeeper351\bin\run.bat
nssm.exe set ApacheZookeeper Application D:\apache\zookeeper351\bin\run.bat
nssm.exe set ApacheZookeeper AppDirectory D:\apache\zookeeper351\bin
nssm.exe set ApacheZookeeper DisplayName Apache Zookeeper
nssm.exe set ApacheZookeeper Description Apache Zookeeper 3.5.1
nssm.exe set ApacheZookeeper Start SERVICE_AUTO_START
nssm.exe set ApacheZookeeper AppRestartDelay 0
echo -------------------------------------------------
echo - Install Windows Service : ApacheSolr
echo -------------------------------------------------
nssm.exe install ApacheSolr Application D:\apache\solr521\bin\run.bat
nssm.exe set ApacheSolr Application D:\apache\solr521\bin\run.bat
nssm.exe set ApacheSolr AppDirectory D:\apache\solr521\bin
nssm.exe set ApacheSolr DisplayName Apache Solr
nssm.exe set ApacheSolr Description Apache Solr 5.2.1
nssm.exe set ApacheSolr Start SERVICE_AUTO_START
nssm.exe set ApacheSolr DependOnService ApacheZookeeper
nssm.exe set ApacheSolr AppRestartDelay 15
echo -----------------------------------------------
echo - Install Windows Service : LWFusion
echo -----------------------------------------------
nssm.exe install LWFusion Application D:\Lucidworks\fusion211\bin\run.bat
nssm.exe set LWFusion Application D:\Lucidworks\fusion211\bin\run.bat
nssm.exe set LWFusion AppDirectory D:\Lucidworks\fusion211\bin
nssm.exe set LWFusion DisplayName Lucidworks Fusion
nssm.exe set LWFusion Description Lucidworks Fusion version 2.1.1
nssm.exe set LWFusion Start SERVICE_AUTO_START
nssm.exe set LWFusion DependOnService ApacheSolr
nssm.exe set LWFusion AppRestartDelay 59
echo Done
In CMD prompt, execute installWindowsServices.bat
ERRORS in the Windows Service? - Remove them
Create a removeServices.bat file.
nssm.exe remove ApacheSolr nssm.exe remove ApacheZookeeper nssm.exe remove LWFusion
Very Important!
Windows services need to be assigned an account to log into, lest they stop working when you log out. So open the Windows services at this point, click into each one, and in the "Log On" tab, assign an admin level account that you created for the purpose of running these services.
Comments