About Features Downloads Getting Started Documentation Events Support GitHub

Site Tools


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.

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 (init.d) Method

You can set up Solr to run as a daemon. To do so, create a wrapper script in /etc/init.d/vufind:

:!: Important: These instructions were written for VuFind 3.0 or later, when the Solr script was changed to solr.sh instead of vufind.sh; if running VuFind 2.x or earlier, you should replace “solr.sh” with “vufind.sh” in these examples.

:!: If you need to run VuFind with non-default settings, you may wish to add some lines to export environment variables in this script, or else source a script containing all of your environment settings prior to running “solr.sh”.

# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: VuFind init script
cd /usr/local/vufind
./solr.sh $*

Note: The information in the INIT INFO block is only required for RedHat-style systems that use the chkconfig utility. You may need to adjust the start and stop runlevels depending on your system configuration.

Note: If your VuFind instance is installed somewhere other than /usr/local/vufind, be sure to adjust the cd line in the script accordingly.

Make sure that the script is executable (sudo may be needed on the command for some platforms):

chmod +x /etc/init.d/vufind

You will then need to add the script to your runlevel configuration (generally found under /etc/rc.d). The exact setup varies from flavor to flavor of Linux, but a bit of online research should help, as should these tools:

On RedHat (including Fedora): chkconfig --add vufind
On Debian (including Ubuntu): update-rc.d vufind defaults       

If this doesn't seem to work, be sure that VUFIND_HOME and JAVA_HOME are set in the profile of the user running the startup script.

Interacting with Solr After Automation

On some platforms, the “service” command is available to make use of startup scripts. In this case, you will be able to use it for Solr after completing configuration:

service vufind start
service vufind stop
service vufind restart
service vufind check

(“sudo” may need to be prefixed to these commands depending on your Linux flavor and security configuration)

If service is available, it is the preferred way of starting and stopping Solr after automation.

Linux (systemd) Method

Thanks to jriedl for investigating this issue.

Some newer flavors of Linux (such as CentOS 7) use systemd instead of the traditional init.d approach.

To automate Solr with systemd:

  • create the user “solr”, because Solr should not be run under root user.
  • add permission for the solr directory to this user:
chown -R solr:solr /usr/local/vufind/solr
  • create new file called /etc/systemd/system/vufind.service, with this code:

In VuFind 2.x, the contents of the file should be as follows:

Description=VuFind Starter
After=network.target httpd.service mariadb.service

ExecStart=/bin/sh --login -c '/usr/local/vufind2/vufind.sh start'
ExecStop=/bin/sh --login -c "/usr/local/vufind2/vufind.sh stop"

# Java responds to a SIGTERM by returning with exit code 143 which leads to "failed" exit in the systemd-Logs


In VuFind 3.0 and later, the contents of the file should be as follows. It will work with the official VuFind 3 deb package (tested on Ubuntu 16.04).

After=network.target httpd.service mariadb.service

ExecStart=/bin/sh -l -c '/usr/local/vufind/solr.sh start' -x
ExecStop=/bin/sh -l -c "/usr/local/vufind/solr.sh stop" -x


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

VuFind 1.x

Jetty (the wrapper that allows Solr to run) can be set up as a Windows service. First we need to change a couple of config settings, one is required, the others will just help. Assuming an install location of c:\vufind, edit c:\vufind\solr\jetty\bin\jetty-service.conf. Find the lines


And change them to:


You'll notice the first two lines haven't changed (they were just for reference), and the third line is passing Jetty Solr's home location. The last two lines control how much memory the JVM Jetty will be running inside of has access to. The default settings limit the JVM to 64mb, and we're going to need a lot more to comfortably run a Solr index. 256mb is still low for a server, but it's enough to play around on a laptop in comfort.

Now it's time to install the service. Open a command window and run the following:

  cd \vufind\solr\jetty\bin
  Jetty-Service.exe -i jetty-service.conf

NOTE: If you are running Windows Vista the above will still fail with 'access denied' unless you open the command prompt with admin rights. START > Programs > Accessories. Right-click on 'Command Prompt' and choose 'Run as administrator'.

VuFind 2.x

The Jetty service found in VuFind 1.x is no longer compatible with the version of Jetty used in VuFind 2.x. A best practice for running VuFind 2.x's Solr index as a Windows service has not yet been determined. See the VUFIND-589 ticket in JIRA for some helpful links and discussion, and feel free to make suggestions there (or revise this page) if you get things working.

February 2015: Solr was successfully configured as a service on both a Windows 7 test box running under XAMPP and a production Windows 8 R2 server using the following: http://blog.outerthoughts.com/2013/07/setting-up-apache-solr-on-windows-as-a-service/ It is not necessary to reinstall solr; simply point it to your current solr configuration e.g., C:\vufind\solr\jetty. Then skip down to the point in the instructions titled: Service Setup for Availability. This was the successfully modified command, remember to edit the path(s) as necessary and as stated in the online instructions, the following should not have any line breaks, insert spaces instead:

SolrService.exe //IS//SolrService --DisplayName="Solr Service"
--LogLevel=Debug --StdOutput=auto --StdError=auto
--StartMode=java --StopMode=java --Jvm=auto
++JvmOptions=-Djetty.home=C:\vufind\solr\jetty ++JvmOptions=-DSTOP.PORT=8087
++JvmOptions=-DSTOP.KEY=stopsolr ++JvmOptions=-Djetty.logs=C:\vufind\solr\jetty\logs
++JvmOptions=-XX:MaxPermSize=128M --Classpath=C:\vufind\solr\jetty\start.jar
--StartClass=org.eclipse.jetty.start.Main ++StartParams=OPTION=ALL
++StopParams=--stop ++JvmOptions=-Dsolr.solr.home=C:\vufind\solr

Note: the above should be entered as a single command line; it has been broken up here for readability.

Important! If you are running 64bit you'll need to retrieve the prunsrv.exe from the amd64 folder.

Judy Drescher, Molloy College

VuFind 3.x

Now that Solr can be started as a background process from the command line, it should be easier to manage it from within Windows; however, detailed instructions 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.txt · Last modified: 2017/08/22 09:05 by demiankatz