I have a problem that I cannot fix today. It already happened to me at least once but I don't really remember exactly what I've done to fix it.
I'm deploying my Rails 4 application (with Apache and Passenger and using Ruby 2.1) on my own server using Capistrano 3. Currently I cannot use Thinking-Sphinx because of the following error :
FATAL: bind() failed on my.ip.address : Cannot assign requested address
This error is strange because I can use without error the command index
but not rebuild
.
I'm now working directly on the server by ssh trying to solve this problem. Do I have to start searchd
by my own ? Do I have to stop Apache during the rebuilding ?
I don't even know where to begin.
Last word : The strangest part is that It was working like that but I cannot restart it.
I've joined some configuration files.
config/initializer/thinking_sphinx.rb
ThinkingSphinx::ActiveRecord::DatabaseAdapters.default =
ThinkingSphinx::ActiveRecord::DatabaseAdapters::PostgreSQLAdapter
ThinkingSphinx::SphinxQL.functions!
config/thinking_sphinx.yml
development:
mysql41 : 9312
enable_star: true
min_prefix_len: 3
utf8: true
preprod:
address: "my.domain.com"
port: 9312
enable_star: true
min_prefix_len: 3
config/deploy.rb
execute "cd #{fetch(:deploy_to)}/current/ && RAILS_ENV=#{fetch(:environment)} bundle exec rake ts:rebuild", raise_on_non_zero_exit: false
execute "cd #{fetch(:deploy_to)}/current/ && RAILS_ENV=#{fetch(:environment)} bundle exec rake ts:index", raise_on_non_zero_exit: false
log/preprod.searchd.log
[Sun Apr 6 15:16:07.185 2014] [ 4647] Child process 4648 has been forked
[Sun Apr 6 15:16:07.191 2014] [ 4648] listening on 82.227.207.7:9312
[Sun Apr 6 15:16:07.191 2014] [ 4648] bind() failed on my.ip.address, retrying...
[Sun Apr 6 15:16:10.194 2014] [ 4648] bind() failed on my.ip.address, retrying...
[Sun Apr 6 15:16:13.196 2014] [ 4648] bind() failed on my.ip.address, retrying...
[Sun Apr 6 15:16:16.199 2014] [ 4648] bind() failed on my.ip.address, retrying...
[Sun Apr 6 15:16:19.202 2014] [ 4648] bind() failed on my.ip.address, retrying...
[Sun Apr 6 15:16:22.205 2014] [ 4648] bind() failed on my.ip.address, retrying...
[Sun Apr 6 15:16:25.208 2014] [ 4648] bind() failed on my.ip.address, retrying...
[Sun Apr 6 15:16:28.212 2014] [ 4648] bind() failed on my.ip.address, retrying...
[Sun Apr 6 15:16:31.215 2014] [ 4648] bind() failed on my.ip.address, retrying...
[Sun Apr 6 15:16:34.218 2014] [ 4648] bind() failed on my.ip.address, retrying...
[Sun Apr 6 15:16:37.221 2014] [ 4648] bind() failed on my.ip.address, retrying...
[Sun Apr 6 15:16:40.224 2014] [ 4648] bind() failed on my.ip.address, retrying...
[Sun Apr 6 15:16:43.228 2014] [ 4648] FATAL: bind() failed on my.ip.address: Cannot assign requested address
[Sun Apr 6 15:16:43.229 2014] [ 4647] Child process 4648 has been finished, exit code 1. Watchdog finishes also. Good bye!
Thank you in advance for your help.
I found the solution. The mistake came from the thinking_sphinx.rb
file.
I needed the same configuration as on development.
preprod:
mysql41 : 9312
enable_star: true
min_prefix_len: 3
Finally, the problem came from the pid file path which was not specified AND we have to reconfigure sphinx rake ts:configure
before rake ts:rebuild
. That solved completely my deployment problem with Capistrano 3.
I hope this will help some else.