ElasticSearch异常归纳(能力工场小马哥)
- 异常1: can not run elasticsearch as root
[WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [node-2] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:125) ~[elasticsearch-5.1.2.jar:5.1.2]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:112) ~[elasticsearch-5.1.2.jar:5.1.2]
at org.elasticsearch.cli.SettingCommand.execute(SettingCommand.java:54) ~[elasticsearch-5.1.2.jar:5.1.2]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:122) ~[elasticsearch-5.1.2.jar:5.1.2]
at org.elasticsearch.cli.Command.main(Command.java:88) ~[elasticsearch-5.1.2.jar:5.1.2]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:89) ~[elasticsearch-5.1.2.jar:5.1.2]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:82) ~[elasticsearch-5.1.2.jar:5.1.2]
Caused by: java.lang.RuntimeException: can not run elasticsearch as root
at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:100) ~[elasticsearch-5.1.2.jar:5.1.2]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:176) ~[elasticsearch-5.1.2.jar:5.1.2]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:306) ~[elasticsearch-5.1.2.jar:5.1.2]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:121) ~[elasticsearch-5.1.2.jar:5.1.2]
... 6 more
- 异常1解决方式:
在es-linux环境中,不允许使用root用户运行ElasticSearch,所以添加一个新的普通用户就可以了(linux命令如下)
groupadd es -- 创建一个用户组(我使用的es作为组名)
useradd -g es es -- 创建一个用户(我使用es作为用户名,并加入到es组里面)
passwd es -- 为刚刚创建的es用户添加密码
su es -- 切换到es用户下
$ElasticSearch_Home/bin/elasticsearch --启动ElasticSearch
- 异常2: failed to obtain lock on ...
Caused by: java.io.IOException: failed to obtain lock on /bigdata/env/elasticsearch512/data/nodes/0
at org.elasticsearch.env.NodeEnvironment.<init>(NodeEnvironment.java:238) ~[elasticsearch-5.1.2.jar:5.1.2]
at org.elasticsearch.node.Node.<init>(Node.java:249) ~[elasticsearch-5.1.2.jar:5.1.2]
at org.elasticsearch.node.Node.<init>(Node.java:229) ~[elasticsearch-5.1.2.jar:5.1.2]
at org.elasticsearch.bootstrap.Bootstrap$6.<init>(Bootstrap.java:214) ~[elasticsearch-5.1.2.jar:5.1.2]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:214) ~[elasticsearch-5.1.2.jar:5.1.2]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:306) ~[elasticsearch-5.1.2.jar:5.1.2]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:121) ~[elasticsearch-5.1.2.jar:5.1.2]
... 6 more
Caused by: java.nio.file.AccessDeniedException: /bigdata/env/elasticsearch512/data/nodes/0/node.lock
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84) ~[?:?]
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102) ~[?:?]
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107) ~[?:?]
at sun.nio.fs.UnixFileSystemProvider.newFileChannel(UnixFileSystemProvider.java:177) ~[?:?]
at java.nio.channels.FileChannel.open(FileChannel.java:287) ~[?:1.8.0_181]
at java.nio.channels.FileChannel.open(FileChannel.java:335) ~[?:1.8.0_181]
at org.apache.lucene.store.NativeFSLockFactory.obtainFSLock(NativeFSLockFactory.java:113) ~[lucene-core-6.3.0.jar:6.3.0 a66a44513ee8191e25b477372094bfa846450316 - shalin - 2016-11-02 19:47:11]
at org.apache.lucene.store.FSLockFactory.obtainLock(FSLockFactory.java:41) ~[lucene-core-6.3.0.jar:6.3.0 a66a44513ee8191e25b477372094bfa846450316 - shalin - 2016-11-02 19:47:11]
at org.apache.lucene.store.BaseDirectory.obtainLock(BaseDirectory.java:45) ~[lucene-core-6.3.0.jar:6.3.0 a66a44513ee8191e25b477372094bfa846450316 - shalin - 2016-11-02 19:47:11]
at org.elasticsearch.env.NodeEnvironment.<init>(NodeEnvironment.java:225) ~[elasticsearch-5.1.2.jar:5.1.2]
at org.elasticsearch.node.Node.<init>(Node.java:249) ~[elasticsearch-5.1.2.jar:5.1.2]
at org.elasticsearch.node.Node.<init>(Node.java:229) ~[elasticsearch-5.1.2.jar:5.1.2]
at org.elasticsearch.bootstrap.Bootstrap$6.<init>(Bootstrap.java:214) ~[elasticsearch-5.1.2.jar:5.1.2]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:214) ~[elasticsearch-5.1.2.jar:5.1.2]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:306) ~[elasticsearch-5.1.2.jar:5.1.2]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:121) ~[elasticsearch-5.1.2.jar:5.1.2]
... 6 more
- 异常2解决方式:
由于上面使用root创建的es目录,导致ElasticSearch安装目录的所属用户和所属组都是root,现在使用es用户去启动elasticsearch命令,导致没有权限获取node.lock
最直接的解决方式: 将es所有目录更改所属用户到es下就可以了
1 chown -R es:es ./elasticsearch512
2 --(elasticsearch512是我对es安装目录的命名)
3 --(-R选项: 将elasticsearch512目录及内部所有子目录都更改所属用户)
4 --(es:es 代表: 用户:用户组)
- 异常3: BindTransportException[Failed to bind to [9300-9400]]
[WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [node-2] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: BindTransportException[Failed to bind to [9300-9400]]; nested: BindException[Cannot assign requested address];
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:125) ~[elasticsearch-5.1.2.jar:5.1.2]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:112) ~[elasticsearch-5.1.2.jar:5.1.2]
at org.elasticsearch.cli.SettingCommand.execute(SettingCommand.java:54) ~[elasticsearch-5.1.2.jar:5.1.2]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:122) ~[elasticsearch-5.1.2.jar:5.1.2]
at org.elasticsearch.cli.Command.main(Command.java:88) ~[elasticsearch-5.1.2.jar:5.1.2]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:89) ~[elasticsearch-5.1.2.jar:5.1.2]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:82) ~[elasticsearch-5.1.2.jar:5.1.2]
Caused by: org.elasticsearch.transport.BindTransportException: Failed to bind to [9300-9400]
at org.elasticsearch.transport.TcpTransport.bindToPort(TcpTransport.java:636) ~[elasticsearch-5.1.2.jar:5.1.2]
at org.elasticsearch.transport.TcpTransport.bindServer(TcpTransport.java:601) ~[elasticsearch-5.1.2.jar:5.1.2]
at org.elasticsearch.transport.netty4.Netty4Transport.doStart(Netty4Transport.java:182) ~[?:?]
at org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:69) ~[elasticsearch-5.1.2.jar:5.1.2]
at org.elasticsearch.transport.TransportService.doStart(TransportService.java:188) ~[elasticsearch-5.1.2.jar:5.1.2]
at org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:69) ~[elasticsearch-5.1.2.jar:5.1.2]
at org.elasticsearch.node.Node.start(Node.java:577) ~[elasticsearch-5.1.2.jar:5.1.2]
at org.elasticsearch.bootstrap.Bootstrap.start(Bootstrap.java:234) ~[elasticsearch-5.1.2.jar:5.1.2]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:308) ~[elasticsearch-5.1.2.jar:5.1.2]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:121) ~[elasticsearch-5.1.2.jar:5.1.2]
... 6 more
Caused by: java.net.BindException: Cannot assign requested address
at sun.nio.ch.Net.bind0(Native Method) ~[?:?]
at sun.nio.ch.Net.bind(Net.java:433) ~[?:?]
at sun.nio.ch.Net.bind(Net.java:425) ~[?:?]
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223) ~[?:?]
at io.netty.channel.socket.nio.NioServerSocketChannel.doBind(NioServerSocketChannel.java:127) ~[?:?]
at io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.java:554) ~[?:?]
at io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChannelPipeline.java:1258) ~[?:?]
at io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHandlerContext.java:512) ~[?:?]
at io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerContext.java:497) ~[?:?]
at io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:980) ~[?:?]
at io.netty.channel.AbstractChannel.bind(AbstractChannel.java:250) ~[?:?]
at io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:363) ~[?:?]
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163) ~[?:?]
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:418) ~[?:?]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:454) ~[?:?]
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:873) ~[?:?]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_181]
- 异常3解决方式
network.host: 0.0.0.0 -- 绑定IP到本机
- 启动失败1:
ERROR: bootstrap checks failed
max file descriptors [65535] for elasticsearch process is too low, increase to at least [65536]
- 启动失败1解决方式:
原因: elasticsearch 能够打开的最大句柄数为65536,这个数量不能满足最低65536的要求,更改一下可以linux的配置文件解决
vi /etc/security/limits.conf root soft nofile 65535
root hard nofile 65535
* soft nofile --将所有用户能够打开的最大句柄数都修改为65536
* hard nofile
- 启动失败2:
原因: 直接翻译就是虚拟内存65530太低
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
- 启动失败2解决方式:
vi /etc/sysctl.conf
vm.max_map_count=655360
按Esc-->按Shift+:-->输入wq 保存退出
sysctl -p -- 命令意思: 从指定的文件加载系统参数,如不指定即从/etc/sysctl.conf中加载
- 从节点加入集群失败1: failed to send join request to master
[INFO ][o.e.d.z.ZenDiscovery ] [node-2] failed to send join request to master [{node-1}{7Wy1WO3fQZmBDwcDQRDh2Q}{kqmtZtjiSuC79opYfj1jzg}{172.31.87.193}{172.31.87.193:9300}],
reason [RemoteTransportException[[node-1][172.31.87.193:9300][internal:discovery/zen/join]];
nested: IllegalArgumentException[can't add node {node-2}{7Wy1WO3fQZmBDwcDQRDh2Q}{HW7YhCEBRbGti1ra7WXTYg}{172.31.87.192}{172.31.87.192:9300},
found existing node {node-1}{7Wy1WO3fQZmBDwcDQRDh2Q}{kqmtZtjiSuC79opYfj1jzg}{172.31.87.193}{172.31.87.193:9300} with the same id but is a different node instance]; ]
- 从节点加入集群失败1解决方式:
出错原因: 该节点(node2)的安装文件都是妥妥的在主节点(node1)拷贝过来的,所以,数据文件(data文件夹下面的数据也拷贝过来了),按照抛错意思,可能是里面保存了node1的id等信息导致了冲突
rm -rf $ElasticSearch_home/data/* --删除data目录下面的从Node1考来的所有数据
在node2节点上重启elasticsearch
在node1主节点上会发现如下状态信息:
[node-1] added {{node-2}{Qg2j8WLgQpy10mzs-r42Eg}{85mIKdCRRG-BAb42g8YhDg}{172.31.87.192}{172.31.87.192:9300},}, reason: zen-disco-node-join[{node-2}{Qg2j8WLgQpy10mzs-r42Eg}{85mIKdCRRG-BAb42g8YhDg}{172.31.87.192}{172.31.87.192:9300}]
[2018-08-04T23:40:25,006][INFO ][o.e.c.r.a.AllocationService] [node-1] Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[megacorp][4]] ...]).
JavaAPI开发异常1: NoNodeAvailableException: None of the configured nodes are available
Exception in thread "main" NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{9zZ22lWuQpKTZlroNRCrNg}{47.105.116.201}{47.105.116.201:9300}]]
at org.elasticsearch.client.transport.TransportClientNodesService.ensureNodesAreAvailable(TransportClientNodesService.java:328)
at org.elasticsearch.client.transport.TransportClientNodesService.execute(TransportClientNodesService.java:226)
at org.elasticsearch.client.transport.TransportProxyClient.execute(TransportProxyClient.java:59)
at org.elasticsearch.client.transport.TransportClient.doExecute(TransportClient.java:345)
at org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:403)
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:80)
at org.elasticsearch.action.ActionRequestBuilder.execute(ActionRequestBuilder.java:54)
at org.elasticsearch.action.ActionRequestBuilder.get(ActionRequestBuilder.java:62)
at com.nengli51.es.data.Demo.main(Demo.java:23)
异常原因: 通过 TransportClient 连接集群时,需要配置 cluster.name 信息,出错原因可能是 使用Settings.EMPTY选项,或者使用了错误的Setting配置,导致连接集群失败
Settings settings = Settings.builder().put("cluster.name", "estest").build();
TransportClient client = new PreBuiltTransportClient(settings); //这里是连接配置了cluster.name的集群的连接方式,如果你的ElasticSearch集群使用的默认集群名字(压根就没设置elasticsearch)那么直接使用下面的
* TransportClient client = new PreBuiltTransportClient(Settings.EMPTY);
ElasticSearch异常归纳(能力工场小马哥)的更多相关文章
- 通过Shell命令与JavaAPI读取ElasticSearch数据 (能力工场小马哥)
主要内容: 通过JavaAPI和Shell命令两种方式操作ES集群 集群环境: 两个 1,未配置集群名称的单节点(模拟学习测试环境); 2,两个节点的集群(模拟正常生产环境). JDK8+Elasti ...
- Maven异常: No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK解决(能力工场小马哥)
问题描述: No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JD ...
- 关于SimHash去重原理的理解(能力工场小马哥)
阅读目录 1. SimHash与传统hash函数的区别 2. SimHash算法思想 3. SimHash流程实现 4. SimHash签名距离计算 5. SimHash存储和索引 6. SimHas ...
- 使用Eclipse的几个必须掌握的快捷方式(能力工场小马哥收集)
“工若善其事,必先利其器”,感谢Eclipse,她 使我们阅读一个大工程的代码更加容易,在阅读的过程中,我发现掌握几个Eclipse的快捷键会使阅读体验更加流畅,写出来与诸君分享,欢迎补充. 1. C ...
- docker启动elasticsearch异常Failed to create node environment(解决)
异常说是创建节点环境失败,操作/usr/share/elasticsearch/data/nodes的IO错误,尝试给此目录添加读写权限后,依旧没什么**用,灵机一动是不是挂载目录没有权限导致的? c ...
- 使用VMware10虚拟机安装Linux系统(能力工场)
作为IT从业人员,我们经常使用到Linux系统,但是实际开发过程我们通常在Windows平台操作,为了满足工作需要,这个时候我们通常在windows平台安装虚拟机,并在其上建立linux系统,这样就极 ...
- Java 异常归纳总结
1.异常的分类 1) Checked exception: 这类异常都是Exception的子类 .异常的向上抛出机制进行处理,如果子类可能产生A异常,那么在父类中也必须throws A异常.可能导致 ...
- elasticsearch 拼音检索能力研究
gitchennan/elasticsearch-analysis-lc-pinyin 配置参数少,功能满足需求. 对应版本 elasticsearch2.3.2 对应 elasticsearch-a ...
- 解决linux下root运行Elasticsearch异常
如果以root身份运行将会出现以下问题 root@yxjay:/opt/elasticsearch-2.3.5/bin# ./elasticsearchException in thread &quo ...
随机推荐
- 小程序navigator点击有时候会闪一下
<navigator hover-class="none">
- USB Mass Storage communication with PassThrough / more than 64K data length
http://social.msdn.microsoft.com/Forums/windowsdesktop/zh-CN/35620a05-43be-46a8-8cbe-846bc8295d85/us ...
- HDU2838 Cow Sorting 树状数组 区间求和加逆序数的应用
这题目意思非常easy,就是给你一个数组,然后让你又一次排好序,排序有要求的,每次仅仅能交换两个元素的位置,交换须要一个代价 就是两个元素之和,问你把数组重小到大排好最少须要多少代价 可能一開始想不到 ...
- TIF、JPG图片手动添加地理坐标的方法
题目:为TIF.JPG图片添加地理坐标/平面直角坐标. 图片来源:GOOGLE EARTH.(当然也可以是其他知道四角点坐标的图片) 截图工具:GEtscreen(此软件截图时可以自动生成图片四角点坐 ...
- (原)用WebBrowser浏览Office Web Apps Server,除去“下载”按钮
对,没错,如果你按关键字找到这篇随笔了,相信一定知道背景,以及我所说的是什么. 上一段子代码. private void timerHideButton_Tick(object sender, Eve ...
- C++ 全排列函数 std::next_permutation与std::prev_permutation
C++ STL中提供了std::next_permutation与std::prev_permutation可以获取数字或者是字符的全排列,其中std::next_permutation提供升序.st ...
- 【PAT Advanced Level】1011. World Cup Betting (20)
简单模拟题,遍历一遍即可.考察输入输出. #include <iostream> #include <string> #include <stdio.h> #inc ...
- iOS开发-UI基础Demo
现在更多的学习资料都是xCode4.X的,发现xCode6.1还是很多东西,如果有正在学习iOS开发的可以通过Demo简单了解下iOS的UI开发~ 1.新建单视图文件: 2.新建项目名称,语言选择OC ...
- 简单使用CSS3实现炫酷读者墙效果
读者墙,在很多网站上都有,没有遇到过的,可以参考度娘:读者墙http://www.baidu.com/s?wd=%B6%C1%D5%DF%C7%BD 使用基础的Html和CSS写出雏形 需要一提的是头 ...
- ECMAScript5之Object学习笔记(一)
随着IE的逐步追赶,目前到IE11已经能够很好的支持ECMAScript5标准了,其他的现代浏览器像firefox,chrome,opera就更不用说了. 再加上nodejs使得javascript在 ...