如何在NEW Nitrous.io IDE上设置SearchKick / ElasticSearch?

问题描述:

我正在关注在Ruby on Rails上制作电影评论应用程序的McKenzie Childs教程,他正在使用searchkick宝石。我正在通过新的Nitrous平台做一切,一切都令人困惑。

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.

我正在运行这个命令:

rake searchkick:reindex CLASS=Movie 

并获得以下内容shell中的错误:

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'



我有一种感觉,它有关于连接端口或启动一些服务器的东西。这是新的Nitrous Web IDE的第一个月。

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.

昨天的教程遇到了同样的问题(正在使用cloud9 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

然后进行全新安装。

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此后工作。安装弹性搜索之前,应该安装java。希望这有助于您

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