Sphinx error after server update

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 ‘’ (…)

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 ‘listing_delta’: 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?



Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

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.