Install Apache Solr as Windows Service using NSSM
Today I wanted to install Apache Solr index in Windows 7, Windows Server 2008R2 and Windows Server 2012 machines. So I achieved that , using the following steps:
- Download Apache Solr
- Download NSSM - the Non-Sucking Service Manager
- Create a .bat init file for Solr
- Create Windows service using NSSM
- Test Solr service
In detail:
1. Download Apache Solr
Download Apache Solr .zip file from Apache Solr website. I am currently using version 4.6.0.
2. Download NSSM - the Non-Sucking Service Manager
After a lot of searching for a stable solution in creating Windows services I stumbled upon NSSM - the Non-Sucking Service Manager. Download it and place the nssm.exe executable in a directory that can be seen by $PATH.
3. Create a .bat init file for Solr
-
Unzip Apache Solr zip file to
C:\Program Files\apache-solr-4.6.0\
-
Create
C:\Program Files\apache-solr-4.6.0\example\solrstart.bat
file containing the following:@echo off cd "C:\Program Files\apache-solr-4.6.0\example\" java -Xms64M -Xmx256M -Djava.util.logging.config.file=etc/logging.properties -jar start.jar
4. Create Windows service using NSSM
- Open a command line prompt (WinKey + R and type “cmd”) and type the following
nssm install Solr4.6.0 "C:\Program Files\apache-solr-4.6.0\example\solrstart.bat"
If the procedure succeeds you should see a message like this:Service “Solr4.6.0” installed successfully!
- If you want to uninstall the service open again a command line prompt and type the following:
nssm remove Solr4.6.0 confirm
If the procedure succeeds you should see a message like this: Service “Solr4.6.0” removed successfully!
5. Test Solr service
- Open a command line prompt (WinKey + R and type “cmd”) and type the following
net start Solr4.6.0
- If the service was started successfully, open a web browser and access admin page: http://localhost:8983
That is all about it folks! May the Solr be with you!
Comments