简体   繁体   中英

How do I setup SearchKick/ElasticSearch on the NEW Nitrous.io IDE?

I am following the McKenzie Childs tutorial on making a "Movie Review" app on Ruby on Rails and he is using the searchkick gem. I am doing everything through the new Nitrous platform and everything is confusing.

I was running this command to:

rake searchkick:reindex CLASS=Movie 

and got the following error in the shell:

rake aborted!
Faraday::ConnectionFailed: Connection refused - connect(2) for "localhost"port 9200
/home/nitrous/code/12_in_12/movie_review/.bundle/gems/faraday-0.9.1/lib/faraday/adapter/net_http.rb:80:in `perform_request'
/home/nitrous/code/12_in_12/movie_review/.bundle/gems/faraday-0.9.1/lib/faraday/adapter/net_http.rb:40:in `block in call'
/home/nitrous/code/12_in_12/movie_review/.bundle/gems/faraday-0.9.1/lib/faraday/adapter/net_http.rb:87:in `with_net_http_connection'
/home/nitrous/code/12_in_12/movie_review/.bundle/gems/faraday-0.9.1/lib/faraday/adapter/net_http.rb:32:in `call'
/home/nitrous/code/12_in_12/movie_review/.bundle/gems/faraday-0.9.1/lib/faraday/rack_builder.rb:139:in `build_response'
/home/nitrous/code/12_in_12/movie_review/.bundle/gems/faraday-0.9.1/lib/faraday/connection.rb:377:in `run_request'
/home/nitrous/code/12_in_12/movie_review/.bundle/gems/elasticsearch-transport-1.0.12/lib/elasticsearch/transport/transport/http/faraday.rb:21:in `block in perform_request'
/home/nitrous/code/12_in_12/movie_review/.bundle/gems/elasticsearch-transport-1.0.12/lib/elasticsearch/transport/transport/base.rb:190:in `call'

Errno::ECONNREFUSED: Connection refused - connect(2) for "localhost" port 9200
/home/nitrous/code/12_in_12/movie_review/.bundle/gems/faraday-0.9.1/lib/faraday/adapter/net_http.rb:80:in `perform_request'

I have a feeling that its something in regards to connecting a port or starting some server. This is the first month of the new Nitrous Web IDE.

Did the tutorial yesterday and ran into the same issue(was using cloud9 IDE). I noticed I was getting that error because elastic search wasn't running. I uninstalled it using the command

sudo apt-get --purge autoremove elasticsearch

then made a fresh install.

wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.7.0.deb
sudo dpkg -i elasticsearch-1.7.0.deb

#enable on bootup
sudo update-rc.d elasticsearch defaults 95 10

### Start ElasticSearch 
sudo /etc/init.d/elasticsearch start

### Make sure service is running
curl http://localhost:9200

### Should return something like this:
# {
#  "status" : 200,
#  "name" : "Storm",
#  "version" : {
#    "number" : "1.3.1",
#    "build_hash" : "2de6dc5268c32fb49b205233c138d93aaf772015",
#    "build_timestamp" : "2014-07-28T14:45:15Z",
#    "build_snapshot" : false,
#    "lucene_version" : "4.9"
#  },
#  "tagline" : "You Know, for Search"
#}

Searchkick worked after this. You should have java installed though before installing elastic search. Hope this helps you

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM