Elasticsearch使用java读取数据报错NoNodeAvailableException: None of the configured nodes are available: [127.0.0.1:9300]
对于这个问题,大部分人出现在这个地方:
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]的更多相关文章
- 解决ES报错NoNodeAvailableException[None of the configured nodes are available:问题
elasticSearch的错误 NoNodeAvailableException[None of the configured nodes are available: [{#transport#- ...
- 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 ...
- ElasticSearch java客户端更新时出现的错误:NoNodeAvailableException[None of the configured nodes are available
下午尝试 用ElasticSearch 的java客户端去做数据检索工作,测试了一下批量更新,代码如下: public static void bulkUpdateGoods(List<Goo ...
- (转)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 ...
- 解决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 ...
- Exception in thread "main" NoNodeAvailableException[None of the configured nodes are available
连接elasticsearch已经成功,但是会报以下错误,字面意思是节点不可用这样 Exception in thread "main" NoNodeAvailableExcept ...
- NoNodeAvailableException[None of the configured nodes are available:
elasticSearch的错误 NoNodeAvailableException[None of the configured nodes are available: [{#transport#- ...
- elasticsearch 使用tcp 访问NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{Yk0WjtKbQXqYCJSDFRYlRA}
默认的 elasticsearch.yml 端口是9200,是给tcp提供的.如果想使用 自带的 TransportClient 需要配置为 tcp 的9300端口.配置方式为: 在/config/ ...
- 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 ...
随机推荐
- (转)String,StringBuffer与StringBuilder的区别??
String 字符串常量StringBuffer 字符串变量(线程安全)StringBuilder 字符串变量(非线程安全) 简要的说, String 类型和 StringBuffer 类型的主要性能 ...
- hibernate多表查询
一对多进行查询(用懒加载的模式) 查找区域所对应的街道: Dao: public Qu selQu(String dno){ Session session=HibernateSessionFacto ...
- 【BZOJ 1146】[CTSC2008]网络管理Network
树剖+树状数组套线段树O(nlogn^3)(我打的),有一种更加优秀的算法是O(nlogn^2)的就是直接树状数组套线段树欧拉序(并不快),或者是用主席树维护原始的树的信息,同时用树状数组套线段树维护 ...
- NAS星云链 入门之从零开发第一个DAPP
应该有很多小伙伴和我一样,一直想去入手学习区块链,但是总无从下手,有些概念感觉理解了,有感觉没理解.其实这都是“没实践”的锅. 所谓看十遍不如想一遍,想一遍不如做一遍.这不最近星云链nebulas正有 ...
- Codeforces Round #524 (Div. 2) B. Margarite and the best present
B. Margarite and the best present 题目链接:https://codeforces.com/contest/1080/problem/B 题意: 给出一个数列:an=( ...
- Create a conditional DNS forwarder on our domain.com to Amazon default DNS provider
Backgroup: I have an AWS Managed Active Directory(domain.com). I created a DHCP options set to my d ...
- [06] 盒模型 + auto 居中 + 垂直合并
1.盒模型 盒子模型有两种,分别是 ie 盒子模型和标准 w3c 盒子模型. 标准(W3C)模型中:CSS中的宽(width) = 内容 (content)的宽 CSS中的宽(width) = 内容( ...
- 我自己的python开发环境
1.开发工具 eclipse 所有的版本下载: https://www.eclipse.org/downloads/index-packages.php , 我下载的是比较低的版本:https://w ...
- L2-001. 紧急救援---(Dijkstra,记录路径)
https://www.patest.cn/contests/gplt/L2-001 L2-001. 紧急救援 时间限制 200 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 ...
- noip2014 提高组
T1 生活大爆炸版 石头剪刀布 题目传送门 就是道模拟题咯 #include<algorithm> #include<cstdio> #include<cstring&g ...