Reputation: 5453
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?
Upvotes: 16
Views: 52914
Reputation: 138
It seems there is an issue with the searchd --stop
command failing to stop the daemon on some instances of Sphinx.
Try: service sphinxsearch stop
See: https://bugs.launchpad.net/ubuntu/+source/sphinxsearch/+bug/990395
Upvotes: 4
Reputation: 3194
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
.
Upvotes: 30
Reputation: 316
You'll need to call indexer on the new index to create it and then --rotate to update it.
So it would be something like
indexer --config /path/to/config.conf indexname
And then when you just want to update your indexes
indexer --config /path/to/config.conf --rotate --all
This will create a temporary copy of each index and replace the old ones when finished. For more info on what actually happens see http://sphinxsearch.com/docs/manual-0.9.9.html#ref-indexer
On the other error your getting Do
ps aux | grep searchd
if it returns no results, then remove /usr/local/sphinx/var/log/searchd.pid and start searchd again
Upvotes: 9