managing different instances of Sphinx Search?

I want to start up at least 2 different instances of Sphinx (each with distinct config files, listening port, processes, etc). It is unclear if this is possible via rc.conf.

For 1 user instance it is easy:

Code:
sphinxsearch_enable="YES"
sphinxsearch_conffile="/home/user1/sphinx.conf"
sphinxsearch_user="user1"
sphinxsearch_pidfile="/home/user1/sphinx.pid"

However, I'd like to do this for at least 2 different user processes.

This may be a more general question that just happens to using Sphinx as an example.

Thank you,
 
I think you can accomplish this by first making a copy the service startup script (/usr/local/etc/rc.d/sphinxsearch) with a unique name (e.g. /usr/local/etc/rc.d/sphinxsearch2). Then edit that file and change all this
Code:
name=sphinxsearch
rcvar=sphinxsearch_enable

load_rc_config ${name}

: ${sphinxsearch_enable="NO"}
: ${sphinxsearch_conffile="/usr/local/etc/sphinx.conf"}
: ${sphinxsearch_pidfile="/var/run/sphinxsearch/searchd.pid"}
: ${sphinxsearch_user="_sphinx"}
: ${sphinxsearch_group="_sphinx"}
: ${sphinxsearch_logdir="/var/log/sphinxsearch"}
: ${sphinxsearch_dir="/var/db/sphinxsearch"}
to this
Code:
name=sphinxsearch2
rcvar=sphinxsearch2_enable

load_rc_config ${name}

: ${sphinxsearch2_enable="NO"}
: ${sphinxsearch2_conffile="/usr/local/etc/sphinx2.conf"}
: ${sphinxsearch2_pidfile="/var/run/sphinxsearch/searchd2.pid"}
: ${sphinxsearch2_user="_sphinx"}
: ${sphinxsearch2_group="_sphinx"}
: ${sphinxsearch2_logdir="/var/log/sphinxsearch2"}
: ${sphinxsearch2_dir="/var/db/sphinxsearch2"}
With that, you should just need to put the necessary "sphinxsearch2_xxx" things in /etc/rc.conf and start up the sphinxsearch2 service.
 
Thank you! I was thinking along these lines, and if I have to go that route it seems like a fair enough solution. Anyway I slice it, I will either have to write a custom script.

++ for understanding what I was asking, too.

Cheers,

Update:

This worked like a charm. I just copied over /usr/local/etc/rc.d/sphinxsearch to /usr/local/etc/rc.d/sphinxsearch2, did a s/sphinxsearch_/sphinxsearch2_/, updated "name=sphinxsearch2", and added the sphinxsearch2_* variables in /etc/rc.conf.

Thanks, again!
 
Back
Top