NetX relies on Apache Solr to provide robust search capability. Starting in version 10, NetX requires the use of Solr 8. 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
- If installing on Red Hat, please make sure lsof is installed before running the Solr installation script (sudo yum install lsof).
- Below is a basic tutorial on how to install Solr 8 on Linux. For additional Solr installation and configuration options, see https://solr.apache.org/guide/8_0/taking-solr-to-production.html.
Installing Solr 8
- 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, follow the steps in the Upgrading NetX section of Upgrading NetX on Linux first, then return to this tutorial.
- Download the Solr installation package here: https://www.apache.org/dyn/closer.lua/lucene/solr/8.11.1/solr-8.11.1.tgz?action=download
Extract the install_solr_service.sh script from the archive into the current directory:
tar xzf solr-8.10.1.tgz solr-8.10.1/bin/install_solr_service.sh --strip-components=2
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-8.10.1.tgz -n
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/8/netx /var/solr/data
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 1819 running on port 8983
"version":"8.10.1 2f24e6a49d48a032df1f12e146612f59141727a9 - mayyasharipova - 2021-10-12 15:19:17",
"uptime":"2 days, 14 hours, 38 minutes, 47 seconds",
"memory":"349.8 MB (%68.3) of 512 MB"}
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.
- Click Core Admin to make sure Solr is able to load the NetX core.
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:
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.
- Remove the Solr WAR file. By default, this is located in /opt/netx/webapps/solr.war.
- If there is an unpacked WAR, remove /opt/netx/webapps/solr as well.
- Remove the configuration descriptor: /opt/netx/conf/Catalina/localhost/solr.xml
- 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.
Now that Solr 8 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
Verifying the upgrade
After initial startup after the upgrade to NetX 10, log in to the site and verify that assets and data appear correctly and that search is functioning properly. If you encounter issues, you may need to launch a manual reindex of your site. 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 reindex is complete.