contact us.
call us.
join us.
call us.
join us.
win with us.
We exist to make your business thrive and our greatest reward is our returning clients. Our focus is and always will be on our clients and not on industry awards and accreditations, which could account for why we’ve won so many of them…
Sitecore Development with Multiple Solr Instances .

Sagittarius
If you are a Sitecore developer working mostly on local machine, one of the things you are likely to face is more than one Sitecore instance using Solr. Particularly start with Sitecore 9, you need to move away from the Lucence index provider and use Solr as default.
One option you have is to use the same Solr server for multiple Sitecore instances, which requires you to set up prefix for Solr cores. Then in each solution to apply patch config per Solr core. There is script for this on github.
This blog post will talk about the other option – to have multiple Solr instances in one machine.
Your Sitecore instances might need different versions of Solr, or in my case, they are compatible with the same version of Solr.
But in any cases, the first thing you need is a common JRE with all your Solr instances. Once Java is installed, also double check your JAVA_HOME variable is set.
Then download the right version of Solr zip, in my case, I have Solr 6.6.2. Unzip the content into a directory of your choice.
Because we want to have multiple instances of Solr, so what I do is create folders inside the Solr directory.

Sagittarius
Then copy everything inside each folder. Each of the folder should look like this:

Sagittarius
To use Solr, I use NSSM to install Solr as a windows service. You can also use Bitnami Apache but I personally found NSSM a very handy tool. Use it in command prompt with the command.
nssm install [serviceName]

Sagittarius
It brings up the window below. Set the path to the solr.cmd inside the target instance bin folder. And Startup directory to the bin folder. Use the following command in Arguments field.
start -f -p [port number]
this is your first instance, start with port number 8983. Then increase the number by 1 for the next instance. So each of the Solr instance can run in a different port.

Sagittarius
The next tab – ‘Details’ is where we can fill out descriptive name and description of the service. It is not compulsory for creating the service but it is a good practice to fill out to maintain clean and clear windows service. Click on ‘Install service’ after everything has filled out. It should tell you the service installed successfully.
Do the same for the rest of the instances but point to correct path and directory and make sure to use a different port number.
Verify the services from Windows Service Manager

Sagittarius
Then open the browser and make sure each instance is up and running.

Sagittarius
The last step is to point Sitecore instances to the correct Solr instances. With recommend practice this should be done in a patch config file.

Sagittarius
So now we have multiple Solr instances in a single machine, one pre Sitecore instance so we can turn on and off individually without interfere with each other.
The above steps can easily apply if you need different versions of Solr as well.
Hope this is useful :)
Get in touch today to see how we can provide your business with Experiences That Convert.
