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:

  1. Download Apache Solr
  2. Download NSSM – the Non-Sucking Service Manager
  3. Create a .bat init file for Solr
  4. Create Windows service using NSSM
  5. 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

    1. Unzip Apache Solr zip file to
      C:\Program Files\apache-solr-4.6.0\
    2. 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

    1. 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!

    2. 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

    1. Open a command line prompt (WinKey + R and type “cmd”) and type the following

      			net start Solr4.6.0
      			
    2. 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!

Advertisements

About cmanios

programming
This entry was posted in Apache, Solr, Windows and tagged , , , , , , , , . Bookmark the permalink.

2 Responses to Install Apache Solr as Windows Service using NSSM

  1. Mark says:

    nice post!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s