0

我正在尝试在 c9.io 上设置 searchkick。我已经安装了 elasticsearch,但是我无法访问 localhost 或我的 URL,这是 c9.io 在端口 9200 上提供给我的,以验证 searchkick 是否正常工作。有没有人遇到过这个问题?

我已经验证弹性搜索正在工作。

$ /home/ubuntu/.linuxbrew/bin/brew info elasticsearch
elasticsearch: stable 1.7.1, HEAD
Distributed real-time search & analytics engine for the cloud
https://www.elastic.co/products/elasticsearch
/home/ubuntu/.linuxbrew/Cellar/elasticsearch/1.7.1 (33 files, 30M) *
  Built from source
From: https://github.com//homebrew/blob/master/Library/Formula/elasticsearch.rb
==> Caveats
Data:    /home/ubuntu/.linuxbrew/var/elasticsearch/elasticsearch_ubuntu/
Logs:    /home/ubuntu/.linuxbrew/var/log/elasticsearch/elasticsearch_ubuntu.log
Plugins: /home/ubuntu/.linuxbrew/var/lib/elasticsearch/plugins/
Config:  /home/ubuntu/.linuxbrew/etc/elasticsearch/

当我运行 rake 时,这是我收到的错误消息。

$rake searchkick:reindex CLASS=Account
rake aborted!
Faraday::ConnectionFailed: Connection refused - connect(2) for "localhost" port 9200
/usr/local/rvm/gems/ruby-2.1.5@rails4/gems/faraday-0.9.1/lib/faraday/adapter/net_http.rb:80:in `perform_request'
/usr/local/rvm/gems/ruby-2.1.5@rails4/gems/faraday-0.9.1/lib/faraday/adapter/net_http.rb:40:in `block in call'
/usr/local/rvm/gems/ruby-2.1.5@rails4/gems/faraday-0.9.1/lib/faraday/adapter/net_http.rb:87:in `with_net_http_connection'
/usr/local/rvm/gems/ruby-2.1.5@rails4/gems/faraday-0.9.1/lib/faraday/adapter/net_http.rb:32:in `call'
/usr/local/rvm/gems/ruby-2.1.5@rails4/gems/faraday-0.9.1/lib/faraday/rack_builder.rb:139:in `build_response'
/usr/local/rvm/gems/ruby-2.1.5@rails4/gems/faraday-0.9.1/lib/faraday/connection.rb:377:in `run_request'
ect...

我在想如果我找不到解决这个问题的方法,我会建立一个本地环境,但我真的不想这样做。

4

2 回答 2

0

我在我的 Mac 上运行它时遇到了类似的问题。正弦您安装的版本不会自动作为守护进程运行,您将被拒绝连接。如果您正在运行 ubuntu,最好安装该软件包。elasticsearch 网站上有一个易于遵循的指南。使用下面网站上的步骤,再试一次。

https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-repositories.html

于 2015-09-25T15:57:01.063 回答
0

好吧,我还没有安装 searchkick,但我一直在 C9 环境中研究 ElasticSearch。

这些是我所做的步骤:

wget https://download.elasticsearch.org/elasticsearch/release/org/elasticsearch/distribution/deb/elasticsearch/2.2.0/elasticsearch-2.2.0.deb

sudo dpkg -i elasticsearch-2.2.0.deb

sudo update-rc.d elasticsearch defaults 95 10

sudo /etc/init.d/elasticsearch start

然后我修改了 elasticsearch.yml 文件以包含 c9.io 支持的端口(例如 8081 或 8082):取消注释文件中的主机端口并修改此端口号。

sudo nano /etc/elasticsearch/elasticsearch.yml  

最后制作一个elasticsearch初始化程序(config/initializes/elasticsearch.rb)并包含c9 IP:

"Your Model to be indexed".__elasticsearch__.client = Elasticsearch::Client.new host: ENV['IP']

希望这会有所帮助,因为 Elasticsearch 在 C9 环境下的端口问题没有得到很好的记录。

于 2016-02-09T10:47:08.980 回答