I using using jetty to run Solr using the following cmd line: java -jar start.jar &
how can I stop this instance of solr gracefully?
Find the process id with ps
and send it a signal to stop using kill
- I believe the HUP
or INT
signals will allow the java process to gracefully exit; test to confirm.
Better yet, you should really be using a proper service to run Solr - Tomcat can do this, or Jetty can be made to run as a service.
Just to clarify the previous answer, in the command:
java -DSTOP.PORT=8001 -DSTOP.KEY=stop_jetty -jar start.jar
The -DSTOP.PORT=port
should specify an available port (different from the port configured in the solr_home/etc/jetty.xml
used for Jetty). I tried in the next way to start it:
nohup java -DSTOP.PORT=8001 -DSTOP.KEY=stop_jetty -jar start.jar &
And just added the --stop
parameter to stop it:
nohup java -DSTOP.PORT=8001 -DSTOP.KEY=stop_jetty -jar start.jar --stop &
In both cases is working fine but still it doesn't look gracefully enough.