对于这个问题,大部分人出现在这个地方:

Client client = new TransportClient(settings).addTransportAddress(new InetSocketTransportAddress("172.16.2.13", 9300));​

问题在于前面初始化settings时给cluster设置了个新的名字,如:Settings settings = ImmutableSettings.settingsBuilder().put("cluster.name", "tonsonmiao").build();

因为如果设置clustername后,容器会在添加transportaddress时,从集群名为tonsonmiao里查找是否有要设置的这个IP和端口,此时肯定找不到,所以会报这个错。

但是我今天又遇到这个问题,而在此之前一切正常,也就是说并不会因为代码的错误导致这个问题出现,这几天修改了下网关,可以访问这台服务器,于是我觉得可能是网络的变动,导致es出了问题,进入服务器查看:

[root@es elasticsearch-1.4.2]# ps -eaf | grep java
root 8782 8752 0 05:53 pts/1 00:00:00 grep java
root 27251 1 1 2015 ? 1-10:15:49 /usr/bin/java -Xms256m -Xmx1g -Xss256k -Djava.awt.headless=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -XX:+DisableExplicitGC -Dfile.encoding=UTF-8 -Delasticsearch -Des.path.home=/opt/elasticsearch-1.4.2 -cp :/opt/elasticsearch-1.4.2/lib/elasticsearch-1.4.2.jar:/opt/elasticsearch-1.4.2/lib/*:/opt/elasticsearch-1.4.2/lib/sigar/* org.elasticsearch.bootstrap.Elasticsearch [root@es elasticsearch-1.4.2]# netstat -anp | grep 9300
tcp 0 0 10.18.7.97:9300 10.17.3.96:51633 SYN_RECV -
tcp 0 0 10.18.7.97:9300 10.17.3.96:51635 SYN_RECV -
tcp 0 0 :::9300 :::* LISTEN 27251/java
tcp 0 0 ::ffff:10.18.7.97:41035 ::ffff:10.18.7.97:9300 ESTABLISHED 27251/java
tcp 0 0 ::ffff:10.18.7.97:9300 ::ffff:10.18.7.97:41030 ESTABLISHED 27251/java
tcp 0 0 ::ffff:10.18.7.97:41033 ::ffff:10.18.7.97:9300 ESTABLISHED 27251/java
tcp 0 0 ::ffff:10.18.7.97:41037 ::ffff:10.18.7.97:9300 ESTABLISHED 27251/java
tcp 0 0 ::ffff:10.18.7.97:41036 ::ffff:10.18.7.97:9300 ESTABLISHED 27251/java
tcp 0 0 ::ffff:10.18.7.97:41026 ::ffff:10.18.7.97:9300 ESTABLISHED 27251/java
tcp 0 0 ::ffff:10.18.7.97:9300 ::ffff:10.18.7.97:41025 ESTABLISHED 27251/java

 

可以看到es监听的ip地址发生了变化,对于多网卡的情况下,es默认会绑定其中任意一张网卡,如果es中间出现问题自动修复,那么会随机修改绑定网卡,导致节点被t出集群,曾经我在某银行系统,就遇到这个问题,某几个节点不定时的被t出集群。

对于这个问题的解决,需要修改es配置:

# Set the bind address specifically (IPv4 or IPv6):
#
network.bind_host: 10.18.7.97 # Set the address other nodes will use to communicate with this node. If not
# set, it is automatically derived. It must point to an actual IP address.
#
network.publish_host: 10.18.7.97 # Set both 'bind_host' and 'publish_host':
#
network.host: 10.18.7.97

强制指明ip地址即可

Elasticsearch使用java读取数据报错NoNodeAvailableException: None of the configured nodes are available: [127.0.0.1:9300]的更多相关文章

  1. 解决ES报错NoNodeAvailableException[None of the configured nodes are available:问题

    elasticSearch的错误 NoNodeAvailableException[None of the configured nodes are available: [{#transport#- ...

  2. NoNodeAvailableException[None of the configured nodes are available:[.127.0.0.1}{127.0.0.1:9300]

    我在springboot 集成 elasticsearch,启动springboot测试创建索引,建立索引的时候报 : NoNodeAvailableException[None of the con ...

  3. ElasticSearch java客户端更新时出现的错误:NoNodeAvailableException[None of the configured nodes are available

    下午尝试 用ElasticSearch  的java客户端去做数据检索工作,测试了一下批量更新,代码如下: public static void bulkUpdateGoods(List<Goo ...

  4. (转)Elasticsearch NoNodeAvailableException None of the configured nodes are available

    问题背景:将es部署到内网中两台服务器,其Ip地址分别为:192.111.222.5,192.111.222.1(部署方式完全一样,是将192.111.222.1服务器上es整个部署包,拷贝到了192 ...

  5. 解决Spring Boot(2.1.3.RELEASE)整合spring-data-elasticsearch3.1.5.RELEASE报NoNodeAvailableException[None of the configured nodes are available

    Spring Boot(2.1.3.RELEASE)整合spring-data-elasticsearch3.1.5.RELEASE报NoNodeAvailableException[None of ...

  6. Exception in thread "main" NoNodeAvailableException[None of the configured nodes are available

    连接elasticsearch已经成功,但是会报以下错误,字面意思是节点不可用这样 Exception in thread "main" NoNodeAvailableExcept ...

  7. NoNodeAvailableException[None of the configured nodes are available:

    elasticSearch的错误 NoNodeAvailableException[None of the configured nodes are available: [{#transport#- ...

  8. elasticsearch 使用tcp 访问NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{Yk0WjtKbQXqYCJSDFRYlRA}

    默认的 elasticsearch.yml 端口是9200,是给tcp提供的.如果想使用 自带的  TransportClient 需要配置为 tcp 的9300端口.配置方式为: 在/config/ ...

  9. Elasticsearch 9300无法访问,客户端出现NoNodeAvailableException[None of the configured nodes are available:  [{#transport#‐1}{exvgJLR‐RlCNMJy‐hzKtnA}

    1.  进入容器 docker exec ‐it ID /bin/bash 2. 拷贝配置文件到宿主机 docker cp  ID:/usr/share/elasticsearch/config/el ...

随机推荐

  1. BZOJ4444 SCOI2015国旗计划(贪心+倍增)

    链上问题是一个经典的贪心.于是考虑破环成链,将链倍长.求出每个线段右边能作为后继的最远线段,然后倍增即可. #include<iostream> #include<cstdio> ...

  2. BZOJ3456 城市规划 【多项式求逆】

    题目链接 BZOJ3456 题解 之前我们用分治\(ntt\)在\(O(nlog^2n)\)的复杂度下做了这题,今天我们使用多项式求逆 设\(f_n\)表示\(n\)个点带标号无向连通图数 设\(g_ ...

  3. 雪碧图background-position的rem用法

    background的雪碧图配合rem就正常写即可,要加上background-size,大小为sprites的原图尺寸,宽高为一帧的尺寸.例如: .player{ width: 2.32rem; / ...

  4. 【CF edu 30 D. Merge Sort】

    time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standa ...

  5. dns服务 很多问题,后续再研究

    慕课网:http://www.imooc.com/video/5220 参考:http://jingyan.baidu.com/article/870c6fc32c028eb03fe4be30.htm ...

  6. Spring validation 后端校验【转】

    本文来自 下一秒升华 的CSDN 博客 ,全文地址请点击:https://blog.csdn.net/u013815546/article/details/77248003?utm_source=co ...

  7. 数据仓库3级范式(3NF)基础

    一.引言 最近在整理理大数据模式下的数据仓库数据模型,资料来自互联网和读过的数据仓库理论和实践相关. 二.3NF (1)1NF-无重复的列 数据库表的每一列都是不可分割的基本数据项,同一列中不能有多个 ...

  8. im4java学习---阅读documentation文档

    Utilities----im提供的一些工具类 ①.读取图片文件信息---Info类 我们之前的做法: op.format("width:%w,height:%h,path:%d%f,siz ...

  9. peity(jQuery 插件可以将元素内容转换为一个小的 <svg> 饼图,圆环图,条形图和折线图)

    API地址:https://www.awesomes.cn/repo/benpickles/peity 实例效果

  10. bzoj3382 [Usaco2004 Open]Cave Cows 3 洞穴里的牛之三

    传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=3382 [题解] 套路题. 首先我们会发现曼哈顿距离不好处理,难道要写kdtree??? (k ...