Skip to content

Commit

Permalink
improve Solr docs #4158
Browse files Browse the repository at this point in the history
  • Loading branch information
pdurbin committed Mar 26, 2018
1 parent 39be0a9 commit 41a7ea9
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 85 deletions.
34 changes: 0 additions & 34 deletions conf/vagrant/etc/init.d/solr

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
****
#!/bin/sh

# Starts, stops, and restarts Apache Solr.
#
# chkconfig: 35 92 08
# description: Starts and stops Apache Solr

SOLR_DIR="/usr/local/solr-7.2.1"
SOLR_DIR="/usr/local/solr/solr-7.2.1"
SOLR_COMMAND="bin/solr"
SOLR_ARGS="-m 1g"
SOLR_USER=solr

case $1 in
start)
echo "Starting Solr"
cd $SOLR_DIR
$SOLR_COMMAND start $SOLR_ARGS
sudo -u $SOLR_USER $SOLR_COMMAND start $SOLR_ARGS
;;
stop)
echo "Stopping Solr"
cd $SOLR_DIR
$SOLR_COMMAND stop $SOLR_ARGS
sudo -u $SOLR_USER $SOLR_COMMAND stop $SOLR_ARGS
;;
restart)
$0 stop
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ After = syslog.target network.target remote-fs.target nss-lookup.target
[Service]
User = solr
Type = simple
WorkingDirectory = /usr/local/solr-7.2.1
ExecStart = bin/solr start -m 1g
WorkingDirectory = /usr/local/solr/solr-7.2.1
ExecStart = /usr/local/solr/solr-7.2.1/bin/solr start -m 1g
Restart=on-failure

[Install]
Expand Down
21 changes: 1 addition & 20 deletions doc/sphinx-guides/source/installation/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Configuration

Now that you've successfully logged into Dataverse with a superuser account after going through a basic :doc:`installation-main`, you'll need to secure and configure your installation.

Settings within Dataverse itself are managed via JVM options or by manipulating values in the ``setting`` table directly or through API calls. Configuring Solr requires manipulating XML files.
Settings within Dataverse itself are managed via JVM options or by manipulating values in the ``setting`` table directly or through API calls.

Once you have finished securing and configuring your Dataverse installation, you may proceed to the :doc:`/admin/index` for more information on the ongoing administration of a Dataverse installation. Advanced configuration topics are covered in the :doc:`r-rapache-tworavens`, :doc:`shibboleth` and :doc:`oauth2` sections.

Expand Down Expand Up @@ -63,25 +63,6 @@ Password complexity rules for "builtin" accounts can be adjusted with a variety
- :ref:`:PVGoodStrength`
- :ref:`:PVCustomPasswordResetAlertMessage`

Solr
----

schema.xml
++++++++++

The :doc:`prerequisites` section explained that Dataverse requires specific Solr schema and config files called ``schema.xml`` and ``solrconfig.xml`` respectively, that can be found in the Dataverse distribution. You should have already replaced the default ``example/solr/collection1/conf/schema.xml`` and ``example/solr/collection1/conf/solrconfig.xml`` file that ships with Solr.

jetty.xml
+++++++++

Stop Solr and edit ``solr-7.2.1/server/etc/jetty.xml`` , changing ``requestHeaderSize`` as follows:

.. code-block:: xml
<Set name="requestHeaderSize"><Property name="solr.jetty.request.header.size" default="102400" /></Set>
Without this ``requestHeaderSize`` line in place, which increases the default size, it will appear that no data has been added to your Dataverse installation and ``WARN org.eclipse.jetty.http.HttpParser – HttpParser Full for /127.0.0.1:8983`` will appear in the Solr log. See also https://support.lucidworks.com/hc/en-us/articles/201424796-Error-when-submitting-large-query-strings-

Network Ports
-------------

Expand Down
55 changes: 31 additions & 24 deletions doc/sphinx-guides/source/installation/prerequisites.rst
Original file line number Diff line number Diff line change
Expand Up @@ -166,49 +166,56 @@ The Dataverse search index is powered by Solr.
Installing Solr
===============

Download and install Solr with these commands::
You should not run Solr as root. Create a user called ``solr`` and a directory to install Solr into::

# wget https://archive.apache.org/dist/lucene/solr/7.2.1/solr-7.2.1.tgz
# tar xvzf solr-7.2.1.tgz
# rsync -auv solr-7.2.1 /usr/local/
# cd /usr/local/solr-7.2.1/server/solr
# cp -r configsets\_default .
# mv _default collection1
# cd collection1/conf
# cp -a solrconfig.xml solrconfig.xml.orig
useradd solr
mkdir /usr/local/solr
chown solr:solr /usr/local/solr

Dataverse requires a custom Solr configuration and schema to operate and are contained in the "dvinstall.zip" file in each Dataverse release at https://github.com/IQSS/dataverse/releases . Download this zip file, extract ``schema.xml`` & ``solrconfig.xml`` from it, and put it into place (in the same directory as above)::
Become the ``solr`` user and then download and configure Solr::

