When I was trying to get Solr installed for my Sitecore 9 installation, I struggled to get it installed as Windows Service, but finally got it working. Here is what how I did it
Enabling SSL for your solr installation
First create self-signed certificate using keytool as shown below (I am executing this in the current path of C:\solr-6.2.1\server\etckeytool -genkeypair -alias solr-ssl -keyalg RSA -keysize 2048 -keypass <yoursecretpwd>-storepass <yourstorepwd> -validity 9999 -keystore solr-ssl.keystore.jks -ext SAN=DNS:localhost,IP:127.0.0.1 -dname "CN=localhost, OU=Organizational Unit, O=Organization, L=Location, ST=State, C=Country" keytool -importkeystore -srckeystore solr-ssl.keystore.jks -destkeystore solr-ssl.keystore.p12 -srcstoretype jks -deststoretype pkcs12
Now install certificate in the trusted authority store as shown below
Double-click the generated .p12 - for example, C:\Solr-6.2.1\server\etc\solr-ssl.keystore.p12 - and go through the wizard, selecting the following:
- Store Location: Local Machine
- File name: [NO CHANGE]
- Password: secret (or the value of -keypass used in your own environment)
- Certificate store: Trusted Root Certificate Authorities
- Post that make sure your solr properties in solr.in.cmd (file is in the bin directory) is configured correctly to enable SSL. In my case this is how it looked like
set SOLR_SSL_KEY_STORE=C:\solr-6.2.1\server/etc/solr-ssl.keystore.jks
set SOLR_SSL_KEY_STORE_PASSWORD=<your ssl key store pwd>
set SOLR_SSL_TRUST_STORE=C:\solr-6.2.1\server/etc/solr-ssl.keystore.jks
set SOLR_SSL_TRUST_STORE_PASSWORD=<your ssl trust store password>
set SOLR_SSL_NEED_CLIENT_AUTH=false
set SOLR_SSL_WANT_CLIENT_AUTH=false
Usually I keep key store and trust store passwords the same
Running Solr as Windows Service
Your typical sc create command times out and does not result in successful start of the service (here is the command I used)sc create Solr621 binPath="C:\Solr 6.2.1\bin\start.cmd start -f" DisplayName= "Solr 6.2.1" start= "auto" sc start Solr621
After digging a bit, came across nssm (the non-sucking service manager :)) and downloaded the latest version
http://www.nssm.cc/download
Once you install nssm (I used 2.24 version), open command prompt in administrative mode and execute this command
nssm install Solr621
Notes:
- After unzipping nssm I added nssm path into PATH environment variable
- The name Solr621 above can be any name you want to give your service
A window will open where you can mention the attributes as shown in the snapshot below
In the first screen above, set the path pointing to solr.cmd and startup directory as your solr installation bin directory.
Notice the arguments set to start solr service in foreground (start -f)
In the Details tab, enter the display name and description as you wish, with startup type as Automatic so that the service starts automatically when you restart your machine.
Note that this installation procedure is ideal for local machine installation. For production deployments refer to solr documentation
Happy Searching !!
No comments:
Post a Comment