Sitecore Move Solr from one Server to Another

Sitecore and Solr work together to make search functions work on your Sitecore website. Sometimes, you will need to move Solr to a new server. This can be because of a number of reasons like new hardware, better performance, or changes in your setup. In this blog post, I will walk you through each step of moving Solr to a new server step by step.

Before we start, please make sure the new server meets all requirements for running Solr. It should have enough memory, CPU, and storage.

Step 1: Locate and Copy Solr folder to Destination Server

  1. Locate the Solr folder, you can do it by checking Solr service properties. To check Solr services, type services.msc in Windows Run and find a service named Solr. Check its properties.
  2. If you cannot find the path from Solr Service Properties, consider checking C Drive as it is usually located in C drive
  3. Copy the Solr folder to another folder. If you get an error while copying, you can stop Solr service, copy it and start the Solr service again.
  4. Zip the folder which makes it easer and faster to copy over network.
  5. Copy the folder to destination server, you can simply copy paste if you are using Remote Desktop Connection.
  6. On the destination server extract the copied zip file and move it to the same path as it was on source server.

Step 2: Test if Solr works on destination machine and fix Java Path if needed

  1. First we will try to test if Solr works before setting it up as a Windows service.
  2. Open CMD as administrator and run this command C:\solr\solr-8.1.1\bin>.\solr start -p 8989
  3. If you do not see any error, you can open this in browser http://localhost:8989/solr
  4. If you get this error “ERROR: java.exe not found in C:\Program Files\Java\jre1.8.0_171\bin Please set JAVA_HOME to a valid JRE / JDK directory.” screenshot below
  5. Check if destination server have Java installed, if not you can copy Java folder from the source server same way as we copied Solr folder. In this example, Copy C:\Program Files\Java\jre1.8.0_361 folder to new server
  6. Next we will need to add System Environment Variable. For this go to
    This PC -> Properties -> Advanced system settings -> Environment Variables
  7. Either create a new variable called JAVA_HOME or update if it already exists with a different value to
    C:\Program Files\Java\jre1.8.0_171
  8. Once this is setup, run the command in point # 2 above and test it Solr works in browser
  9. Once tested make sure to stop it to free up the port before moving to the next step by running .\solr stop -p 8989
  10. Screenshots below

Step 3: Setup Solr as a Windows Service and setup SSL for Solr

We will use NSSM – the Non-Sucking Service Manager to setup Solr as Windows service

  1. Download zip file of NSSM from https://nssm.cc/download and extract it to C:\solr\nssm
  2. Open CMD as Administrator and run this command C:\solr\nssm\win64>nssm install solr_811
  3. This will open the NSSM UI dialog which can be used to setup service parameters. Please fill them as follows, also shown in the screenshot
    C:\solr\solr-8.1.1\bin\solr.cmd
    C:\solr\solr-8.1.1\bin\
    start -f -p 8985
    solr_811
  4. Click “Install Service” and this will create a Windows service for Solr.
  5. Go to services, type services.msc in Windows Run and find a service named Solr, right click on it and click Start
  6. Once the service started successfully, open this in browser http://localhost:8989/solr

You have successfully setup Solr as a service on the new server, the last step is to run it with https. For this you can do it in two ways

Make sure you stop the Solr service before trying these options.

  1. Export certificate from old server and install it in new server
  2. Create a new certificate, keeping the same name

Option 1: Copy certificate from old server

  1. In the old server, open Solr in the browser e.g. http://localhost:8989/solr and check the certificate name
  2. Type MMC.exe in Windows Run
  3. In the opened Window Click File -> Add/Remove Snap-in.. -> Certificates -> Computer Account -> Local Computer -> Finish -> OK
  4. Navigate to Certificates -> Trusted Root Certification Authority -> Certificates
  5. Find the Certificate with same name you found in point # 1
  6. Right click, All Tasks -> Export and save the file
  7. Go to the new server and you can import this file the same way by going to Certificates -> Trusted Root Certification Authority -> Certificates Right Click and Import

Create a new certificate, keeping the same name

Option 2: Create a new certificate, keeping the same name

You can also generate a new SSL Certificate

  1. Copy script from https://gist.githubusercontent.com/kamsar/c3c8322c1ec40eac64c7dd546e5124de/raw/01374d52253abb090d7f0195b8680c8396558f66/solrssl.ps1
  2. Change “keytool.exe” to full path e.g. ‘C:\Program Files\Java\jre1.8.0_361\bin\keytool.exe’ on line 37
  3. Save this in C:\solr directory
  4. Go to C:\solr\solr-8.1.1\server\etc and check the names of .jks and .p12 files. Same name should be used in command below
  5. Open Powershell as administrator and run .\solrssl.ps1 -KeystoreFile C:\solr\solr-8.1.1\server\etc\solr-ssl-keystore.jks

Finally start the Solr Windows service and change connection string in your Sitecore’s config file if needed.

Keywords: Sitecore, Solr, Solr migration, move Solr server, Sitecore Solr integration, Solr setup, Solr configuration, Windows service setup, Java environment variable, NSSM, SSL for Solr, Solr installation, Solr Windows service, Java path configuration, Solr certificate setup, Solr service management, Solr environment setup

Hashtags: #Sitecore #Solr #SolrMigration #SitecoreIntegration #SolrSetup #WindowsService #JavaConfiguration #NSSM #SSLforSolr #TechGuide #ServerMigration #SearchEngine #TechTutorial #SitecoreDevelopment #JavaPath #CertificateSetup #ServiceManagement