首先來看官網給的版本要求:
紅框這欄指的是:Elasticsearch安裝版本(windows安裝版本或Linux按照版本)
最新因為項目需要elasticsearch,采用今天搞了好久,項目啟動就報如下錯誤:
org.elasticsearch.transport.NodeDisconnectedException: [][127.0.0.1:9300][cluster:monitor/nodes/liveness] disconnected
找了好久以為是配置問題,最后終於明白原來是版本不統一。
我的項目用的spring boot 1.5.x
所以安裝了elasticsearch-2.3.2.zip
解壓進入bin目錄雙擊elasticsearch.bat。啟動服務。
在瀏覽器輸入http://localhost:9200/,返回json字符串證明啟動成功。
###################################################################
在springboot中對elasticsearch配置是默認有支持的。
如配置:
#默認 9300 是 Java 客戶端的端口。9200 是支持 Restful HTTP 的接口。 # 集群節點地址列表,用逗號分隔。如果沒有指定,就啟動一個客戶端節點 spring.data.elasticsearch.cluster-nodes=127.0.0.1:9300 spring.data.elasticsearch.cluster-name=elasticsearch spring.data.elasticsearch.repositories.enabled=true |
以前就緒,操作就類似於Spring-Data-JPA,具體見官方文檔http://projects.spring.io/spring-data-elasticsearch/
安裝Head插件
E:\soft\elasticsearch-2.3.2\bin>plugin install mobz/elasticsearch-head
-> Installing mobz/elasticsearch-head...
Trying https://github.com/mobz/elasticsearch-head/archive/master.zip ...
ERROR: failed to download out of all possible locations..., use --verbose to get
detailed information
E:\soft\elasticsearch-2.3.2\bin>plugin install mobz/elasticsearch-head
-> Installing mobz/elasticsearch-head...
Trying https://github.com/mobz/elasticsearch-head/archive/master.zip ...
Downloading ....................................................................
....................................終止批處理操作嗎(Y/N)? y
E:\soft\elasticsearch-2.3.2\bin>plugin install mobz/elasticsearch-head
-> Installing mobz/elasticsearch-head...
Trying https://github.com/mobz/elasticsearch-head/archive/master.zip ...
Downloading ....................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................DONE
Verifying https://github.com/mobz/elasticsearch-head/archive/master.zip checksum
s if available ...
NOTE: Unable to verify checksum for downloaded plugin (unable to find .sha1 or .
md5 file to verify)
Installed head into E:\soft\elasticsearch-2.3.2\plugins\head
以上完成啟動es.
訪問http://localhost:9200/_plugin/head/
微信公眾號