Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache 生产上的ThinkingSphinx:无法分配请求的地址_Apache_Ruby On Rails 4_Passenger_Thinking Sphinx - Fatal编程技术网

Apache 生产上的ThinkingSphinx:无法分配请求的地址

Apache 生产上的ThinkingSphinx:无法分配请求的地址,apache,ruby-on-rails-4,passenger,thinking-sphinx,Apache,Ruby On Rails 4,Passenger,Thinking Sphinx,我有一个今天无法解决的问题。它已经发生在我身上至少一次,但我真的不记得我到底做了什么来修复它 我正在使用Capistrano3在自己的服务器上部署Rails4应用程序(使用Apache和Passenger,使用Ruby2.1)。 由于以下错误,目前我无法使用Thinking Sphinx: FATAL:bind()在my.ip上失败。地址:无法分配请求的地址 这个错误很奇怪,因为我可以毫无错误地使用命令index,但不能rebuild 我现在通过ssh直接在服务器上工作,试图解决这个问题。我必须

我有一个今天无法解决的问题。它已经发生在我身上至少一次,但我真的不记得我到底做了什么来修复它

我正在使用Capistrano3在自己的服务器上部署Rails4应用程序(使用Apache和Passenger,使用Ruby2.1)。 由于以下错误,目前我无法使用Thinking Sphinx:

FATAL:bind()在my.ip上失败。地址:无法分配请求的地址

这个错误很奇怪,因为我可以毫无错误地使用命令
index
,但不能
rebuild

我现在通过ssh直接在服务器上工作,试图解决这个问题。我必须自己启动
searchd
吗?我必须在重建过程中停止Apache吗

我甚至不知道从哪里开始

最后一句话:最奇怪的是,它是这样工作的,但我无法重新启动它。

我加入了一些配置文件

config/initializer/thinking_sphinx.rb

ThinkingSphinx::ActiveRecord::DatabaseAdapters.default =
    ThinkingSphinx::ActiveRecord::DatabaseAdapters::PostgreSQLAdapter

ThinkingSphinx::SphinxQL.functions! 
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
config/thinking\u 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

ThinkingSphinx::ActiveRecord::DatabaseAdapters.default =
    ThinkingSphinx::ActiveRecord::DatabaseAdapters::PostgreSQLAdapter

ThinkingSphinx::SphinxQL.functions! 
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/prepod.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!

提前感谢您的帮助。

我找到了解决方案。错误来自
thinking_sphinx.rb
文件。 我需要与开发时相同的配置

preprod:
  mysql41 : 9312
  enable_star: true
  min_prefix_len: 3
最后,问题来自未指定的pid文件路径,我们必须在
rake ts:rebuild
之前重新配置sphinx
rake ts:configure
。这完全解决了我在Capistrano3上的部署问题


我希望这会对其他人有所帮助。

在这次更新之后,我在重建之前关闭了
searchd
过程。我希望它能帮助别人。