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.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
administration:starting_and_stopping_solr [2022/12/22 13:09] – [Linux (systemd) Method] demiankatz | administration: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:// | ||
+ | Most modern flavors of Linux (such as CentOS 7 and newer) use [[https:// | ||
+ | To automate Solr with systemd: | ||
+ | * [[administration: | ||
+ | * add permission for the solr directory to this user if you have not already: | ||
+ | |||
+ | < | ||
+ | |||
+ | * create new file called / | ||
+ | |||
+ | < | ||
+ | [Unit] | ||
+ | After=network.target | ||
+ | |||
+ | [Service] | ||
+ | Type=forking | ||
+ | ExecStart=/ | ||
+ | PIDFile=/ | ||
+ | User=solr | ||
+ | ExecStop=/ | ||
+ | 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 " | ||
+ | |||
+ | 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, | ||
==== 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 / | You can set up Solr to run as a daemon. To do so, create a wrapper script in / | ||
Line 168: | Line 216: | ||
:!: 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 " | :!: 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 " | ||
- | :!: Newer versions of Solr do not like to be run by the root user; you may need to either add " | + | :!: Newer versions of Solr do not like to be run by the root user; you may need to either add " |
< | < | ||
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:// | ||
- | |||
- | Some newer flavors of Linux (such as CentOS 7) use [[https:// | ||
- | |||
- | To automate Solr with systemd: | ||
- | * create the user " | ||
- | * add permission for the solr directory to this user: | ||
- | |||
- | < | ||
- | |||
- | * create new file called / | ||
- | |||
- | In VuFind 2.x, the contents of the file should be as follows: | ||
- | |||
- | < | ||
- | [Unit] | ||
- | Description=VuFind Starter | ||
- | After=network.target | ||
- | |||
- | [Service] | ||
- | Type=forking | ||
- | ExecStart=/ | ||
- | PIDFile=/ | ||
- | User=solr | ||
- | ExecStop=/ | ||
- | |||
- | # Java responds to a SIGTERM by returning with exit code 143 which leads to " | ||
- | SuccessExitStatus=143 | ||
- | |||
- | [Install] | ||
- | WantedBy=multi-user.target | ||
- | </ | ||
- | |||
- | 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 " | ||
- | |||
- | < | ||
- | [Unit] | ||
- | After=network.target | ||
- | |||
- | [Service] | ||
- | Type=forking | ||
- | ExecStart=/ | ||
- | PIDFile=/ | ||
- | User=solr | ||
- | ExecStop=/ | ||
- | SuccessExitStatus=0 | ||
- | |||
- | [Install] | ||
- | WantedBy=multi-user.target | ||
- | </ | ||
- | |||
- | 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, | ||
==== Windows Method ==== | ==== Windows Method ==== |
administration/starting_and_stopping_solr.txt · Last modified: 2023/10/24 13:47 by demiankatz