3

I tried to use thinking sphinx (3.0.2) with remote sphinx server. whenever search query is called like Model.search, I am getting the error:

Mysql2::Error: Lost connection to MySQL server at 'reading initial communication packet', system error: 0.

When I tried to debug it,

Mysql2::Client.new({
    :host  => address,
    :port  => port,
    :flags => Mysql2::Client::MULTI_STATEMENTS
}

code is called in thinking-sphinx-3.0.2/lib/thinking_sphinx/connection.rb:55 with port specified in thinking_sphinx.yml.

When I tried that code in console, I am getting the same error. How can I solve it? Is it related to mysql or sphinx or thinking_sphinx?

FYI:

  1. rails(3.2.8) , thinking-sphinx (3.0.2), sphinx (2.0.5)
  2. sphinx, mysql are in same remote server
MikO
  • 18,243
  • 12
  • 77
  • 109
Dhavaprathap
  • 188
  • 8
  • 1
    Have you specified the right **sphinx** port in the connection settings - the one you have searchd listening on, not the mysql port – barryhunter Apr 18 '13 at 10:53
  • Are you setting the port with the mysql41 setting in `thinking_sphinx.yml`? The `port` setting is only for pre v3 releases of Thinking Sphinx. – pat Apr 18 '13 at 11:49
  • Also: can you connect to the Sphinx server using the `mysql` command-line tool (with the appropriate host and port)? And is that port open through whatever firewall/security you have set up? – pat Apr 18 '13 at 11:50
  • @barryhunter: i have specified the proper port only. I haven't given mysql's port. – Dhavaprathap Apr 19 '13 at 06:28
  • 1
    @pat: I dunno what I am missing. If I use mysql41 in thinking_sphinx.yml and try rake `ts:configure` its giving me Riddle Configuration error. But with port option its working. Is it could be a problem with version of another gem what thinking_sphinx depend on? But unfortunately the same is working fine in dev machine with one difference, in my dev machine, in the .conf it generates have a setting with name `listen` got generated from address and mysql41 in yml. In production machine `listen` is not generated, instead it keeps the address alone. – Dhavaprathap Apr 19 '13 at 06:40
  • When you add the mysql41 option, you also need to remove the port option. Can you share the contents of your thinking_sphinx.yml file? – pat Apr 19 '13 at 08:15
  • @pat * address: ****.****.com * port: 9312 configuration_file: path indices_location: path log: path query_log: path pid_file: path` – Dhavaprathap Apr 19 '13 at 10:33
  • @pat: sorry i dunno how to represent the list in comment. the options that i have mentioned are `address,port,configuration_file,indices_location, log, query_log, pid_file` – Dhavaprathap Apr 19 '13 at 10:42
  • Can you rename the port option to mysql41? Also, you can edit your question and put the information in there. – pat Apr 19 '13 at 13:58
  • @pat: by renaming to mysql41, i made it working in dev environment. But in production am getting the same error. In both machine i have same rvm ruby-patch, rails, thinking sphinx. what do i need to do ? – Dhavaprathap Apr 20 '13 at 04:46

0 Answers0