Install multiple instances of SOLR for Sitecore on a single server

Greetings Readers,

Firstly, What is the use case of installing multiple instanced of SOLR on the same server ?
Use Case 1 : If you are developer working on multiple clients, you will need multiple instances of SOLR for each client
Use Case 2 : For clients, we can use a single physical box to house solr instances for various environments such as “Dev, Stage and QA”. This gives us in reducing costs and performance benefits on a dedicated SOLR physical server.

This post outlines the steps needed to run multiple instances of SOLR for Sitecore on a single server.Sitecore community bloggers have excellent posts on how to install SOLR and make it work with sitecore, so I will not repeat the steps to make SOLR work with Sitecore.

This post is specifically targeted for Solr 5.0.0 and above.  Up to version 5.0.0, it was possible to run Solr inside the Java web application container of your choice. However, since the release of version 5.0.0, the Solr team at Apache no longer releases the solr.war file. This file was necessary to run Solr from a different web application container such as Tomcat. Starting with version 5.0.0, Solr will be distributed only as a self-contained web application, using an embedded version of Jetty as a container.if you looking to run multiple instances of SOLR for versions before 5.0, Our friends have already done that here.

Things you will need to get started

  • SOLR 5.3.0 (You can also download earlier versions also starting 5.0.0)
  • NSSM (Light Weight Service Manager utility to create windows service)
  • Java 7 or Higher (If you already have java installed, ensure that your JAVA_HOME variable is set)

Create SOLR Directory

Let us start by creating Directories for the SOLR install

Create a directory which will house all the Solr files: C:/SOLR/Client1

Extract all the content of the SOLR Zip into the above created folder, the contents would look like this

Folder1

Create Service Manager Directory

The service manager application allows you create windows service using a GUI. Unzip the contents of the above NSSM downloads into a folder of your choice, I did it here C: /SOLR/NSSM

Folder

Install Solr and Start as Windows Service

Before we proceed, please ensure you have all of the below figured out

1.) Name of the Solr Service (for example : SOLRCLIENT1)
2.) Port of the Service (For example : 8983)

Open command prompt as admin and navigate to the service manager directory

nssm1

Issue Command: nssm install SOLRCLIENT1

This command will invoke a prompt asking you to fill the details of the service

nssm2

Fill out the path to the solr.cmd script, and the startup directory should be filled in automatically. Don’t forget to input the -f (foreground) parameter so that ServiceManager can kill it when it needs to be stopped or restarted.

Also the –p (Port) parameter allows you run solr on a specific port (This is very critical step because by changing the ports you can allow solr to run to different ports)

The following step is optional, but enables a clean and descriptive name in my Windows Service Manager. Under the details tab, fill out the Display name and Description.

nssm3

Click on Install Service and the SOLR service should be installed

nssm4

Start the newly created service

Using the net start command, let us start the solr service

cl1

Browser Test to see if  SOLR is running

Navigate to http://localhost:8983/solr/

browser
Command Line Test for SOLR Status

Navigate to the bin directory of your Solr directory and issue command : Solr Status

solr

How to install another solr instance on the same server

You will have to follow the below steps in order to set up another solr instance on the same server

  • Unzip the contents on the SOLR files on a new folder say “c:/solr/client2”
  • Run the same steps as outlined above (create a service, start the service and test the service)
  • Ensure when you are creating a new service to select a different port

I have attached a couple of screenshots outlined below

Installing solr service for client 2 (See the Path and Arguments)

solr2

Screenshot showing two solr instances running on different ports

solr3

You can also take a look into the local services to see the listed solr services there

services

I hope this posts helps you install solr seamlessly !!!

If case of questions/feedback, Please tweet me @sjain_hi

3 thoughts on “Install multiple instances of SOLR for Sitecore on a single server

Add yours

  1. Why do this? What is the use case? Have you worked out how to connect Sitecore tomorr than one SOLR because that is something I’m very interested in. AFAIK, as at 8.1 the base URI for SOLR is a single setting value, making it impossible to connect to 2 at once. Have you worked out how to do that?

    1. Hello Richard,

      I have updated the post with the use cases, Yes you are correct we cannot connect multiple instances of SOLR to a single sitecore solution.

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

Blog at WordPress.com.

Up ↑

%d bloggers like this: