Upgrading to Solr 7 on Linux

NetX relies on Apache Solr to provide robust search capability. Starting in version 9, NetX requires the use of Solr 7 and no longer bundles Solr with the NetX upgrade packs. System administrators need to install and maintain a separate instance of Solr during the upgrade of the NetX platform to version 9. This guide provides instructions on the steps necessary to install the new version of Solr and remove the legacy Solr files from an existing NetX installation.

Before you begin

Installing Solr 7

  1. This tutorial assumes that you have already upgraded your existing NetX application files and the NetX service has been stopped. If you have not done so, see Upgrading NetX on Linux. If you have not done so, follow the steps in the Upgrading NetX section of Upgrading NetX on Linux first, then return to this tutorial.
  2. Download the Solr installation package from http://archive.apache.org/dist/lucene/solr/7.7.2/solr-7.7.2.tgz
  3. Extract the install_solr_service.sh script from the archive into the current directory:

    tar xzf solr-7.7.2.tgz solr-7.7.2/bin/install_solr_service.sh --strip-components=2
  4. Run the Solr installation script as root. By default, this script extracts the distribution archive into /opt, configures Solr to write files into /var/solr, and runs Solr as the solr user. You can customize the service name, installation directories, port, and owner using options passed to the installation script; to see available options, do sudo bash ./install_solr_service.sh -help. In the example below, we are running the install, but using the -n option so that the Solr service doesn't start after installation is complete.

    sudo bash ./install_solr_service.sh solr-7.7.2.tgz -n
  5. Copy the Solr core from the upgraded NetX application folder into the Solr installation directory. In the example below, the solr user has read access to the /opt/netx/solr-cores/7/netx/ directory.

    sudo -u solr cp -a /opt/netx/solr-cores/7/netx /var/solr/data
  6. The installation script creates a very basic init.d script so that you can control Solr using the service tool. Use the following commands to start the Solr service and report on its status:

    service solr start
    service solr status

    The status command should give some basic information about the running Solr node that looks like this:

    
          Solr process PID running on port 8983
    {
      "version":"5.0.0 - ubuntu - 2014-12-17 19:36:58",
      "startTime":"2014-12-19T19:25:46.853Z",
      "uptime":"0 days, 0 hours, 0 minutes, 8 seconds",
      "memory":"85.4 MB (%17.4) of 490.7 MB"}
  7. Now that Solr has successfully started, You should be able to log into the Solr admin console using the port number shown when you start the engine. Open a web browser and type http://<hostname>:8983/solr/ where <hostname> is the name of the server you installed Solr on in the steps above.

  8. Click Core Admin to make sure Solr is able to load the NetX core.

  9. To inform the NetX application where to find the new Solr installation, edit the exogen-config.xml file and correct the value for the property below:

    Property Description
    searchEngine.solrUrl

    This value tells NetX where to locate the NetX service.

    Value options: http://127.0.0.1:8983/solr/netx

    Requires restart? Yes

     

Solr memory settings

By default, the bin/solr script sets the maximum Java heap size to 512M (-Xmx512m). For production, you’ll want to increase the maximum heap size; we recommend starting with at least 2 GB. To do this, open the /etc/default/solr.in.sh file and edit the SOLR_JAVA_MEM variable as such:

SOLR_JAVA_MEM="-Xms512m -Xmx2048m"

Remember to restart the Solr service after changing memory settings:

solr service restart

 

Removing old Solr files

Now that you have a separate instance of Solr, you can safely remove the old Solr application files that were bundled with the NetX installation.

  1. Remove the Solr WAR file. By default, this is located in /opt/netx/webapps/solr.war.
  2. If there is an unpacked WAR, remove /opt/netx/webapps/solr as well.
  3. Remove the configuration descriptor: /opt/netx/conf/Catalina/localhost/solr.xml
  4. Back up the old index data, found here: /opt/netx/solr/netx/data. After the data has been backed up, you can delete the /opt/netx/solr directory.

Starting NetX

Now that Solr 7 has been installed and started, you can start the NetX service. In the example below, the Tomcat log is tailed so that you can see when the application has been started.

sudo /opt/netx/bin/startup.sh; tail -f /opt/netx/logs/catalina.out

Rebuilding the Solr index

On initial startup after the upgrade to NetX 9. NetX will attempt to build a new Solr index from scratch, since the old index is no longer valid with the new Solr version. This could take a while to complete depending on the size of your installation (number of assets and/or attributes) so you may experience missing assets or other data inconsistencies until the index is complete. If you run into issues, you may want to launch a manual reindex of your site.

Was this article helpful?
0 out of 0 found this helpful