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
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
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
Issue Command: nssm install SOLRCLIENT1
This command will invoke a prompt asking you to fill the details of the service
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.
Click on Install Service and the SOLR service should be installed
Start the newly created service
Using the net start command, let us start the solr service
Browser Test to see if SOLR is running
Navigate to http://localhost:8983/solr/
Navigate to the bin directory of your Solr directory and issue command : Solr Status
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)
Screenshot showing two solr instances running on different ports
You can also take a look into the local services to see the listed solr services there
I hope this posts helps you install solr seamlessly !!!
If case of questions/feedback, Please tweet me @sjain_hi