我没有找到任何可能有助于解决我的问题的具体例子。在我更新到Rails 4和Ruby 2之前,我之前有过使用Capistrano的太阳黑子宝石。任何帮助排序这个错误都将非常感激。
的Gemfile:
gem 'sunspot_rails', :github => 'hsbt/sunspot', :branch => 'enabled-rails4'
gem 'sunspot_solr', :github => 'hsbt/sunspot', :branch => 'enabled-rails4'
的.gitignore
solr/pids
solr/default
配置/ deploy.rb
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'
错误消息:
* 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:
答案 0 :(得分:0)
看起来您的Solr服务器没有响应您期望的端点。您的网址似乎是: localhost:8983 / solr / default (处理程序在/下更新)。
那里有Solr端点吗?你可以手动访问吗?
如果没有,我建议您更改启动命令以登录文件而不是 / dev / null 并查看您获得的例外情况。