January 31, 2011

Sphinx over Windows - Problems & Solutions

There were some basic problems which I faced and I have seen in the Sphinx Forum that lot of people face the same while running Sphinx Search Server on Windows. Here they are along with the solutions:

Problem 1

ERROR: connection to localhost:9312 failed (errno=10060, msg=A connection
attempt failed because the connected party did not properly respond after a period of
time, or established connection failed because connected host has failed to respond

In the hosts file located at \Windows\System32\drivers\etc

Uncomment the following line

127.0.0.1 localhost

For some reason this line is sometimes commented out!

Problem 2

The query doesn’t reach searchd (which is running) from your test.php file

In the test.php file make the following changes:

$host = "127.0.0.1"; instead of $host = "localhost";

Problem 3

• Service not started
• Error 1067...

Note that when Sphinx runs in daemon mode (i.e. when you start it from your command
prompt) , sphinx.pid file and log files dont get generated hence when you work with
options like index rotation it says:

WARNING: failed to open pid from pid_file Sphinx\log\searchd.pid.
WARNING: indices NOT rotated.

This error can be removed by starting Sphinx as a Service in Windows and not from command
prompt

C:\Sphinx> C:\Sphinx\searchd --install --config C:\Sphinx\sphinx.conf --servicename
SphinxSearch

If you get the following error while starting the service from the windows task manager
or using 'net' command:

The SphinxSearch service could not be started.

A system error has occurred.

System error 1067 has occurred.

For this error just check out your Windows Event Logs (found @ Control Panel -> System &
Security -> Administrative Tools (View Event Logs):

This will tell exactly about the problem. Mostly the problem for the above error is that
the path to sphinx.conf is not correct.

Since people usually copy and paste this command (from the Sphinx Manual) for starting the searchd service:

C:\Sphinx> C:\Sphinx\searchd --install --config C:\Sphinx\sphinx.conf.in --servicename
SphinxSearch

Notice the sphinx.conf.in instead of sphinx.conf in the above command.

The windows command prompt executes this command just after pasting on command line (because of the return key character in the command) and yes then the service is listed in your Task Manager. Now your service refers to an invalid conf file and thus does not start.

Delete the service and install again with correct conf file name.


2 comments:

  1. Thanks,
    Looking at windows event log solved my problem…Simply found that there was some typo in conf file location while installing the service….Though the service got installed but could not be started.

    Re-installing with right parameters made the fix!

    ReplyDelete