Christian Benseler
Christian Benseler

Reputation: 8065

Can't connect to Sunspot server in Ubuntu server

I followed the steps in https://github.com/outoftime/sunspot/wiki/Adding-Sunspot-search-to-Rails-in-5-minutes-or-less to install & set up Sunspot search in Rails in a Mac OS and it is ok.
In a Ubuntu server, there's connection refused error.
When I run

rake sunspot:solr:start

and the proccess starts. The file sunspot-solr-development.pid is created in /tmp/pids. But when I try to reindex

rake sunspot:reindex
...
rake aborted!
Connection refused - connect(2)

I tried to run the commands with sudo and gave permission 777 to the project files, but there's still error. Rails 3.0.8.

Any ideas?

Upvotes: 0

Views: 1584

Answers (2)

Anno2001
Anno2001

Reputation: 1363

Make sure soLr is running on the correct port: 8983 for production etc

ubuntu@host:~/rails-project$ cat config/sunspot.yml 
production:
  solr:
    hostname: localhost
    port: 8983
    log_level: WARNING

development:
  solr:
    hostname: localhost
    port: 8982
    log_level: INFO

bundle exec rake sunspot:solr:start RAILS_ENV=production

Upvotes: 1

outoftime
outoftime

Reputation: 2200

Try rake sunspot:solr:run -- this runs it in the foreground which will expose any errors happening at startup.

FWIW, I don't recommend using the bundled Solr instance in production environments, if that's what you're doing. Better to use Ubuntu's package manager or install one of the distributions provided by Solr.

Upvotes: 2

Related Questions