11.05.2016 Views

Apache Solr Reference Guide Covering Apache Solr 6.0

21SiXmO

21SiXmO

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

the Log4J settings to create logs in the /var/solr/logs directory. Take a moment to verify that the <strong>Solr</strong><br />

include file is configured to send logs to the correct location by checking the following settings in /etc/defau<br />

lt/solr.in.sh :<br />

LOG4J_PROPS=/var/solr/log4j.properties<br />

SOLR_LOGS_DIR=/var/solr/logs<br />

For more information about Log4J configuration, please see: Configuring Logging<br />

init.d script<br />

When running a service like <strong>Solr</strong> on Linux, it’s common to setup an init.d script so that system administrators can<br />

control <strong>Solr</strong> using the service tool, such as: service solr start. The installation script creates a very basic<br />

init.d script to help you get started. Take a moment to inspect the /etc/init.d/solr file, which is the default<br />

script name setup by the installation script. If you used the -s option on the install script to change the name of<br />

the service, then the filename will be different. Notice that the following variables are setup for your environment<br />

based on the parameters passed to the installation script:<br />

SOLR_INSTALL_DIR=/opt/solr<br />

SOLR_ENV=/etc/default/solr.in.sh<br />

RUNAS=solr<br />

The SOLR_INSTALL_DIR and SOLR_ENV variables should be self-explanatory. The RUNAS variable sets the<br />

owner of the <strong>Solr</strong> process, such as solr; if you don’t set this value, the script will run <strong>Solr</strong> as root, which is not<br />

recommended for production. You can use the /etc/init.d/solr script to start <strong>Solr</strong> by doing the following<br />

as root:<br />

# service solr start<br />

The /etc/init.d/solr script also supports the stop, restart, and status commands. Please keep in mind<br />

that the init script that ships with <strong>Solr</strong> is very basic and is intended to show you how to setup <strong>Solr</strong> as a service.<br />

However, it’s also common to use more advanced tools like supervisord or upstart to control <strong>Solr</strong> as a service<br />

on Linux. While showing how to integrate <strong>Solr</strong> with tools like supervisord is beyond the scope of this guide, the i<br />

nit.d/solr script should provide enough guidance to help you get started. Also, the installation script sets the<br />

<strong>Solr</strong> service to start automatically when the host machine initializes.<br />

Progress Check<br />

In the next section, we cover some additional environment settings to help you fine-tune your production setup.<br />

However, before we move on, let's review what we've achieved thus far. Specifically, you should be able to<br />

control <strong>Solr</strong> using /etc/init.d/solr. Please verify the following commands work with your setup:<br />

$ sudo service solr restart<br />

$ sudo service solr status<br />

The status command should give some basic information about the running <strong>Solr</strong> node that looks similar to:<br />

<strong>Apache</strong> <strong>Solr</strong> <strong>Reference</strong> <strong>Guide</strong> <strong>6.0</strong><br />

506

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!