Today debug an existing project error,
[Faraday::connectionfailed] Connection Refused-connect (2) {:host=>"localhost",:p ort=>"9200 ",:p rotocol=>"http"-Connect (2)
To find out that I haven't installed Elasticsearch.
Find the official website download page https://www.elastic.co/guide/en/elasticsearch/reference/current/_installation.html
See the first sentence to find that you need to install Java first:
Elasticsearch requires at least Java 7. Specifically as of this writing, it's recommended, and the Oracle JDK version 1.8.0_25. Java installation varies from platform to platform so we won ' t go into those details here.
So I looked at the Ubuntu installation Java Guide, and saw the next StackOverflow in the Great God experience stickers
Https://help.ubuntu.com/community/Java
Http://stackoverflow.com/questions/16263556/installing-java-7-on-ubuntu
(1) Start to install Java using the steps in the Great God experience sticker
sudo add-apt-repository ppa:webupd8team/javasudo apt-get updatesudo apt-get Install Oracle-java7-installer
(2) After the Java view, you can continue to install Elasticsearch.
The steps are provided in the official website download page:
Https://www.elastic.co/guide/en/elasticsearch/reference/current/_installation.html
Java-versionecho $JAVA _home
Curl-l-O https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-1.7.1.tar.gz
TAR-XVF elasticsearch-1.7.1.tar.gz
CD Elasticsearch-1.7.1/bin
./elasticsearch
If everything goes well, you should see a bunch of the messages that look like below:
17,218][info][node] [New Goblin] version[1.7.1], pid[2085], build[5c03844/2014-02-25t15:52: 53Z] [2014-03-13 13:42:17,219][info][node] [New Goblin] initializing ... [2014-03-13 13:42:17,223][info][plugins] [New Goblin] loaded [], sites [ ] [2014-03-13 13:42:19,831][info][node] [New Goblin] initialized[2014-03-13 13:42:19,832][info][node] [New Goblin] starting ... [2014-03-13 13:42:19,958][info][transport] [New Goblin] bound_address {inet[/0:0:0:0:0:0:0:0:9300]}, publish_address {inet[/192.168.8.112:9300]}[2014-03-13 13:42:23,030][info][cluster.service] [New Goblin] new_master [New goblin][rwmtgj3dqouz2r6zfl9v4g][ MWUBUNTU1][INET[/192.168.8.112:9300]], reason:zen-disco-Join (elected_as_master) [2014-03-13 13:42:23,100][info][discovery] [New Goblin] elasticsearch/rwmtgj3dqouz2r6zfl9v4g[2014-03-13 13:42:23,125][info][http] [New Goblin] bound_address {inet[/0:0:0:0:0:0:0:0:9200]}, publish_address {inet[/192.168.8.112:9200]}[2014-03-13 13:42:23,629][info][gateway] [New Goblin] recovered [1] indices into cluster_state[2014-03-13 13:42:23,630][info][node] [New Goblin] Started
(3) also install the relevant gems for Rails integration
Https://github.com/elastic/elasticsearch-rails
Gem Install Elasticsearch-model Elasticsearch-rails
The path of Elasticsearch exploration