How gracefully restart Sphinx search daemon after reindexing

David Xia picture David Xia · Oct 26, 2011 · Viewed 46.9k times · Source

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?

Answer

Narcissus picture Narcissus · Nov 30, 2011

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.