4
votes

I have a search engine that i run sphinx with and now I run my vbulletin forum with sphinx. The only problem is sphinx only allows you to use one config file "sphinx.conf" and I now have 2 and must use 2. So now I have sphinx.conf and sphinx-vb.conf. How can I run a second instance of searchd so that I use the sphinx-vb.conf file? The reason I need 2 running is I have different needs for indexing and have cron jobs and what not and it will make things easier. I have looked all over google and cannot figure out how to run another instance of sphinx. I know I need to run on another port also so my port for the second will be 1 higher then the original which would be 9313. Does anyone know how to do this? Thanks.

I tried to run this sudo /usr/local/bin/searchd --config /usr/local/etc/sphinx-vb.conf

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

but of course it is running. It is running for the search engine.

2
I think I figured it out. This seems to be what is working for me in case someone else ever sees this and is looking to do the same thing. make a new directory and in that directory make a new searchd.pid. Just make a blank file called searchd.pid and point to it with your config script and then run sphinx. I dont know if this is how I should be doing it but it seems to work this way. I am still open to any suggestions. Thanks.chris
chris i am also having the same issue did you duplicated whole sphinx directories ?Suleman khan

2 Answers

3
votes

Chris, as you've noted in both your question and your comment - you need to use a different port for each searchd process, and a different pid file. Different log files may be a good idea too :)

2
votes

The only problem is sphinx only allows you to use one config file "sphinx.conf"

No, you can use them as much as you need.

How can I run a second instance of searchd so that I use the sphinx-vb.conf file? The reason I need 2 running is I have different needs for indexing and have cron jobs and what not and it will make things easier.

Not sure you need another instance for your needs. I mean for running sphinx-vb.conf file. Just as alternative for a different instance, you can just create different source in sphinx-vb.conf file and run both configs indexing with same instance like:

1 * * * * indexer --config /etc/sphinxsearch/sphinx.conf --all --rotate
* 2 * * * indexer --config /etc/sphinxsearch/sphinx-vb.conf --all --rotate

then run it on same port with same connect but make Queries for different sources. For example, with using sphinxapi.php:

$sphinx->SetServer( "localhost", 9312 );
$result1 = $sphinx->Query('','firstSource');
...
$result1 = $sphinx->Query('','sourceVb');