开发者

how to run multiple instances of sphinx?

开发者 https://www.devze.com 2023-03-06 11:46 出处:网络
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

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开发者_JAVA技巧 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.


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 :)


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');
0

精彩评论

暂无评论...
验证码 换一张
取 消