gpt4 book ai didi

ruby-on-rails - 如何在新的 Nitrous.io IDE 上设置 SearchKick/ElasticSearch?

转载 作者:数据小太阳 更新时间:2023-10-29 07:28:09 28 4
gpt4 key购买 nike

我正在关注 McKenzie Childs 关于在 Ruby on Rails 上制作“电影评论”应用程序的教程,他正在使用 searchkick gem。我正在通过新的 Nitrous 平台做所有事情,但一切都很困惑。

我运行这条命令是为了:

rake searchkick:reindex CLASS=Movie 

并在 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 的第一个月。

最佳答案

昨天做了教程并遇到了同样的问题(使用的是 cloud9 IDE)。我注意到我收到了那个错误,因为 Elasticsearch 没有运行。我使用命令卸载了它

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 在此之后起作用。在安装 Elasticsearch 之前,你应该安装 java。希望对你有帮助

关于ruby-on-rails - 如何在新的 Nitrous.io IDE 上设置 SearchKick/ElasticSearch?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31477463/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com