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
Next revisionBoth sides next revision
administration:starting_and_stopping_solr [2023/03/08 18:45] demiankatzadministration:starting_and_stopping_solr [2023/03/10 11:50] demiankatz
Line 4: Line 4:
  
 ===== Starting Solr Manually ===== ===== Starting Solr Manually =====
- 
- 
  
 ==== Linux Method ==== ==== Linux Method ====
Line 156: Line 154:
 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 init.d approach.
  
 +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: 
 +
 +<code>chown -R solr:solr /usr/local/vufind/solr</code>
 +
 +  * create new file called /etc/systemd/system/vufind.service, with this code:
 +
 +<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
 +</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.
 +
 +You can run
 +
 +<code>
 +systemctl enable vufind
 +</code>
 +
 +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.
 +
 +<code>
 +systemctl [enable, start, stop, status] vufind
 +</code>
 +
 +Alternatively, you could investigate using the automation tools bundled with Solr 5+.
  
 ==== Linux (init.d) Method ==== ==== Linux (init.d) Method ====
 +
 +:!: Most modern Linux distributions use systemd instead of init.d; please see the instructions below unless you are sure that init.d is a better approach for your situation.
  
 You can set up Solr to run as a daemon. To do so, create a wrapper script in /etc/init.d/vufind: You can set up Solr to run as a daemon. To do so, create a wrapper script in /etc/init.d/vufind:
Line 215: Line 263:
  
 If service is available, it is the preferred way of starting and stopping Solr after automation. 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: 
-  * [[administration:security#creating_a_dedicated_solr_user|create the user "solr"]], because Solr should not be run under root user. 
-  * add permission for the solr directory to this user:  
- 
-<code>chown -R solr:solr /usr/local/vufind/solr</code> 
- 
-  * 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: 
- 
-<code> 
-[Unit] 
-Description=VuFind Starter 
-After=network.target 
- 
-[Service] 
-Type=forking 
-ExecStart=/bin/sh --login -c '/usr/local/vufind2/vufind.sh start' 
-PIDFile=/var/run/vufind.pid 
-User=solr 
-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 
-SuccessExitStatus=143 
- 
-[Install] 
-WantedBy=multi-user.target 
-</code> 
- 
-In VuFind 7.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). For compatibility with VuFind 3.0 through 6.0, simply change "solr-8983.pid" to "solr-8080.pid" to reflect a different default port number. 
- 
-<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 
-</code> 
- 
-Be sure to adjust paths in the code above to match your local system. 
- 
-You can run 
- 
-<code> 
-systemctl enable vufind 
-</code> 
- 
-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. 
- 
-<code> 
-systemctl [enable, start, stop, status] vufind 
-</code> 
- 
-Alternatively, you could investigate using the automation tools bundled with Solr 5+. 
  
 ==== Windows Method ==== ==== Windows Method ====
administration/starting_and_stopping_solr.txt · Last modified: 2023/10/24 13:47 by demiankatz