Reclaiming Sphinx Search as a non-root user
Okay, you're probably wondering why your searchd
daemon won't bind to your desired port and this looks a like a familiar screen dump to you:
WARNING: compat_sphinxql_magics=1 is deprecated; please update your application and config
listening on 127.0.0.1:9306
bind() failed on 127.0.0.1, retrying...
bind() failed on 127.0.0.1, retrying...
bind() failed on 127.0.0.1, retrying...
bind() failed on 127.0.0.1, retrying...
bind() failed on 127.0.0.1, retrying...
FATAL: bind() failed on 127.0.0.1: Address already in use
Here's what to do:
- Check for running
searchd
instances. You might have another instance running on your desired port.
ps aux | grep "searchd"
- To check for processes running and who runs them, you can execute:
ps -ef | fgrep searchd
- If you find some running instances, kill those PID numbers. Or, you can simply kill all running searchd instances (be careful if you're not the only app/user running searchd).
killall searchd
-
If you find that your process is being run by root, then it will keep respawning if it is set as a service. You can edit
vim /etc/default/sphinxsearch
and modify it fromSTART=yes
toSTART=no
-
???
-
Try to run your
searchd
again, and hopefully you'll get a successful start now.
Happy coding!
Image credits: https://briansnelson.com/images/2/26/Sphinxsearch.jpg