bbvv
By:
bbvv

Sphinx error after server update

April 6, 2018 87 views
Ruby on Rails Ubuntu

I just discovered that the search functionality on my web site doesn't work. Going through some logs, I find this:

unicorn.stdout.log:
(...)
Error connecting to Sphinx via the MySQL protocol. Error
connecting to Sphinx via the MySQL protocol. Can't connect to MySQL server on '127.0.0.1'
(...)

production.searchd.log:
(...)
[Sat Mar 24 01:56:16.713 2018] [27459] rotating indices (seamless=1)
[Sat Mar 24 01:56:16.730 2018] [27459] rotating index 'listingdelta': started
[Sat Mar 24 01:56:16.738 2018] [27459] rotating index 'listing
delta': success
[Sat Mar 24 01:56:16.738 2018] [27459] rotating index: all indexes done
[Tue Mar 27 10:28:26.365 2018] [27459] caught SIGTERM, shutting down
[Tue Mar 27 10:28:26.926 2018] [27459] shutdown complete
<and then nothing after March 27th>

I'm trying rake ts:restart, reindex, stop, start etc, but then I get error messages like this:
rake aborted!
ActiveRecord::AdapterNotSpecified: 'development' database is not configured. Available: ["production"]
/path/to/file/environment.rb:17:in `<top (required)>'
Tasks: TOP => ts:index => environment

Everything worked fine before, but all of a sudden this search eror started to occur, and since the last line in the searhd log file is dated March 27, I suspect the behaviour is related to the upgrade.

Any hints on steps to resolve it?

Website:
https://hengerdeling.no

1 Answer
wp2 MOD April 6, 2018
Accepted Answer

I am not sure about Sphinx but if you are trying to restart, you may need to specify the Rails environment when calling the rake CLI: RAILS_ENV=production bundle exec rake ts:reindex

Edit: or something similar with whatever is expected in the rake task.

  • Thank you so much! You're a lifesaver!

    I changed reindex to restart, and then it restarted successfully.

Have another answer? Share your knowledge.