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/

                   

        

     微信公众号

     

     

  • 相关阅读:
    当今手机和互联网故事
    回忆手机和互联网故事
    FAQ2010-2019
    LTM在服务器负载均衡中的运行模式
    如何让集团型企业进行IT集中管控,实现分支零IT运维
    两个优化Oracle数据库性能的方法解析
    简单描述Oracle数据库性能优化的几个要点
    A10 Thunder CFW融合防火墙保护企业应用安全
    全球甄选Azure云解决方案,直击云上核心痛点
    微软物联网开创”万物互联“新时代
  • 原文地址:https://www.cnblogs.com/niugang0920/p/12190484.html
Copyright © 2011-2022 走看看