Solr Server Configuration Changes With Spring Boot 1.4

We recently upgraded NixMash Spring from Spring Boot 1.3.5 to 1.4. You can enjoy the play-by-play in this NixMash post. Spring Boot 1.3 used Solr 4.x where Spring Boot 1.4.0.RELEASE uses Solr 5.5.2 as a baseline. Time to upgrade Solr!

We covered Solr Setup and Configuration in a number of posts like in this one from 2014 titled Solr and Tomcat. With Solr 5.5.2, using Tomcat is no longer an option. As stated pretty clearly on the Apache Solr Guide “Running Solr on Tomcat:”

No Longer Supported

Beginning with Solr 5.0, Support for deploying Solr as a WAR in servlet containers like Tomcat is no longer supported. For information on how to install Solr as a standalone server, please see Installing Solr.

There's an interesting piece titled “Why No War” on the Solr Wiki if you want to know more. As that piece says, “Solr is intended to be a server, not a Java web application.” (Emphasis theirs.)

With that, here are the changes in our Solr Setup for 5.5.2:

  1. Using Jetty instead of Tomcat
  2. Using Apache2 with Proxy_Mod as before, but now to the Jetty Solr instance
  3. Using Solr Server binaries for Standalone Deployment, with Collections moved to under the Server directory
  4. Using Solr Embedded as before, but in a new location with updated Collections and Schema.xmls

Jetty Wins The Day

Tomcat rocks, but Jetty is just as awesome. Not a problem getting deeper into Jetty. Rather than packaging our Solr Webapp and Collections as we did before with Tomcat we simply fire up Solr Standalone Server with

/solr-5.5.2 $ bin/solr start

Bam!

As you can see in our Solr Admin Java Properties page, Jetty is now performing the Web Server Duties.

Apache2 Solr.conf Changes

We continue to use Apache2 and the Apache Proxy Mod, but now we point to the Jetty Instance we just launched at localhost:8983, Solr Server's default port. (More on using proxy_httpd in this NixMash Post.) Here's the updated Apache /sites-available/Solr.conf file. It's important to note that we're performing the proxy on the :8983/solr subdirectory, since that is the Solr Server root directory as configured by default in the Solr Jetty configuration files.

Using Solr Server Binaries With Collections Under Solr 5.x Server Directory

We're using a cleaner approach to Solr Standalone now, I think, using the Solr Server Binaries and with our Collections located in the /server/solr directory just the way Solr 5.x likes it. We can change that configuration, of course, but it's easy and it works.

Our Solr-5.5.2 Standalone contents consist of only two of the several directories included in the Solr 5.x distribution: /server and /bin. It is those two directories that we copy to the cloud server for use by our applications.

Below: 1) Our Solr Administration Webapp files, 2) the location of the two Solr Collections currently in use on the server, NixMash Spring and NixMashup Links. 3) The Solr /bin folder used to startup the Solr Server.

Embedded Solr Changes

As for Solr Embedded, we continue to use it as before after adding a new /solr-5.5.2 directory and updating several Spring-related configuration and support files, all of which you'll find in the /install/solr folder and elsewhere in the GitHub Repository. Specifically:

  1. You'll find an updated schema.xml to support the 5.x Core data
  2. The NixMash Spring Solr Refresh bash script has been updated for Solr 5.
  3. Your external solr.properties file will need to be updated to reflect the new Solr 5 Embedded location (Solr Standalone Server http://location should remain the same.)

Source Code Notes for this Post

All source code discussed in this post can be found in my NixMash Spring GitHub repo and viewed online here.

Posted September 10, 2016 11:59 AM EDT

More Like This Post