Elasticsearch常见错误及解决方法
Elasticsearch常见错误及解决方法:
1、启动时候报错:Caused by: java.net.BindException: Cannot assign requested address
解决方法:打开配置文件elasticsearch.yml 将 network.host: 192.168.0.1 修改为本机IP 0.0.0.0
[2020-04-03T19:41:11,382][INFO ][o.e.n.Node ] [txvm2019] starting ...
[2020-04-03T19:41:11,649][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [txvm2019] 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:163) ~[elasticsearch-7.2.0.jar:7.2.0]at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150) ~[elasticsearch-7.2.0.jar:7.2.0]at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-7.2.0.jar:7.2.0]at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-7.2.0.jar:7.2.0]at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-7.2.0.jar:7.2.0]at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:115) ~[elasticsearch-7.2.0.jar:7.2.0]at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92) ~[elasticsearch-7.2.0.jar:7.2.0]
Caused by: org.elasticsearch.transport.BindTransportException: Failed to bind to [9300-9400]at org.elasticsearch.transport.TcpTransport.bindToPort(TcpTransport.java:389) ~[elasticsearch-7.2.0.jar:7.2.0]at org.elasticsearch.transport.TcpTransport.bindServer(TcpTransport.java:355) ~[elasticsearch-7.2.0.jar:7.2.0]at org.elasticsearch.transport.netty4.Netty4Transport.doStart(Netty4Transport.java:136) ~[?:?]at org.elasticsearch.xpack.core.security.transport.netty4.SecurityNetty4Transport.doStart(SecurityNetty4Transport.java:81) ~[?:?]at org.elasticsearch.xpack.security.transport.netty4.SecurityNetty4ServerTransport.doStart(SecurityNetty4ServerTransport.java:43) ~[?:?]at org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:59) ~[elasticsearch-7.2.0.jar:7.2.0]at org.elasticsearch.transport.TransportService.doStart(TransportService.java:230) ~[elasticsearch-7.2.0.jar:7.2.0]at org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:59) ~[elasticsearch-7.2.0.jar:7.2.0]at org.elasticsearch.node.Node.start(Node.java:662) ~[elasticsearch-7.2.0.jar:7.2.0]at org.elasticsearch.bootstrap.Bootstrap.start(Bootstrap.java:273) ~[elasticsearch-7.2.0.jar:7.2.0]at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:358) ~[elasticsearch-7.2.0.jar:7.2.0]at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) ~[elasticsearch-7.2.0.jar:7.2.0]... 6 more
Caused by: java.net.BindException: Cannot assign requested addressat 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:132) ~[?:?]at io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.java:563) ~[?:?]at io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChannelPipeline.java:1332) ~[?:?]at io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHandlerContext.java:503) ~[?:?]at io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerContext.java:488) ~[?:?]at io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:984) ~[?:?]at io.netty.channel.AbstractChannel.bind(AbstractChannel.java:259) ~[?:?]at io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:366) ~[?:?]at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163) ~[?:?]at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:405) ~[?:?]at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500) ~[?:?]at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:906) ~[?:?]at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[?:?]at java.lang.Thread.run(Thread.java:745) [?:1.8.0_121]
2、错误:max number of threads [2048] for user [elasticsearch] is too low, increase to at least [4096]
解决方法:编辑 /etc/security/limits.conf,追加以下内容;
soft nofile 65536
hard nofile 65536
[2020-04-03T19:46:34,046][INFO ][o.e.x.m.p.l.CppLogMessageHandler] [txvm2019] [controller/27023] [Main.cc@110] controller (64 bit): Version 7.2.0 (Build 65aefcbfce449b) Copyright (c) 2019 Elasticsearch BV
[2020-04-03T19:46:34,526][DEBUG][o.e.a.ActionModule ] [txvm2019] Using REST wrapper from plugin org.elasticsearch.xpack.security.Security
[2020-04-03T19:46:34,867][INFO ][o.e.d.DiscoveryModule ] [txvm2019] using discovery type [zen] and seed hosts providers [settings]
[2020-04-03T19:46:35,768][INFO ][o.e.n.Node ] [txvm2019] initialized
[2020-04-03T19:46:35,768][INFO ][o.e.n.Node ] [txvm2019] starting ...
[2020-04-03T19:46:35,923][INFO ][o.e.t.TransportService ] [txvm2019] publish_address {172.17.0.1:9300}, bound_addresses {0.0.0.0:9300}
[2020-04-03T19:46:35,932][INFO ][o.e.b.BootstrapChecks ] [txvm2019] bound or publishing to a non-loopback address, enforcing bootstrap checks
ERROR: [2] bootstrap checks failed
[1]: max number of threads [2048] for user [elasticsearch] is too low, increase to at least [4096]
[2]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured
[2020-04-03T19:46:35,978][INFO ][o.e.n.Node ] [txvm2019] stopping ...
[2020-04-03T19:46:36,012][INFO ][o.e.n.Node ] [txvm2019] stopped
[2020-04-03T19:46:36,012][INFO ][o.e.n.Node ] [txvm2019] closing ...
[2020-04-03T19:46:36,032][INFO ][o.e.n.Node ] [txvm2019] closed
3、错误:cluster.initial_master_nodes] must be configured
解决方法:
在elasticsearch的config目录下,修改elasticsearch.yml配置文件,将下面的配置加入到该配置文件中:
ip替换host1等,多节点请添加多个ip地址,单节点可写按默认来
#配置以下三者,最少其一
#[discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes]
cluster.initial_master_nodes: ["node-1"] #这里的node-1为node-name配置的值
[2020-04-03T19:51:41,427][DEBUG][o.e.a.ActionModule ] [txvm2019] Using REST wrapper from plugin org.elasticsearch.xpack.security.Security
[2020-04-03T19:51:41,799][INFO ][o.e.d.DiscoveryModule ] [txvm2019] using discovery type [zen] and seed hosts providers [settings]
[2020-04-03T19:51:42,729][INFO ][o.e.n.Node ] [txvm2019] initialized
[2020-04-03T19:51:42,729][INFO ][o.e.n.Node ] [txvm2019] starting ...
[2020-04-03T19:51:42,890][INFO ][o.e.t.TransportService ] [txvm2019] publish_address {172.17.0.1:9300}, bound_addresses {0.0.0.0:9300}
[2020-04-03T19:51:42,900][INFO ][o.e.b.BootstrapChecks ] [txvm2019] bound or publishing to a non-loopback address, enforcing bootstrap checks
ERROR: [1] bootstrap checks failed
[1]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured
4、删除数据时错误:"reason":"Wildcard expressions or all indices are not allowed"
解决方法:
删除所有索引时
curl -X DELETE "http://localhost:9200/*"
或者
curl -X DELETE "localhost:9200/_all"
为了防止误删除,
可以设置 elasticsearch.yml属性 action.destructive_requires_name为true,
禁止使用通配符或_all删除索引,
必须使用名称或别名才能删除该索引。
修改为false即可删除所有
action.destructive_requires_name: false
{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Wildcard expressions or all indices are not allowed"}],"type":"illegal_argument_exception","reason":"Wildcard expressions or all indices are not allowed"},"status":400}
5、创建索引错误:The mapping definition cannot be nested under a type [_doc] unless include_type_name is set to true.
解决方法:
修改为:
{"settings": {"number_of_shards": 3,"number_of_replicas": 2},"mappings": {"properties": {"commodity_id": {"type": "long"},"commodity_name": {"type": "text"},"picture_url": {"type": "text"},"price": {"type": "double"}}}
}
出现这个的原因是,elasticsearch7默认不在支持指定索引类型,默认索引类型是_doc,如果想改变,则配置include_type_name: true 即可(这个没有测试,官方文档说的,无论是否可行,建议不要这么做,因为elasticsearch8后就不在提供该字段)。
{"error": {"root_cause": [ {"type": "illegal_argument_exception","reason": "The mapping definition cannot be nested under a type [_doc] unless include_type_name is set to true."}],"type": "illegal_argument_exception","reason": "The mapping definition cannot be nested under a type [_doc] unless include_type_name is set to true."},"status": 400
}
6、聚合查询时错误:"Fielddata is disabled on text fields by default. ...."
解决方法:
经过查找验证后发现出现该错误是因为5.x之后,Elasticsearch对排序、聚合所依据的字段用单独的数据结构(fielddata)缓存到内存里了,但是在text字段上默认是禁用的,这样做的目的是为了节省内存空间。所以如果需要进行聚合操作,需要单独开启。执行以下代码(city为相关text的字段名称):
PUT myindex/_mapping
{"properties": {"city": { "type": "text","fielddata": true}}
}
"caused_by": {"type": "illegal_argument_exception","reason": "Fielddata is disabled on text fields by default. Set fielddata=true on [city] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead.","caused_by": {"type": "illegal_argument_exception","reason": "Fielddata is disabled on text fields by default. Set fielddata=true on [city] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead."}
}
Elasticsearch常见错误及解决方法相关推荐
- 稳定性专题 | Spring Boot 常见错误及解决方法
导读 『StabilityGuide』是阿里多位阿里技术工程师共同发起的稳定性领域的知识库开源项目,涵盖性能压测.故障演练.JVM.应用容器.服务框架.流量调度.监控.诊断等多个技术领域,以更结构化的 ...
- Android 源码编译及常见错误及解决方法
Android 源码编译及常见错误及解决方法 参考文章: (1)Android 源码编译及常见错误及解决方法 (2)https://www.cnblogs.com/kyyblabla/p/360393 ...
- kafka集群中常见错误的解决方法:kafka.common.KafkaException: Should not set log end offset on partition
kafka集群中常见错误的解决方法:kafka.common.KafkaException: Should not set log end offset on partition 参考文章: (1)k ...
- cmd常见错误及解决方法
cmd常见错误及解决方法 参考文章: (1)cmd常见错误及解决方法 (2)https://www.cnblogs.com/Raodi/p/11612816.html 备忘一下.
- TensorFlow 常见错误与解决方法——长期不定时更新
TensorFlow 常见错误与解决方法--长期不定时更新 参考文章: (1)TensorFlow 常见错误与解决方法--长期不定时更新 (2)https://www.cnblogs.com/seni ...
- Zookeeper之启动常见错误及解决方法
Zookeeper之启动常见错误及解决方法 参考文章: (1)Zookeeper之启动常见错误及解决方法 (2)https://www.cnblogs.com/jpfss/p/11510716.htm ...
- jmeter常见错误及解决方法
jmeter常见错误及解决方法 参考文章: (1)jmeter常见错误及解决方法 (2)https://www.cnblogs.com/jane4321/p/11013042.html 备忘一下.
- centos linux 系统日常管理4 scp,rsync,md5sum,sha1sum,strace ,find Rsync 常见错误及解决方法 第十七节课...
centos linux 系统日常管理4 scp,rsync,md5sum,sha1sum,strace ,find Rsync 常见错误及解决方法 第十七节课 rsync可以增量同步,scp不行 ...
- springboot jar中没有主清单属性_Spring Boot 常见错误及解决方法
导读 Spring Boot 作为 Java 生态中最流行的开发框架,意味着被数以万计的开发者所使用.下面根据我们自身遇到的问题,加上用户提供的一些反馈,来大致梳理下 Spring Boot 的常见错 ...
最新文章
- 机器学习模型五花八门不知道怎么选?这份指南告诉你
- Nginx搭建静态网站
- Linux中xml导入数据库,XML数据库 BaseX
- 前端学习(588):console面板简介与交互式命令
- 专访福建移动林志云: 5G使能,运营商全面进入数字化转型之路
- matlab2c使用c++实现matlab函数系列教程-tanh函数
- 使用Maven+Nexus+Jenkins+Svn+Tomcat+Sonar搭建持续集成环境(一)
- hdu2147PN图的画法
- OPPO R9sPlus怎么刷机 OPPO R9sPlus的刷机教程 OPPO R9sPlus完美解除账号锁
- 2021年中国气体分离设备行业运营情况分析:气体分离及液化设备产量14.85万台[图]
- linux计划任务crontab每分钟执行(详细操作)
- Ps cc 2014 安装与错误修改
- Blender建模汇总
- 计算机四级大一能考吗,大一新生不让报考四六级?凭什么啊!!!
- linux不能打开流的函数为,详解 4 种电脑提示“无法访问函数不正确”的解决方法...
- Android基础篇-DrawerLayout 实现侧滑
- 数据安全--3--数据安全5A之授权
- http 错误 404 - 文件或目录未找到.php,IIS不支持ASP,HTTP 错误 404 – 文件或目录未找到的解决办法...
- 揭密巴西Banrisul银行网站遭遇5小时劫持的原因
- 使用frp+MobaXterm进行ssh远程连接报错及解决办法
热门文章
- linux mysql 怎么启动客服端_脚本之家教你linux如何启动mysql服务教程图解 linux启动mysql服务命令是什么...
- 使用phpexcel将excel表格的导入导出
- 如何批量新建文件夹?
- 粤语录音实时转写软件有哪些?
- 2021 ICPC Southeastern Europe Regional Contest(更新至六题)
- 工作一周年快乐_30周年快乐Excel!
- 传输指令ssh,sftp,scp
- 君澜与桐乡乌镇黄金水岸大酒店签署委托管理协议
- ECALL,BCALL,ICALL
- Web前端学习win11