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

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
administration:starting_and_stopping_solr [2016/03/01 17:54] – [Linux Method] demiankatzadministration:starting_and_stopping_solr [2023/10/24 13:47] (current) – Removed notes about releases prior to 3.0. demiankatz
Line 1: Line 1:
 ====== Starting and Stopping Solr ====== ====== 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.+:!: This page applies to VuFind® versions 3.0 and newer; if you are using a very old release, see the "Old revisions" button below to find earlier versions of the documentation. 
 + 
 +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 ===== ===== 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:
  
-==== Linux Method ====+    ./solr.sh start
  
-To start Solr under Linuxjust switch to the directory where you installed VuFind (i.e. $VUFIND_HOME) and run this command:+Note:  If this doesn't workmake sure that the solr.sh script has execute permissions:
  
-    ./vufind.sh start+    chmod +x solr.sh
  
-Note:  If this doesn't workmake sure that the vufind.sh script has execute permissions:+Note:  If you previously rebooted your system without manually stopping Solrthe script may mistakenly believe that it is still running.  In this case, a [[starting_and_stopping_solr#restarting_solr_manually|manual restart]] should solve the problem.
  
-    chmod +x vufind.sh+=== Limit Warnings ===
  
-Note:  If you previously rebooted your system without manually stopping VuFind, the script may mistakenly believe that it is still running.  In this case, a [[starting_and_stopping_solr#restarting_solr_manually|manual restart]] should solve the problem.+Starting with Solr 7.3.1, you may see warnings on startup resembling:
  
-==== Windows Method ====+<code> 
 +*** [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 
 +</code>
  
-Starting with VuFind 1.0RC2, VuFind includes a Windows batch file to run Solr.  Just follow these steps:+This is warning of some default settings that could impact the performance of your Solr instanceThey are unlikely to cause problems if you are only using Solr for testing/development, but they should be addressed in production environments.
  
-  * At a command prompt, switch to your VuFind directory. +The best way to address the errors on Linux platforms using systemd is to start Solr through systemd and ensure that your [[#linux_systemd_method|systemd configuration]] contains appropriate limit values. The [[#linux_systemd_method|systemd example below]] includes appropriate settings to prevent limit warnings.
-  * Type:  vufind start+
  
-Note that the vufind.bat file which allows this command to work is created automatically as part of the install.bat setup process.  If you did not install VuFind using install.bat, the file may be missing.  You can re-run the install process to solve the problem.+On some Linux platforms, if systemd is not available, the problem can be addressed by editing the /etc/security/limits.conf file and adding these lines:
  
-If you are using an earlier version of VuFind, you will have to start the server manually From the command line, run:+<code> 
 +username         soft    nproc           65000 
 +username         soft    nofile          65000 
 +username         hard    nproc           65000 
 +username         hard    nofile          65000 
 +</code> 
 + 
 +(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. 
 + 
 +==== Windows Method ==== 
 + 
 +VuFind® includes a Windows batch file to run Solr.  Just follow these steps:
  
-    cd \vufind\solr\jetty\ +  * At a command prompt, switch to your VuFind® directory. 
-    java -Dsolr.solr.home=c:\vufind\solr -Xmx1G -Xms1G -jar start.jar+  * Type solr start
  
-Note:  The above command assumes you want to dedicate 1 Gig of memory to the Java engine.  Change the values as needed (see the [[administration:performance|Performance]] page for details).  This is especially important on lower end machines that will quickly freeze up during indexing if no memory limit is established.+Note that some of the scripting for this command is created automatically as part of the install.php setup process.  If you did not run install.php while setting up the software, the command may not work.  You can re-run the install process to solve the problem.
  
 ===== Stopping Solr Manually ===== ===== Stopping Solr Manually =====
Line 39: Line 62:
 ==== Linux Method ==== ==== Linux Method ====
  
-To take the server offline, switch to the VuFind directory and type:+To take the server offline, switch to the VuFind® directory and type:
  
-    ./vufind.sh stop+    ./solr.sh stop
  
 ==== Windows Method ==== ==== Windows Method ====
  
-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.+You can stop Solr from the command line in Windows:
  
-If you are running Solr through Jetty as serviceyou can stop the server through the Services control in the Administrative Tools area of Control Panel.+  * At command promptswitch to your VuFind® directory. 
 +  * Type:  solr stop
  
 ===== Restarting Solr Manually ===== ===== Restarting Solr Manually =====
Line 53: Line 77:
 ==== Linux Method ==== ==== Linux Method ====
  
-Restarting Solr under Linux is much the same as starting it.  Just switch to the VuFind directory and type:+Restarting Solr under Linux is much the same as starting it.  Just switch to the VuFind® directory and type:
  
-    ./vufind.sh restart+    ./solr.sh restart
  
 ==== Windows Method ==== ==== Windows Method ====
  
-There is no graceful way to restart a manually-started Solr instance under Windows.  Just follow the manual "stop" and "start" procedures described above.+You can restart Solr from the command line in Windows:
  
-If you are running Solr through Jetty as serviceyou can restart the server through the Services control in the Administrative Tools area of Control Panel.+  * At command promptswitch to your VuFind® directory. 
 +  * Type:  solr restart
  
 ===== Killing an Unresponsive Solr Process ===== ===== Killing an Unresponsive Solr Process =====
Line 99: Line 124:
 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. 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 [[https://github.com/jriedl|jriedl]] for investigating this issue. //
  
 +Most modern flavors of Linux (such as CentOS 7 and newer) use [[https://en.wikipedia.org/wiki/Systemd|systemd]] instead of the earlier [[administration:starting_and_stopping_solr:init.d]] approach. Instructions on the older approach have been moved to [[administration:starting_and_stopping_solr:init.d|a separate init.d page]].
  
 +To automate Solr with systemd:
 +  * [[administration:security#creating_a_dedicated_solr_user|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: 
  
-==== Linux (init.d) Method ====+<code>chown -R solr:solr /usr/local/vufind/solr</code>
  
-You can set up Solr to run as a daemon. To do so, create a wrapper script in /etc/init.d/vufind:+  * create new file called /etc/systemd/system/vufind.service, with this code:
  
 <code> <code>
-#!/bin/sh +[Unit
-### BEGIN INIT INFO +After=network.target
-# Default-Start: 2 3 4 5 +
-# Default-Stop: 0 1 6 +
-# Description: VuFind init script +
-### END INIT INFO +
-cd /usr/local/vufind +
-./vufind.sh $* +
-</code> +
- +
-// 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): +
- +
-<code> +
-chmod +x /etc/init.d/vufind +
-</code> +
- +
-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: +
- +
-<code> +
-service vufind start +
-service vufind stop +
-service vufind restart +
-service vufind check +
-</code> +
- +
-//("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 [[https://github.com/jriedl|jriedl]] for investigating this issue. // +
- +
-Some newer flavors of Linux (such as CentOS 7) use [[https://en.wikipedia.org/wiki/Systemd|systemd]] instead of the traditional init.d approach. +
- +
-To automate Solr with systemd, you should be able to add code similar to this in a new file called /etc/systemd/system/vufind.service: +
- +
-<code> +
-Description=VuFind Starter +
-After=network.target httpd.service mariadb.service+
  
 [Service] [Service]
 Type=forking Type=forking
-ExecStart=/bin/sh --login -c '/usr/local/vufind2/vufind.sh start' +ExecStart=/bin/sh --c '/usr/local/vufind/solr.sh start' -x 
-PIDFile=/var/run/vufind.pid +PIDFile=/usr/local/vufind/solr/vendor/bin/solr-8983.pid 
-User=root +User=solr 
-ExecStop=/bin/sh --login -c "/usr/local/vufind2/vufind.sh stop" +ExecStop=/bin/sh --c "/usr/local/vufind/solr.sh stop" -x 
- +SuccessExitStatus=
-# Java responds to a SIGTERM by returning with exit code 143 which leads to "failed" exit in the systemd-Logs +LimitNOFILE=65000 
-SuccessExitStatus=143+LimitNPROC=65000
  
 [Install] [Install]
 WantedBy=multi-user.target WantedBy=multi-user.target
 </code> </code>
 +
 +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. Be sure to adjust paths in the code above to match your local system.
Line 193: Line 175:
 systemctl [enable, start, stop, status] vufind systemctl [enable, start, stop, status] vufind
 </code> </code>
 +
 +Alternatively, you could investigate using the automation tools bundled with Solr 5+.
  
 ==== Windows Method ==== ==== Windows Method ====
  
-=== VuFind 1.x === +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 writingPlease feel free to contribute your own recommendations!
- +
-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 +
- +
-    wrapper.java.additional.1=-Djetty.home=../ +
-    wrapper.java.additional.2=-Djetty.logs=../logs +
-    wrapper.java.initmemory=3 +
-    wrapper.java.maxmemory=64 +
- +
-And change them to: +
- +
-    wrapper.java.additional.1=-Djetty.home=../ +
-    wrapper.java.additional.2=-Djetty.logs=../logs +
-    wrapper.java.additional.3=-Dsolr.solr.home=c:\vufind\solr +
-    wrapper.java.initmemory=64 +
-    wrapper.java.maxmemory=256 +
- +
-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 64mband 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 [[http://vufind.org/jira/browse/VUFIND-589|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:  +
- +
-<code> +
-SolrService.exe //IS//SolrService --DisplayName="Solr Service" +
---Install=C:\vufind\solr\jetty\SolrService.exe +
---LogPath=C:\vufind\solr\jetty\logs +
---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=-Dorg.eclipse.jetty.util.log.SOURCE=true +
-++JvmOptions=-XX:MaxPermSize=128M --Classpath=C:\vufind\solr\jetty\start.jar +
---StartClass=org.eclipse.jetty.start.Main ++StartParams=OPTION=ALL +
-++StartParams=C:\vufind\solr\jetty\etc\jetty.xml +
---StopClass=org.eclipse.jetty.start.Main +
-++StopParams=--stop ++JvmOptions=-Dsolr.solr.home=C:\vufind\solr +
---StartPath=C:\vufind\solr\jetty +
-</code> +
- +
-// Note: the above should be entered as a single command line; it has been broken up here for readability. // +
- +
-ImportantIf you are running 64bit you'll need to retrieve the prunsrv.exe from the amd64 folder.+
  
-Judy Drescher, Molloy College 
 ===== Taking the User Interface Offline ===== ===== 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 [[configuration:files:config.ini]] file.+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 [[configuration:files:config.ini]] file.
 ---- struct data ---- ---- struct data ----
 +properties.Page Owner : 
 ---- ----
  
administration/starting_and_stopping_solr.1456854847.txt.gz · Last modified: 2016/03/01 17:54 by demiankatz