Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How gracefully restart Sphinx search daemon after reindexing

I've reindexed my Sphinx search with /usr/local/sphinx/bin/indexer --all --rotate and renamed my original index output files to something else. Simply changing the index argument passed to $sphinx->Query($query, $index); returns no results.

I suspected the daemon doesn't know the new index files exist. So I ran

sudo /usr/local/sphinx/bin/searchd

again to try to restart it. But it threw

FATAL: failed to lock pid file '/usr/local/sphinx/var/log/searchd.pid': Resource temporarily unavailable (searchd already running?)

I had to kill the 2 processes of the search daemon and start it again to grab from the new index files. Is there a graceful way to restart it?

like image 318
David Xia Avatar asked Oct 26 '11 12:10

David Xia


1 Answers

I know this is a late answer, but just so you know, to 'restart' Sphinx, you need to stop it then start it (as in, two distinct processes).

To stop it, call searchd --stop then just start it again with searchd.

like image 120
Narcissus Avatar answered Sep 20 '22 21:09

Narcissus