16

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?

Ilian Iliev
  • 3,217
  • 4
  • 26
  • 51
David Xia
  • 5,075
  • 7
  • 35
  • 52

4 Answers4

30

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.

Narcissus
  • 3,144
  • 3
  • 27
  • 40
9

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

daxroc
  • 316
  • 1
  • 6
4

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

d-_-b
  • 21,536
  • 40
  • 150
  • 256
y_s
  • 138
  • 4
  • In my case I run into this because of having nonstandard pid file in `/etc/sphinxsearch/sphinx.conf` - which was different from `/etc/init.d/sphinxsearch`. – pevik Apr 11 '13 at 11:33
0

service searchd start worked for me on CentOS

d-_-b
  • 21,536
  • 40
  • 150
  • 256