About Features Downloads Getting Started Documentation Events Support GitHub

Love VuFind®? Consider becoming a financial supporter. Your support helps build a better VuFind®!

Site Tools


Warning: This page has not been updated in over over a year and may be outdated or deprecated.
administration:starting_and_stopping_solr

This is an old revision of the document!


Starting and Stopping Solr

Once VuFind is installed, it will only respond to search requests if its Solr back-end is active (unless, of course, you are relying on a third-party discovery service instead of a local index, in which case you can disregard this page entirely). This page explains how to turn Solr on and off and how to automate the process if you wish.

Starting Solr Manually

Linux Method

To start Solr under Linux, just switch to the directory where you installed VuFind (i.e. $VUFIND_HOME) and run this command:

  ./solr.sh start

Note: If this doesn't work, make sure that the solr.sh script has execute permissions:

  chmod +x solr.sh

:!: Prior to VuFind 3.0, solr.sh was named vufind.sh; be sure to use the command appropriate for your version.

Note: If you previously rebooted your system without manually stopping Solr, the script may mistakenly believe that it is still running. In this case, a manual restart should solve the problem.

Limit Warnings

Starting with Solr 7.3.1, you may see warnings on startup resembling:

*** [WARN] *** Your open file limit is currently 1024.
 It should be set to 65000 to avoid operational disruption.
 If you no longer wish to see this warning, set SOLR_ULIMIT_CHECKS to false in your profile or solr.in.sh
*** [WARN] ***  Your Max Processes Limit is currently 15058.
 It should be set to 65000 to avoid operational disruption.
 If you no longer wish to see this warning, set SOLR_ULIMIT_CHECKS to false in your profile or solr.in.sh

This is warning of some default settings that could impact the performance of your Solr instance. On some Linux platforms, this can be addressed by editing the /etc/security/limits.conf file and adding these lines:

username         soft    nproc           65000
username         soft    nofile          65000
username         hard    nproc           65000
username         hard    nofile          65000

(where “username” is the name of the user that will be running Solr).

It may be necessary to log out of your terminal session and log back in for these settings to take effect.

On Linux platforms using systemd, you may be able to work around the problem with a systemd file like this example (in a file like /etc/systemd/system/vufind.service):

[Unit]
Description=VuFind Starter
After=network.target

[Service]
Type=forking
ExecStart=/bin/sh -l -c '/usr/local/vufind/solr.sh start' -x
PIDFile=/usr/local/vufind/solr/vendor/bin/solr-8983.pid
User=vufind-user
ExecStop=/bin/sh -l -c "/usr/local/vufind/solr.sh stop" -x
SuccessExitStatus=0
LimitNOFILE=65000
LimitNPROC=65000

[Install]
WantedBy=multi-user.target

(Obviously the /usr/local/vufind path and the vufind-user username should be customized to reflect your local needs).

Once this is in place, you can use “sudo service vufind start” and “sudo service vufind stop” to start and stop the process, and appropriate limits will be applied.

Windows Method

VuFind includes a Windows batch file to run Solr. Just follow these steps:

  • At a command prompt, switch to your VuFind directory.
  • Type: solr start

Note that some of the scripting for this command is created automatically as part of the install.bat setup process. If you did not install VuFind using install.bat, the command may not work. You can re-run the install process to solve the problem.

:!: Prior to VuFind 3.0, solr.bat was named vufind.bat; be sure to use the command appropriate for your version. Prior to VuFind 1.0RC2, Windows support was not included.

Stopping Solr Manually

Linux Method

To take the server offline, switch to the VuFind directory and type:

  ./solr.sh stop

:!: Prior to VuFind 3.0, solr.sh was named vufind.sh; be sure to use the command appropriate for your version.

Windows Method

When using VuFind 3.0 or newer, you can stop Solr from the command line in Windows:

  • At a command prompt, switch to your VuFind directory.
  • Type: solr stop

In VuFind 2.x or earlier, to stop a manually-started Solr instance under Windows, open the command prompt window where the server is running and hit Ctrl-C. This will cause the process to shut down.

Restarting Solr Manually

Linux Method

Restarting Solr under Linux is much the same as starting it. Just switch to the VuFind directory and type:

  ./solr.sh restart

