thinking-sphinx: Error connecting to Sphinx via the MySQL protocol. Can't connect to MySQL server on '127.0.0.1' (111)

Hi @pat,

I’m hoping you’d be able to point me in the right direction. My config,

development:
  port: 9311
  html_strip: 1
  morphology: stem_en
test:
  port: 9313
  html_strip: 1
  morphology: stem_en
staging:
  port: 9319
  html_strip: 1
  bin_path: /usr/bin/
  morphology: stem_en
production:
  port: 9319
  html_strip: 1
  bin_path: /usr/bin/
  morphology: stem_en

Snippet from the config,

searchd
{
  listen = 127.0.0.1:9306:mysql41

Did a quick test,

mysql -h 127.0.0.1 -u root -p
Enter password:
ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (111)

Curious thing is we’ve got a couple other apps in our Chef stack and mysql responds the same for all of them, yet older versions of TS are running fine. Unfortunately, these are also Rails 2x apps, and the one I’m having trouble with is our first Rails 4 app (in this stack).

Thanks! Best M.

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 23 (7 by maintainers)

Most upvoted comments

And have you run rake ts:configure ts:restart since making the change? (ts:rebuild will also do the trick, but the indexing part of that isn’t required).

@pat thanks! rake ts:configure ts:restart helped!

Just a note for posterity, I’ve seen this happen in my test suite where I have a custom test harness to start up sphinx using ThinkingSphinx::Test.start_with_autostop. Everything was working and then suddenly it stopped working giving me this error which was not solved by any of the usual rebuilding/reindexing steps.

Turns out sphinx was failing to start due to a corrupt binlog. There was no outward indication of this in the test output, but it showed up in the test.searchd.log where it said:

FATAL: binlog: update: descending tid

Just had to rm all the files from the binlog (making sure no searchd process was running) and then voilà!

Just to confirm: are you using config/sphinx.yml (which was the file for TS v1/v2) or config/thinking_sphinx.yml (the file for TS v3)?