Sitecore – Run SOLR as a Service

Solr is a version which has been derived from Lucene. A brief introduction to Solr is that it makes use of a single server where all indexes are rebuild. If you decide to use Solr with Sitecore, you will need to setup the Solr server.

In this blog post, I will explain the different steps to setup the Solr server and how to run it as a service. The main reason is that, whenever you restart your machine, you need to have Solr to start running in order for your Sitecore instance to work.

So, please follow the below steps in order to install the Solr server.

Step 1

Install Java Runtime Environment if you do not have it. You may check the following link: http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html

Step 2

Add a system environment variable called JAVA_HOME that points to your java installation:

  • Variable Name: JAVA_HOME
  • Variable Value (set as necessary): C:\Program Files (x86)\Java\jre1.8.0_77

Step 3

Install the NSSM. You may download it from its official website at https://nssm.cc/ . Set the directory to “C:/nssm” or the directory of your choice.

Step 4

Create and unzip your Solr Package (http://archive.apache.org/dist/lucene/solr/) into C:/solr

NOTE: Remove any intermediary folders to avoid a folder structure like “C:/solr/solr-5.4.1/server”. This should now be a valid path on your file system: “C:/solr/server”.

Step 5

Open Powershell and use NSSM to set Solr up as a service as follows:

Use either 64 or 32 bit version according to your computer:

cd C:\nssm\win64
./nssm install SOLR

Step 6

The NSSM Service Installer application window will open.  Set the following values:

  • Path: C:\solr\bin\solr.cmd
  • Startup Directory: C:\solr\bin
  • Arguments: start -f -p 8983
  • Display Name: SOLR {solr-version here}
  • Description: C:\solr\bin\solr.cmd start -f -p 8983
  • Startup type: Automatic

Step 7

Open your services and start the newly created Solr {solr-version} service.

Advertisements

2 thoughts on “Sitecore – Run SOLR as a Service

  1. James Harrison says:

    Installed Solr 7.2.1 x64 in windows 10 as a service using Java 9 and nssm.
    I used nssm 2.24-101-g897c7ad 64-bit, 2017-04-26 for ‘Creators update’.

    Note: If you can start Solr from a cmd prompt: ‘$ solr start’ and see it just fine in a browser but are NOT able to start it in services then make sure JAVA_HOME is defined in SYSTEM variables and %JAVA_HOME%\bin is in the Path.

    IMPORTANT: Add %JAVA_HOME% as well so you have…

    %JAVA_HOME%;%JAVA_HOME%\bin in the system path. THIS IS NOT WELL DOCUMENTED, but worked for me.

    If you installed the JDK then you should be seeing results similar to the following.
    $ echo %JAVA_HOME% Returns: C:\Program Files\Java\jdk

    $ java -version Returns:
    java version “9.0.4”
    Java(TM) SE Runtime Environment (build 9.0.4+11)
    Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)

    $ javac -Version Returns: javac 9.0.4

    Like

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 )

Google+ photo

You are commenting using your Google+ 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 )

w

Connecting to %s