我正在尝试在c9.io上设置searchkick。我已经安装了elasticsearch但是,我无法访问由端口9200上的c9.io提供给我的localhost或我的URL,以验证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...
我在想如果找不到这个问题的解决方案,我会建立一个本地环境,但我真的不想这样做。
答案 0 :(得分:0)
我在我的Mac上运行此类似的问题。正确您安装的版本不会自动作为守护程序运行,您将拒绝连接。如果您运行的是ubuntu,最好安装该软件包。弹性搜索网站上有一个易于遵循的指南。使用下面网站上的步骤再给它一个镜头。
https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-repositories.html
答案 1 :(得分: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']
希望这会有所帮助,因为C9环境中弹性搜索的端口问题没有得到很好的记录。