:!: Prior to VuFind 3.0, solr.sh was named vufind.sh; be sure to use the command appropriate for your version.

Windows Method

When using VuFind 3.0 or newer, you can restart Solr from the command line in Windows:

  • At a command prompt, switch to your VuFind directory.
  • Type: solr restart

In VuFind 2.x and earlier, there is no graceful way to restart a manually-started Solr instance under Windows. Just follow the manual “stop” and “start” procedures described above.

Killing an Unresponsive Solr Process

Solr is usually very stable, especially if you restart it regularly. However, it will occasionally crash, especially if it does not have enough memory available (see the performance page for advice on memory tuning). When this happens, you may have to manually kill the crashed process.

Linux Method

First, use the ps command to get a list of running Java processes:

ps aux | grep java

You will see something like this:

dkatz     1326  0.3  4.3 1273128 173932 ?      Sl   08:03   0:03 /usr/lib/jvm/default-java/bin/java -server -Xms1024m -Xmx1024m -XX:+UseParallelGC -XX:NewRatio=5 -Dsolr.solr.home=/usr/local/vufind/solr -Djetty.logs=/usr/local/vufind/solr/jetty/logs -Djetty.home=/usr/local/vufind/solr/jetty -jar /usr/local/vufind/solr/jetty/start.jar /usr/local/vufind/solr/jetty/etc/jetty.xml

The number after your username (“dkatz” in the example above) is the process ID. You can kill the process like this:

sudo kill -9 [process ID number]

If you repeat the ps command, you should no longer see Solr running.

Note that because you didn't stop Solr cleanly, the ./vufind.sh script may be confused the next time you try to start it up, thinking that Solr is already running. In this case, just perform a “./vufind.sh restart” instead of “./vufind.sh start” to get things back to normal.

Windows Method

[I have never experienced a Solr crash under Windows, but I imagine that Windows Task Manager can be used to clear up any problems. Does anyone with experience in this area care to comment? – Demian]

Running Solr Automatically

If you don't want to have to manually start and stop Solr every time you turn on or shut down your server, you can set it up to run automatically.

Linux (systemd) Method

Thanks to jriedl for investigating this issue.

Most modern flavors of Linux (such as CentOS 7 and newer) use systemd instead of the earlier init.d approach. Instructions on the older approach have been moved to a separate init.d page.

To automate Solr with systemd:

  • create the user "solr", because Solr should not be run under the root account for security reasons.
  • add permission for the solr directory to this user if you have not already:
chown -R solr:solr /usr/local/vufind/solr
  • create new file called /etc/systemd/system/vufind.service, with this code:
[Unit]
After=network.target

[Service]
Type=forking
ExecStart=/bin/sh -l -c '/usr/local/vufind/solr.sh start' -x
PIDFile=/usr/local/vufind/solr/vendor/bin/solr-8983.pid
User=solr
ExecStop=/bin/sh -l -c "/usr/local/vufind/solr.sh stop" -x
SuccessExitStatus=0

[Install]
WantedBy=multi-user.target

The above example should work for VuFind 7.0 and later using the official VuFind deb package (this has been tested on Ubuntu). For compatibility with VuFind 3.0 through 6.0, simply change “solr-8983.pid” to “solr-8080.pid” to reflect a different default Solr port number. For older versions of VuFind, a different script is needed; click the “Old revisions” link below to find historical documentation.

Be sure to adjust paths in the code above to match your local system.

You can run

systemctl enable vufind

to automate the start-up of Solr on boot.

Interacting with Solr After Automation

Once configured with systemd, Solr can be managed using the systemctl command.

systemctl [enable, start, stop, status] vufind

Alternatively, you could investigate using the automation tools bundled with Solr 5+.

Windows Method

As of VuFind 3.0, Solr can be started as a background process from the command line, so it should be possible manage it from within Windows; however, detailed instructions and best practices have not been developed as of this writing. Please feel free to contribute your own recommendations!

Taking the User Interface Offline

If you simply stop the Solr server, users attempting to access your VuFind site will encounter error messages. If you are planning an outage, you can take the site more gracefully offline by adjusting the “available” setting in the “[System]” section of your config.ini file.

administration/starting_and_stopping_solr.1678449426.txt.gz · Last modified: 2023/03/10 11:57 by demiankatz