Run solr 6.5+ as daemon

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Run solr 6.5+ as daemon

Nawab Zada Asad Iqbal
Hi,

I want my solr to restart if the process crashes; I am wondering if there
is any drawback which I should consider?
I am considering to use 'daemon --respawn' in the bin/solr; where the OOTB
script has following statement:

nohup "$JAVA" "${SOLR_START_OPTS[@]}" $SOLR_ADDL_ARGS
> -Dsolr.log.muteconsole \
>         "-XX:OnOutOfMemoryError=$SOLR_TIP/bin/oom_solr.sh $SOLR_PORT
> $SOLR_LOGS_DIR" \
>         -jar start.jar "${SOLR_JETTY_CONFIG[@]}" \
>         1>"$SOLR_LOGS_DIR/solr-$SOLR_PORT-console.log" 2>&1 & echo $! >
> "$SOLR_PID_DIR/solr-$SOLR_PORT.pid"
>


Basically something like:

daemon --respawn --name mysolr --pidfiles="$SOLR_PID_DIR/solr-$SOLR_PORT.pid"
--user solr --chdir /home/nawab/solr/bin \
        --stdout $LOGDIR/$SOLR_SHARD.log --stderr $LOGDIR/$SOLR_SHARD.log \
        --command $JAVA -- "${SOLR_START_OPTS[@]}" $SOLR_ADDL_ARGS
-Dsolr.log.muteconsole \
        "-XX:OnOutOfMemoryError=$SOLR_TIP/bin/oom_solr.sh $SOLR_PORT
$SOLR_LOGS_DIR" \
        -jar start.jar "${SOLR_JETTY_CONFIG[@]}"


Regards
Nawab
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Run solr 6.5+ as daemon

Shawn Heisey-2
On 7/14/2017 8:29 AM, Nawab Zada Asad Iqbal wrote:
> I want my solr to restart if the process crashes; I am wondering if there
> is any drawback which I should consider?
> I am considering to use 'daemon --respawn' in the bin/solr;

The included scripts already run Solr in the background.  I don't know
if that's enough to call it a daemon, but it's pretty close even if it's
not technically accurate.

Solr almost never *crashes*.  I've never seen it happen, and I've been
using Solr for seven years.  Typically if a Solr process were to
actually crash, it would be caused by a problem with Java itself, a
problem with the local Solr installation, or a problem with the
operating system.

Modern Solr versions (if running on non-Windows systems) *do* kill
themselves if an OutOfMemoryError exception occurs ... but if that
happens, you do not want to automatically restart Solr -- you need to
figure out why the OOME happened and fix it.  After a Java program
encounters OOME, it is completely unpredictable and can destroy its
data.  If the OOME was not caused by an atypical query, it is almost
guaranteed to happen again.

Thanks,
Shawn

Loading...