Thinking Sphinx启动失败 - “无法启动searchd守护进程”

8

我可以帮助您进行翻译,以下是需要翻译的内容:

我尝试在我的服务器上启动Thinking Sphinx,但它无法正常工作。

我已经执行了以下操作:

$ rake thinking_sphinx:index && rake thinking_sphinx:start

我得到了:

Generating Configuration to /vol/www/apps/ror_tutorial/releases/20120202111730/config/development.sphinx.conf
Sphinx 2.0.3-release (r3043)
Copyright (c) 2001-2011, Andrew Aksyonoff
Copyright (c) 2008-2011, Sphinx Technologies Inc (http://sphinxsearch.com)

using config file '/vol/www/apps/ror_tutorial/releases/20120202111730/config/development.sphinx.conf'...
indexing index 'micropost_core'...
WARNING: collect_hits: mem_limit=0 kb too low, increasing to 13568 kb
collected 0 docs, 0.0 MB
total 0 docs, 0 bytes
total 0.008 sec, 0 bytes/sec, 0.00 docs/sec
skipping non-plain index 'micropost'...
indexing index 'user_core'...
WARNING: collect_hits: mem_limit=0 kb too low, increasing to 13568 kb
collected 0 docs, 0.0 MB
total 0 docs, 0 bytes
total 0.012 sec, 0 bytes/sec, 0.00 docs/sec
skipping non-plain index 'user'...
total 2 reads, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg
total 10 writes, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg
Failed to start searchd daemon. Check /vol/www/apps/ror_tutorial/releases/20120202111730/log/searchd.log.
Failed to start searchd daemon. Check /vol/www/apps/ror_tutorial/releases/20120202111730/log/searchd.log
Be sure to run thinking_sphinx:index before thinking_sphinx:start

我的服务器系统是Ubuntu 10.04。同时,在我的本地机器(Mac OS X)上它也运行得很完美。
我的sphinx.yml文件:
development:
  bin_path: "/usr/local/bin"
  searchd_binary_name: searchd
  indexer_binary_name: indexer

test:
  bin_path: "/usr/local/bin"
  searchd_binary_name: searchd
  indexer_binary_name: indexer

config/deploy.rb

#Add RVM's lib directory to the load path.
$:.unshift(File.expand_path('./lib', ENV['rvm_path']))

#Load RVM's capistrano plugin.    
require "rvm/capistrano"
require 'bundler/capistrano'
#require 'thinking_sphinx/deploy/capistrano'

set :rvm_ruby_string, '1.9.3-head'                                            #This is current version of ruby which is uses by RVM. To get version print: $ rvm list 
set :rvm_type, :root                                                          #Don't use system-wide RVM, use my user, which name is root.

set :user, "root"                                                             #If you log into your server with a different user name than you are logged into your local machine with, you’ll need to tell Capistrano about that user name.
set :rails_env, "production"

set :application, "ror_tutorial"
set :deploy_to, "/vol/www/apps/#{application}"

set :scm, :git
set :repository,  "git://github.com/Loremaster/sample_app.git"
set :branch, "master"
set :deploy_via, :remote_cache
default_run_options[:pty] = true                                              #Must be set for the password prompt from git to work#Keep cash of repository locally and with ney deploy get only changes.


server "188.127.224.136", :app,                                               # This may be the same as your `Web` server
                          :web,
                          :db, :primary => true                               # This is where Rails migrations will run


# If you are using Passenger mod_rails uncomment this:
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
end


desc "Prepare system"
  task :prepare_system, :roles => :app do
    run "cd #{current_path} && bundle install --without development test && bundle install --deployment"
  end

  after "deploy:update_code", :prepare_system
3个回答

16

问题已解决。我在后台运行了Sphinx进程,所以我只需要将其杀死:

$ ps -efa | grep sphinx
root     23823     1  0 14:12 ?        00:00:00 searchd --pidfile --config /vol/www/apps/ror_tutorial/releases/20120202111104/config/production.sphinx.conf
root     27069 20413  0 14:49 pts/1    00:00:00 grep sphinx
$ kill 23823 

然后我启动了Sphinx:

$ rake ts:start RAILS_ENV=production
Started successfully (pid 27097).

嗨,当我执行rake thinking_sphinx:start时,遇到了以下问题...我收到了以下错误消息:无法启动searchd守护进程。请检查/home/user/newsvn/alumnicell/log/searchd.log。 请确保在执行thinking_sphinx:start之前运行thinking_sphinx:index。 我该怎么办? - NJF
1
我认为你应该在stackoverflow上再提一个问题。 - ExiRe
或者,您可以使用“pgrep searchd”来查找正在运行的进程。 - Stone
我尝试了你的解决方案,但对我没有用。以下是我在Stack Overflow上发布的内容:http://stackoverflow.com/questions/36124694/failed-to-start-searchd-daemon-thinkingsphinxconnectionerror - Zia Qamar

5

看起来 init 已经启动了一个绑定到 9312 端口的 searchd 实例

有几种解决方案:

  1. 杀掉系统实例的 searchdsudo service sphinxsearch stop
  2. 修改 config/sphinx.yml 并告诉 Sphinx 在生产中使用不同的端口。(如果您使用 TS 3.x,则为config/thinking_sphinx.yml
  3. 配置您的服务器在系统启动时不启动 searchd。在 Ubuntu 14.04 上,您可以通过编辑 /etc/defaults/sphinxsearch 并设置 START=no 来实现。

我们的服务器运行 Ubuntu,并且我从 Sphinx 网站提供的Debian 包安装了 Sphinx。


0
在我的情况下,我检查了这个文件:../yourdirectory/log/searchd.log,并且里面写着:/usr/local/var/data/binlog.002: No such file or directory。那么我只需要这样做:

touch /usr/local/var/data/binlog.002

完成了,可以正常工作了。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接