Reputation: 8235
After deploying a rails 5 application that uses the sphinx gem for searching, I get this error:
2019-02-22T01:05:28.930528+00:00 app[web.1]: D, [2019-02-22T01:05:28.930455 #4] DEBUG -- : [64986155-264b-42ae-a1ce-d2772cd3dc38] Sphinx Query (1.4ms) SELECT * FROM `article_core` WHERE MATCH('Figaro') AND `sphinx_deleted` = 0 LIMIT 0, 500
2019-02-22T01:05:28.930863+00:00 app[web.1]: I, [2019-02-22T01:05:28.930788 #4] INFO -- : [64986155-264b-42ae-a1ce-d2772cd3dc38] Completed 500 Internal Server Error in 97ms (ActiveRecord: 47.5ms)
2019-02-22T01:05:28.931739+00:00 app[web.1]: F, [2019-02-22T01:05:28.931653 #4] FATAL -- : [64986155-264b-42ae-a1ce-d2772cd3dc38]
2019-02-22T01:05:28.931841+00:00 app[web.1]: F, [2019-02-22T01:05:28.931771 #4] FATAL -- : [64986155-264b-42ae-a1ce-d2772cd3dc38] ThinkingSphinx::ConnectionError (Error connecting to Sphinx via the MySQL protocol. Can't connect to MySQL server on '127.0.0.1' (111)):
2019-02-22T01:05:28.931936+00:00 app[web.1]: F, [2019-02-22T01:05:28.931867 #4] FATAL -- : [64986155-264b-42ae-a1ce-d2772cd3dc38]
2019-02-22T01:05:28.932045+00:00 app[web.1]: F, [2019-02-22T01:05:28.931975 #4] FATAL -- : [64986155-264b-42ae-a1ce-d2772cd3dc38] app/controllers/articles_controller.rb:169:in `results'
How to get past this error?
UPDATE: After adding missing flying_sphinx gem and 'heroku' wooden add-on, I still get:
FATAL -- : [e52202a5-b3fa-4b89-b188-e7e23c1cfc58] ThinkingSphinx::ConnectionError (Error connecting to Sphinx via the MySQL protocol. Lost connection to MySQL server at 'reading authorization packet', system error: 0):
UPDATE2: After trying the start command still no luck:
heroku run rake ts:start; echo $?
› Warning: heroku update available from 7.18.9 to 7.21.0
Running rake ts:start on ⬢ dart-research-database... up, run.8944 (Hobby)
I, [2019-02-22T01:54:12.587534 #4] INFO -- : Executing Action: start
W, [2019-02-22T01:54:13.378618 #4] WARN -- : Action failed.
I, [2019-02-22T01:54:13.651615 #4] INFO -- : Action Finished: start
0
Upvotes: 0
Views: 79
Reputation: 16226
Sphinx isn't running by default on Flying Sphinx - much like on your local machine, you'll need to run the relevant ts:...
rake tasks. ts:rebuild
should take care of everything, but if you want to run through each step more specifically:
ts:configure
will generate the configuration file (and on Heroku, send it to the Flying Sphinx servers).ts:start
will start the daemon.ts:index
will process all of your indices.If you're using SQL-backed indices, you should run the index task before start, but with real-time indices it's in the order listed above. The rebuild task takes care of all of this in the appropriate order.
And these tasks will operate correctly both locally and on Heroku, provided you're using v4 of the thinking-sphinx gem and v2 of the flying-sphinx gem.
Upvotes: 1