首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Capistrano: RSolr::Error::HTTP-404在重新索引Solr时未找到

Capistrano: RSolr::Error::HTTP-404在重新索引Solr时未找到
EN

Stack Overflow用户
提问于 2013-06-24 16:30:09
回答 1查看 2K关注 0票数 1

我没有发现任何可能有助于解决我的问题的具体例子。在我更新Rails 4和Ruby 2之前,我曾让太阳黑子宝石与Capistrano一起工作。如果能帮助处理这个错误,我们将不胜感激。

Gemfile:

代码语言:javascript
复制
gem 'sunspot_rails', :github => 'hsbt/sunspot', :branch => 'enabled-rails4'
gem 'sunspot_solr', :github => 'hsbt/sunspot', :branch => 'enabled-rails4'

.gitignore

代码语言:javascript
复制
solr/pids
solr/default

config/deploy.rb

代码语言:javascript
复制
namespace :deploy do
  task :start do ; end
  task :stop do ; end
  task :restart, :roles => :app, :except => { :no_release => true } do
    run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
  end

  desc "Migrate Database"
  task :migrate_db do
    run "cd #{current_path} && rake db:migrate RAILS_ENV=production"
    run "touch #{current_path}/tmp/restart.txt"
  end

  desc "Create Solr Directory"
  task :setup_solr_data_dir do
    run "mkdir -p #{shared_path}/solr/data"
  end
end

namespace :solr do
  desc "start solr"
  task :start, :roles => :app, :except => { :no_release => true } do
    run "cd #{current_path} && RAILS_ENV=#{rails_env} bundle exec sunspot-solr start --port=8983 --data-directory=#{shared_path}/solr/data --pid-dir=#{shared_path}/pids > /dev/null 2>&1 || true"
  end
  desc "stop solr"
  task :stop, :roles => :app, :except => { :no_release => true } do
    run ("cd #{current_path} && RAILS_ENV=#{rails_env} bundle exec sunspot-solr stop --port=8983 --data-directory=#{shared_path}/solr/data --pid-dir=#{shared_path}/pids > /dev/null 2>&1 || true")
  end
  desc "reindex the whole database"
  task :reindex, :roles => :app do
    stop
    run "rm -rf #{shared_path}/solr/data"
    start
    run "cd #{current_path} && yes | RAILS_ENV=#{rails_env} bundle exec rake sunspot:solr:reindex"
  end
end

after "deploy", "deploy:cleanup", "deploy:migrate_db",'deploy:setup_solr_data_dir', 'solr:start', 'solr:reindex'

错误消息:

代码语言:javascript
复制
  * 2013-06-24 12:19:20 executing `solr:start'
  * executing "cd /home/username/apps/MyApplication/current && RAILS_ENV=production bundle exec sunspot-solr start --port=8983 --data-directory=/home/username/apps/MyApplication/shared/solr/data --pid-dir=/home/username/apps/MyApplication/shared/pids > /dev/null 2>&1 || true"
    servers: ["0.0.0.0"]
    [0.0.0.0] executing command
    command finished in 1349ms
  * executing "cd /home/username/apps/MyApplication/current && yes | RAILS_ENV=production bundle exec rake sunspot:solr:reindex"
    servers: ["0.0.0.0"]
    [0.0.0.0] executing command
 ** [out :: 0.0.0.0] *Note: the reindex task will remove your current indexes and start from scratch.
 ** [out :: 0.0.0.0] 
 ** [out :: 0.0.0.0] If you have a large dataset, reindexing can take a very long time, possibly weeks.
 ** [out :: 0.0.0.0] 
 ** [out :: 0.0.0.0] This is not encouraged if you have anywhere near or over 1 million rows.
 ** [out :: 0.0.0.0] 
 ** [out :: 0.0.0.0] Are you sure you want to drop your indexes and completely reindex? (y/n)
 ** [out :: 0.0.0.0] 
 ** [out :: 0.0.0.0] D, [2013-06-24T12:18:59.139035 #2262] DEBUG -- :   SOLR Request (12.2ms)  [ path=#<RSolr::Client:0x00000007003988> parameters={data: <?xml version="1.0" encoding="UTF-8"?><delete><query>type:Project</query></delete>, headers: {"Content-Type"=>"text/xml"}, method: post, params: {:wt=>:ruby}, query: wt=ruby, path: update, uri: http://localhost:8983/solr/default/update?wt=ruby, open_timeout: , read_timeout: , retry_503: , retry_after_limit: } ]
 ** [out :: 0.0.0.0] 
 ** [out :: 0.0.0.0] rake aborted!
 ** [out :: 0.0.0.0] 
 ** [out :: 0.0.0.0] RSolr::Error::Http - 404 Not Found
 ** [out :: 0.0.0.0] 
 ** [out :: 0.0.0.0] Error:     NOT_FOUND
 ** [out :: 0.0.0.0] 
 ** [out :: 0.0.0.0] 
 ** [out :: 0.0.0.0] Request Data: 
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-06-24 21:07:15

看起来您的Solr服务器不响应您期望的端点。您的URL似乎是:localhost:8983/solr/default (处理程序在该URL下面是/update )。

那里有Solr端点吗?你能手动访问吗?

如果没有,我建议将开始命令更改为记录到一个文件,而不是/dev/null,并查看您得到了哪些异常。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17280401

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档