zoukankan      html  css  js  c++  java
  • Spring Boot整合Spring Data Elasticsearch 踩坑

    首先来看官网给的版本要求:

    红框这栏指的是: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:softelasticsearch-2.3.2in>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:softelasticsearch-2.3.2in>plugin install mobz/elasticsearch-head
    -> Installing mobz/elasticsearch-head...
    Trying https://github.com/mobz/elasticsearch-head/archive/master.zip ...
    Downloading ....................................................................
    ....................................终止批处理操作吗(Y/N)? y

    E:softelasticsearch-2.3.2in>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:softelasticsearch-2.3.2pluginshead

    以上完成启动es.

    访问http://localhost:9200/_plugin/head/

                   

        

     微信公众号

     

     

  • 相关阅读:
    【杂谈】压行技巧(压代码)
    【UVA】11464 Even Parity(枚举子集)
    【POJ】2373 Dividing the Path(单调队列优化dp)
    【POJ】2329 Nearest number
    【BZOJ】1833: [ZJOI2010] count 数字计数(数位dp)
    【BZOJ】2809: [Apio2012]dispatching(左偏树)
    【BZOJ】2342: [Shoi2011]双倍回文(Manacher)
    【BZOJ】1912: [Apio2010]patrol 巡逻(树的直径)
    【BZOJ】1911: [Apio2010]特别行动队(斜率优化dp)
    【BZOJ】1913: [Apio2010]signaling 信号覆盖(计算几何+计数)
  • 原文地址:https://www.cnblogs.com/niugang0920/p/12190484.html
Copyright © 2011-2022 走看看