# cp /tmp/schema.xml schema.xml
# cp /tmp/solrconfig.xml solrconfig.xml
su - solr
cd /usr/local/solr
wget https://archive.apache.org/dist/lucene/solr/7.2.1/solr-7.2.1.tgz
tar xvzf solr-7.2.1.tgz
cd solr-7.2.1
cp -r server/solr/configsets/_default server/solr/collection1

Note: Dataverse has customized Solr to boost results that come from certain indexed elements inside Dataverse, for example results matching on the name of a dataset. If you would like to remove this, edit your solrconfig.xml and remove the ``<str name="qf">`` element and its contents.
Download "dvinstall.zip" file in each Dataverse release at https://github.com/IQSS/dataverse/releases and unzip it into ``/tmp``. Then copy the files into place::

With the Dataverse-specific schema in place, you can now start Solr and create the core that will be used to manage search information::
cp /tmp/dvinstall/schema.xml /usr/local/solr/solr-7.2.1/server/solr/collection1/conf
cp /tmp/dvinstall/solrconfig.xml /usr/local/solr/solr-7.2.1/server/solr/collection1/conf

# cd /usr/local/solr-7.2.1
# bin/solr start
# bin/solr create_core -c collection1 -d server/solr/collection1/conf/
Note: Dataverse has customized Solr to boost results that come from certain indexed elements inside Dataverse, for example results matching on the name of a dataset. If you would like to remove this, edit your ``solrconfig.xml`` and remove the ``<str name="qf">`` element and its contents.

Dataverse requires a change to the ``jetty.xml`` file that ships with Solr. Edit ``/usr/local/solr/solr-7.2.1/server/etc/jetty.xml`` , increasing ``requestHeaderSize`` from ``8192`` to ``102400``

With the Dataverse-specific config in place, you can now start Solr and create the core that will be used to manage search information::

cd /usr/local/solr/solr-7.2.1
bin/solr start
bin/solr create_core -c collection1 -d server/solr/collection1/conf/

Solr Init Script
================

The command above will start Solr which is good for a quick sanity check that Solr accepted the schema file, but letting the system start Solr automatically is recommended.

- This :download:`Solr Systemd file<../_static/installation/files/etc/systemd/solr.service>` will launch Solr on boot as the solr user for RHEL/CentOS 7 or Ubuntu 16+ systems, or
- For systems using init.d, you may attempt to adjust this :download:`Solr init script <../_static/installation/files/etc/init.d/solr>` for your needs or write your own.
For systems running systemd, as root, download :download:`solr.service<../_static/installation/files/etc/systemd/solr.service>` and place it in ``/tmp``. Then start Solr and configure it to start at boot with the following commands::

cp /tmp/solr.service /usr/lib/systemd/system
systemctl start solr.service
systemctl enable solr.service

Solr should be running before the Dataverse installation script is executed.
For systems using init.d, :download:`Solr init script <../_static/installation/files/etc/init.d/solr>` and place it in ``/tmp/``. Then start Solr and configure it to start at boot with the following commands::

cp /tmp/solr /etc/init.d
service solr start
chkconfig solr on

Securing Solr
=============

Solr must be firewalled off from all hosts except the server(s) running Dataverse. Otherwise, any host that can reach the Solr port (8983 by default) can add or delete data, search unpublished data, and even reconfigure Solr. For more information, please see https://lucene.apache.org/solr/guide/7_2/securing-solr.html

You may want to poke a temporary hole in your firewall to play with the Solr GUI. More information on this can be found in the :doc:`/developers/dev-environment` section of the Developer Guide.

jq
--

Expand Down
2 changes: 1 addition & 1 deletion scripts/vagrant/setup-solr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ su $SOLR_USER -s /bin/sh -c "cd $SOLR_HOME/solr-7.2.1/server/solr && cp -r confi
su $SOLR_USER -s /bin/sh -c "cp /conf/solr/7.2.1/schema.xml $SOLR_HOME/solr-7.2.1/server/solr/collection1/conf/schema.xml"
su $SOLR_USER -s /bin/sh -c "cp /conf/solr/7.2.1/solrconfig.xml $SOLR_HOME/solr-7.2.1/server/solr/collection1/conf/solrconfig.xml"
su $SOLR_USER -s /bin/sh -c "cd $SOLR_HOME/solr-7.2.1 && bin/solr start && bin/solr create_core -c collection1 -d server/solr/collection1/conf/"
cp /dataverse/conf/vagrant/etc/init.d/solr /etc/init.d/solr
cp /dataverse/doc/sphinx-guides/source/_static/installation/files/etc/init.d/solr /etc/init.d/solr
chmod 755 /etc/init.d/solr
/etc/init.d/solr stop
/etc/init.d/solr start
Expand Down

0 comments on commit 41a7ea9

Please sign in to comment.