• 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/

                   

        

     微信公众号

     

     

  • 相关阅读:
    基于mybatis的crud demo
    事务的隔离级别
    spring中ioc的实现
    spring中xml配置文件
    spring中AOP的实现
    mybatis框架
    基于Mapreduce的并行Dijkstra算法执行过程分析
    算法技巧:位运算 逻辑运算
    day04_09 while循环03
    day04_08 while循环02
  • 原文地址:https://www.cnblogs.com/niugang0920/p/12190484.html
Copyright © 2020-2023  润新知