Cannot connect to MySQL server at 127.0.0.1 (61) rails thinking_sphinx

I upgraded from think_sphinx ~ 2.5 to 3.0.3 to follow the installation instructions for the heroku flying_sphinx add-on. Perhaps the update may not be needed, but now I am in it so that it can do.

When I try to search (for example, Post.search ("search term"), I get the following:

Can't connect to MySQL server on '127.0.0.1' (61) 

I have my index folder installed with post_index.rb

 ThinkingSphinx::Index.define :post, :with => :active_record do (. . . code here . . .) end 

and I have a config / thinking_sphinx.yml file

 development: version: 3.0.3 mysql41: 9110 morphology: stem_en html_strip: 1 min_infix_len: 2 bin_path: "/usr/local/bin" searchd_binary_name: searchd indexer_binary_name: indexer host: 127.0.0.1 test: version: 3.0.3 mysql41: 9110 morphology: stem_en html_strip: 1 min_infix_len: 2 production: version: 3.0.3 mysql41: 9110 morphology: stem_en html_strip: 1 min_infix_len: 2 

and gemfile

 gem 'mysql2', '0.3.12b5' gem 'thinking-sphinx', '3.0.3' #'2.0.11' gem 'flying-sphinx', '1.0.0' #'0.8.4' 

I run postgres locally and on heroku

Thanks!

Edit

Now my sphinx.yml thought looks like this:

 development: mysql41: 9110 morphology: stem_en html_strip: 1 min_infix_len: 2 bin_path: "/usr/local/bin" host: 127.0.0.1 test: mysql41: 9111 morphology: stem_en html_strip: 1 min_infix_len: 2 production: morphology: stem_en html_strip: 1 min_infix_len: 2 

When I tried searchd is not currently running.

 Stopped searchd daemon (pid: ). Generating configuration to /Users/Achilles/Desktop/dev/mocs/config/development.sphinx.conf Sphinx 2.0.6-release (r3473) Copyright (c) 2001-2012, Andrew Aksyonoff Copyright (c) 2008-2012, Sphinx Technologies Inc (http://sphinxsearch.com) using config file '/blah/blah/blah/development.sphinx.conf'... indexing index 'post_core'... ERROR: index 'post_core': infixes and morphology are enabled, enable_star=0 total 0 reads, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg total 0 writes, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg Failed to start searchd daemon. Check /Users/Achilles/Desktop/dev/mocs/log/development.searchd.log. Failed to start searchd. Check the log files for more information. 
+4
source share
1 answer

You want to change the following things:

  • Remove the version settings from your thinking_sphinx.yml file. This parameter is intended to clearly indicate which version of Sphinx you are using, not Thinking Sphinx .
  • Upgrading to TS v3.0.4 - it may not matter, but it doesn't hurt to use the latest versions.
  • Do not install mysql41 for your production environment - and it is probably best to set it to different values ​​for each of the development and testing processes - therefore, daemons can work simultaneously for both environments.
  • You can also remove the settings *_binary_name - if you set them to the default values, there are not many.

After all this has changed, run rake ts:rebuild and see if you can connect ... but at this point it’s worthwhile to find out if you see this problem locally or on Heroku?

+3
source

Source: https://habr.com/ru/post/1494173/


All Articles