近期接手生产elasticsearch运维,为更好的掌握elasticsearch的相关知识,也是在测试环境先搭建了ek(elasticsearch-kibana)集群用于学习,在初期安装部署中也是遇到一系列elasticsearch相关问题,为此对遇到的问题及解决办法进行整理,后续还会对此块内容进行更新补充。
1、elasticsearch是搜索引擎
elasticsearch在搜索引擎数据领域长期排名第一,elasticsearch内核基于lucene构建,支持全文搜索。elasticsearch支持全文搜索,但在很多项目组中常被用于精确查询加速,查询条件多、速度快且可以任意组合,有些甚至常用elasticsearch做redis、hbase等数据库的二级索引。
2、elasticsearch是数据库
elasticsearch不属于关系型数据库,其内部更新采用乐观锁、也无关系型数据库的acid事务特性。elasticsearch使用json格式承载数据模型,更类似文档数据库,相较于mongodb,其更擅长基于查询搜索的分析型数据库。
1、全文检索
对比传统的solr,elasticsearch也是基于lucene实现,是对lucene进行二次封装,对lucene调用进行了优化,但elasticsearch更重量级,在分布式场景中表现更优。
elasticsearch支持文件的上传、下载,可根据关键字搜索出相关文件。
2、应用查询
elasticsearch擅长查询,这得益于其倒排索引核心算法,相较于基于b-tree类型数据库查询性能更优,尤其是在数据量很大时,检索效率非常明显。
3、大数据应用
在大数据领域,elasticsearch应用非常广泛,是大数据对外提供查询重要组成部分。elasticsearch在大数据分析领域提供基于列示存储数据聚合、所支持的聚合功能甚多、且性能优异。
4、日志检索
作为elk(elasticsearch-logstash-kibana)日志检索三剑客之一,elasticsearch起步于全文检索,加之其分布式架构特性,尤其适用海量日志快速检索。
5、监控领域
》elasticsearch利用其倒排索引核心算法,加之日益强大的elastic stack生态圈,elasticsearch也是支持众多时序数据场景,且性能不输众多时序数据库,所以使用elasticsearch相关监控也是很好的选择。
6、人工智能-机器学习
今年来ai人工智能风头强劲,尤其是chatgpt推出以来,人工智能更是在众多领域广泛应用,elasticsearch从6.3版本推出机器学习的功能,随着elasticsearch版本的发展,其机器学习功能也更加强大,能高效提高检测数据质量,减少人力成本。
本部分总结了elasticsearch常见启动故障及相应解决办法,后续会逐步更新本部分内容。
1、java.nio.file.accessdeniedexception故障及处理办法
**问题原因:
由于权限问题导致启动失败,原因是我在elasticsearch/conf/elasticsearch.yml中设置了path.data和path.logs,es启动建议使用普通用户启动,root权限过大,初期未给path.data和path.logs设置普通用户属组,导致启动失败。
解决办法:
给path.data和path.logs设置普通用户属组。
报错日志:
[root@node1 bin]# su es
[es@node1 bin]$ cd /usr/local/elasticsearch/bin
[es@node1 bin]$ ./elasticsearch
warning: usage of java_home is deprecated, use es_java_home
warning: usage of java_home is deprecated, use es_java_home
./elasticsearch: line 70: -xms8g -xmx8g: command not found
exception in thread "main" java.lang.nullpointerexception
at java.base/java.util.objects.requirenonnull(objects.java:221)
at java.base/java.util.stream.collectors.lambda$uniqkeysmapaccumulator$1(collectors.java:178)
at java.base/java.util.stream.reduceops$3reducingsink.accept(reduceops.java:169)
at java.base/java.util.collections$unmodifiablemap$unmodifiableentryset.lambda$entryconsumer$0(collections.java:1574)
at java.base/java.util.hashmap$entryspliterator.foreachremaining(hashmap.java:1746)
at java.base/java.util.collections$unmodifiablemap$unmodifiableentryset$unmodifiableentrysetspliterator.foreachremaining(collections.java:1599)
at java.base/java.util.stream.abstractpipeline.copyinto(abstractpipeline.java:484)
at java.base/java.util.stream.abstractpipeline.wrapandcopyinto(abstractpipeline.java:474)
at java.base/java.util.stream.reduceops$reduceop.evaluatesequential(reduceops.java:913)
at java.base/java.util.stream.abstractpipeline.evaluate(abstractpipeline.java:234)
at java.base/java.util.stream.referencepipeline.collect(referencepipeline.java:578)
at org.elasticsearch.tools.launchers.jvmoptionsparser.substituteplaceholders(jvmoptionsparser.java:185)
at org.elasticsearch.tools.launchers.jvmoptionsparser.jvmoptions(jvmoptionsparser.java:133)
at org.elasticsearch.tools.launchers.jvmoptionsparser.main(jvmoptionsparser.java:86)
[es@node1 bin]$
[es@node1 bin]$
[es@node1 bin]$
[es@node1 bin]$ ./elasticsearch
warning: usage of java_home is deprecated, use es_java_home
warning: usage of java_home is deprecated, use es_java_home
openjdk 64-bit server vm warning: option useconcmarksweepgc was deprecated in version 9.0 and will likely be removed in a future release.
2023-04-19 13:57:10,610 main error unable to create file /elk/logs/elk-cluster_deprecation.log java.io.ioexception: permission denied
at java.base/java.io.unixfilesystem.createfileexclusively(native method)
at java.base/java.io.file.createnewfile(file.java:1024)
at org.apache.logging.log4j.core.appender.rolling.rollingfilemanager$rollingfilemanagerfactory.createmanager(rollingfilemanager.java:733)
at org.apache.logging.log4j.core.appender.rolling.rollingfilemanager$rollingfilemanagerfactory.createmanager(rollingfilemanager.java:716)
at org.apache.logging.log4j.core.appender.abstractmanager.getmanager(abstractmanager.java:114)
at org.apache.logging.log4j.core.appender.outputstreammanager.getmanager(outputstreammanager.java:100)
at org.apache.logging.log4j.core.appender.rolling.rollingfilemanager.getfilemanager(rollingfilemanager.java:217)
at org.apache.logging.log4j.core.appender.rollingfileappender$builder.build(rollingfileappender.java:146)
at org.apache.logging.log4j.core.appender.rollingfileappender$builder.build(rollingfileappender.java:62)
at org.apache.logging.log4j.core.config.plugins.util.pluginbuilder.build(pluginbuilder.java:122)
at org.apache.logging.log4j.core.config.abstractconfiguration.createpluginobject(abstractconfiguration.java:1120)
at org.apache.logging.log4j.core.config.abstractconfiguration.createconfiguration(abstractconfiguration.java:1045)
at org.apache.logging.log4j.core.config.abstractconfiguration.createconfiguration(abstractconfiguration.java:1037)
at org.apache.logging.log4j.core.config.abstractconfiguration.doconfigure(abstractconfiguration.java:651)
at org.apache.logging.log4j.core.config.abstractconfiguration.initialize(abstractconfiguration.java:247)
at org.apache.logging.log4j.core.config.abstractconfiguration.start(abstractconfiguration.java:293)
at org.apache.logging.log4j.core.loggercontext.setconfiguration(loggercontext.java:626)
at org.apache.logging.log4j.core.loggercontext.start(loggercontext.java:302)
at org.elasticsearch.common.logging.logconfigurator.configure(logconfigurator.java:222)
at org.elasticsearch.common.logging.logconfigurator.configure(logconfigurator.java:118)
at org.elasticsearch.bootstrap.bootstrap.init(bootstrap.java:369)
at org.elasticsearch.bootstrap.elasticsearch.init(elasticsearch.java:169)
at org.elasticsearch.bootstrap.elasticsearch.execute(elasticsearch.java:160)
at org.elasticsearch.cli.environmentawarecommand.execute(environmentawarecommand.java:77)
at org.elasticsearch.cli.command.mainwithouterrorhandling(command.java:112)
at org.elasticsearch.cli.command.main(command.java:77)
at org.elasticsearch.bootstrap.elasticsearch.main(elasticsearch.java:125)
at org.elasticsearch.bootstrap.elasticsearch.main(elasticsearch.java:80)
2023-04-19 13:57:10,614 main error could not create plugin of type class org.apache.logging.log4j.core.appender.rollingfileappender for element rollingfile: java.lang.illegalstateexception: managerfactory [org.apache.logging.log4j.core.appender.rolling.rollingfilemanager$rollingfilemanagerfactory@3fa2213] unable to create manager for [/elk/logs/elk-cluster_deprecation.log] with data [org.apache.logging.log4j.core.appender.rolling.rollingfilemanager$factorydata@3e7634b9[pattern=/elk/logs/elk-cluster_deprecation-%i.log.gz, append=true, bufferedio=true, buffersize=8192, policy=compositetriggeringpolicy(policies=[sizebasedtriggeringpolicy(size=1073741824)]), strategy=defaultrolloverstrategy(min=1, max=4, usemax=true), advertiseuri=null, layout=[%d{iso8601}][%-5p][%-25c{1.}] [%node_name] [%product_origin]%marker %m%n, filepermissions=null, fileowner=null]] java.lang.illegalstateexception: managerfactory [org.apache.logging.log4j.core.appender.rolling.rollingfilemanager$rollingfilemanagerfactory@3fa2213] unable to create manager for [/elk/logs/elk-cluster_deprecation.log] with data [org.apache.logging.log4j.core.appender.rolling.rollingfilemanager$factorydata@3e7634b9[pattern=/elk/logs/elk-cluster_deprecation-%i.log.gz, append=true, bufferedio=true, buffersize=8192, policy=compositetriggeringpolicy(policies=[sizebasedtriggeringpolicy(size=1073741824)]), strategy=defaultrolloverstrategy(min=1, max=4, usemax=true), advertiseuri=null, layout=[%d{iso8601}][%-5p][%-25c{1.}] [%node_name] [%product_origin]%marker %m%n, filepermissions=null, fileowner=null]]
at org.apache.logging.log4j.core.appender.abstractmanager.getmanager(abstractmanager.java:116)
at org.apache.logging.log4j.core.appender.outputstreammanager.getmanager(outputstreammanager.java:100)
at org.apache.logging.log4j.core.appender.rolling.rollingfilemanager.getfilemanager(rollingfilemanager.java:217)
at org.apache.logging.log4j.core.appender.rollingfileappender$builder.build(rollingfileappender.java:146)
at org.apache.logging.log4j.core.appender.rollingfileappender$builder.build(rollingfileappender.java:62)
at org.apache.logging.log4j.core.config.plugins.util.pluginbuilder.build(pluginbuilder.java:122)
at org.apache.logging.log4j.core.config.abstractconfiguration.createpluginobject(abstractconfiguration.java:1120)
at org.apache.logging.log4j.core.config.abstractconfiguration.createconfiguration(abstractconfiguration.java:1045)
at org.apache.logging.log4j.core.config.abstractconfiguration.createconfiguration(abstractconfiguration.java:1037)
at org.apache.logging.log4j.core.config.abstractconfiguration.doconfigure(abstractconfiguration.java:651)
at org.apache.logging.log4j.core.config.abstractconfiguration.initialize(abstractconfiguration.java:247)
at org.apache.logging.log4j.core.config.abstractconfiguration.start(abstractconfiguration.java:293)
at org.apache.logging.log4j.core.loggercontext.setconfiguration(loggercontext.java:626)
at org.apache.logging.log4j.core.loggercontext.start(loggercontext.java:302)
at org.elasticsearch.common.logging.logconfigurator.configure(logconfigurator.java:222)
at org.elasticsearch.common.logging.logconfigurator.configure(logconfigurator.java:118)
at org.elasticsearch.bootstrap.bootstrap.init(bootstrap.java:369)
at org.elasticsearch.bootstrap.elasticsearch.init(elasticsearch.java:169)
at org.elasticsearch.bootstrap.elasticsearch.execute(elasticsearch.java:160)
at org.elasticsearch.cli.environmentawarecommand.execute(environmentawarecommand.java:77)
at org.elasticsearch.cli.command.mainwithouterrorhandling(command.java:112)
at org.elasticsearch.cli.command.main(command.java:77)
at org.elasticsearch.bootstrap.elasticsearch.main(elasticsearch.java:125)
at org.elasticsearch.bootstrap.elasticsearch.main(elasticsearch.java:80)
2023-04-19 13:57:10,615 main error unable to invoke factory method in class org.apache.logging.log4j.core.appender.rollingfileappender for element rollingfile: java.lang.illegalstateexception: no factory method found for class org.apache.logging.log4j.core.appender.rollingfileappender java.lang.illegalstateexception: no factory method found for class org.apache.logging.log4j.core.appender.rollingfileappender
at org.apache.logging.log4j.core.config.plugins.util.pluginbuilder.findfactorymethod(pluginbuilder.java:236)
at org.apache.logging.log4j.core.config.plugins.util.pluginbuilder.build(pluginbuilder.java:134)
at org.apache.logging.log4j.core.config.abstractconfiguration.createpluginobject(abstractconfiguration.java:1120)
at org.apache.logging.log4j.core.config.abstractconfiguration.createconfiguration(abstractconfiguration.java:1045)
at org.apache.logging.log4j.core.config.abstractconfiguration.createconfiguration(abstractconfiguration.java:1037)
at org.apache.logging.log4j.core.config.abstractconfiguration.doconfigure(abstractconfiguration.java:651)
at org.apache.logging.log4j.core.config.abstractconfiguration.initialize(abstractconfiguration.java:247)
at org.apache.logging.log4j.core.config.abstractconfiguration.start(abstractconfiguration.java:293)
at org.apache.logging.log4j.core.loggercontext.setconfiguration(loggercontext.java:626)
at org.apache.logging.log4j.core.loggercontext.start(loggercontext.java:302)
at org.elasticsearch.common.logging.logconfigurator.configure(logconfigurator.java:222)
at org.elasticsearch.common.logging.logconfigurator.configure(logconfigurator.java:118)
at org.elasticsearch.bootstrap.bootstrap.init(bootstrap.java:369)
at org.elasticsearch.bootstrap.elasticsearch.init(elasticsearch.java:169)
at org.elasticsearch.bootstrap.elasticsearch.execute(elasticsearch.java:160)
at org.elasticsearch.cli.environmentawarecommand.execute(environmentawarecommand.java:77)
at org.elasticsearch.cli.command.mainwithouterrorhandling(command.java:112)
at org.elasticsearch.cli.command.main(command.java:77)
at org.elasticsearch.bootstrap.elasticsearch.main(elasticsearch.java:125)
at org.elasticsearch.bootstrap.elasticsearch.main(elasticsearch.java:80)
2023-04-19 13:57:10,627 main error unable to create file /elk/logs/elk-cluster_server.json java.io.ioexception: permission denied
at java.base/java.io.unixfilesystem.createfileexclusively(native method)
at java.base/java.io.file.createnewfile(file.java:1024)
at org.apache.logging.log4j.core.appender.rolling.rollingfilemanager$rollingfilemanagerfactory.createmanager(rollingfilemanager.java:733)
at org.apache.logging.log4j.core.appender.rolling.rollingfilemanager$rollingfilemanagerfactory.createmanager(rollingfilemanager.java:716)
at org.apache.logging.log4j.core.appender.abstractmanager.getmanager(abstractmanager.java:114)
at org.apache.logging.log4j.core.appender.outputstreammanager.getmanager(outputstreammanager.java:100)
at org.apache.logging.log4j.core.appender.rolling.rollingfilemanager.getfilemanager(rollingfilemanager.java:217)
at org.apache.logging.log4j.core.appender.rollingfileappender$builder.build(rollingfileappender.java:146)
at org.apache.logging.log4j.core.appender.rollingfileappender$builder.build(rollingfileappender.java:62)
at org.apache.logging.log4j.core.config.plugins.util.pluginbuilder.build(pluginbuilder.java:122)
at org.apache.logging.log4j.core.config.abstractconfiguration.createpluginobject(abstractconfiguration.java:1120)
at org.apache.logging.log4j.core.config.abstractconfiguration.createconfiguration(abstractconfiguration.java:1045)
at org.apache.logging.log4j.core.config.abstractconfiguration.createconfiguration(abstractconfiguration.java:1037)
at org.apache.logging.log4j.core.config.abstractconfiguration.doconfigure(abstractconfiguration.java:651)
at org.apache.logging.log4j.core.config.abstractconfiguration.initialize(abstractconfiguration.java:247)
at org.apache.logging.log4j.core.config.abstractconfiguration.start(abstractconfiguration.java:293)
at org.apache.logging.log4j.core.loggercontext.setconfiguration(loggercontext.java:626)
at org.apache.logging.log4j.core.loggercontext.start(loggercontext.java:302)
at org.elasticsearch.common.logging.logconfigurator.configure(logconfigurator.java:222)
at org.elasticsearch.common.logging.logconfigurator.configure(logconfigurator.java:118)
at org.elasticsearch.bootstrap.bootstrap.init(bootstrap.java:369)
at org.elasticsearch.bootstrap.elasticsearch.init(elasticsearch.java:169)
at org.elasticsearch.bootstrap.elasticsearch.execute(elasticsearch.java:160)
at org.elasticsearch.cli.environmentawarecommand.execute(environmentawarecommand.java:77)
at org.elasticsearch.cli.command.mainwithouterrorhandling(command.java:112)
at org.elasticsearch.cli.command.main(command.java:77)
at org.elasticsearch.bootstrap.elasticsearch.main(elasticsearch.java:125)
at org.elasticsearch.bootstrap.elasticsearch.main(elasticsearch.java:80)
2、bindtransportexception故障及处理办法
问题原因:
该问题由于在elasticsearch/config/elasticsearch.yml设置了network.host: 192.168.0.0,导致无法分配请求的地址。
解决办法:
修改network.host:本机ip地址,如network.host:192.168.17.36,每台es服务器elasticsearch.yml的network.host要对应本机的ip地址。
报错日志:
[2023-04-19t14:04:43,766][info ][o.e.n.node ] [node1] initialized
[2023-04-19t14:04:43,766][info ][o.e.n.node ] [node1] starting ...
[2023-04-19t14:04:43,774][info ][o.e.x.s.c.f.persistentcache] [node1] persistent cache index loaded
[2023-04-19t14:04:43,775][info ][o.e.x.d.l.deprecationindexingcomponent] [node1] deprecation component started
[2023-04-19t14:04:43,949][error][o.e.b.elasticsearchuncaughtexceptionhandler] [node1] uncaught exception in thread [main]
org.elasticsearch.bootstrap.startupexception: bindtransportexception[failed to bind to 192.168.0.0:[9300-9400]]; nested: bindexception[cannot assign requested address];
at org.elasticsearch.bootstrap.elasticsearch.init(elasticsearch.java:173) ~[elasticsearch-7.17.9.jar:7.17.9]
at org.elasticsearch.bootstrap.elasticsearch.execute(elasticsearch.java:160) ~[elasticsearch-7.17.9.jar:7.17.9]
at org.elasticsearch.cli.environmentawarecommand.execute(environmentawarecommand.java:77) ~[elasticsearch-7.17.9.jar:7.17.9]
at org.elasticsearch.cli.command.mainwithouterrorhandling(command.java:112) ~[elasticsearch-cli-7.17.9.jar:7.17.9]
at org.elasticsearch.cli.command.main(command.java:77) ~[elasticsearch-cli-7.17.9.jar:7.17.9]
at org.elasticsearch.bootstrap.elasticsearch.main(elasticsearch.java:125) ~[elasticsearch-7.17.9.jar:7.17.9]
at org.elasticsearch.bootstrap.elasticsearch.main(elasticsearch.java:80) ~[elasticsearch-7.17.9.jar:7.17.9]
caused by: org.elasticsearch.transport.bindtransportexception: failed to bind to 192.168.0.0:[9300-9400]
at org.elasticsearch.transport.tcptransport.bindtoport(tcptransport.java:450) ~[elasticsearch-7.17.9.jar:7.17.9]
at org.elasticsearch.transport.tcptransport.bindserver(tcptransport.java:411) ~[elasticsearch-7.17.9.jar:7.17.9]
at org.elasticsearch.transport.netty4.netty4transport.dostart(netty4transport.java:140) ~[?:?]
at org.elasticsearch.xpack.core.security.transport.netty4.securitynetty4transport.dostart(securitynetty4transport.java:96) ~[?:?]
at org.elasticsearch.xpack.security.transport.netty4.securitynetty4servertransport.dostart(securitynetty4servertransport.java:59) ~[?:?]
at org.elasticsearch.common.component.abstractlifecyclecomponent.start(abstractlifecyclecomponent.java:48) ~[elasticsearch-7.17.9.jar:7.17.9]
at org.elasticsearch.transport.transportservice.dostart(transportservice.java:318) ~[elasticsearch-7.17.9.jar:7.17.9]
at org.elasticsearch.common.component.abstractlifecyclecomponent.start(abstractlifecyclecomponent.java:48) ~[elasticsearch-7.17.9.jar:7.17.9]
at org.elasticsearch.node.node.start(node.java:1175) ~[elasticsearch-7.17.9.jar:7.17.9]
at org.elasticsearch.bootstrap.bootstrap.start(bootstrap.java:335) ~[elasticsearch-7.17.9.jar:7.17.9]
at org.elasticsearch.bootstrap.bootstrap.init(bootstrap.java:443) ~[elasticsearch-7.17.9.jar:7.17.9]
at org.elasticsearch.bootstrap.elasticsearch.init(elasticsearch.java:169) ~[elasticsearch-7.17.9.jar:7.17.9]
... 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:461) ~[?:?]
at sun.nio.ch.net.bind(net.java:453) ~[?:?]
at sun.nio.ch.serversocketchannelimpl.bind(serversocketchannelimpl.java:227) ~[?:?]
at io.netty.channel.socket.nio.nioserversocketchannel.dobind(nioserversocketchannel.java:134) ~[?:?]
at io.netty.channel.abstractchannel$abstractunsafe.bind(abstractchannel.java:562) ~[?:?]
at io.netty.channel.defaultchannelpipeline$headcontext.bind(defaultchannelpipeline.java:1334) ~[?:?]
at io.netty.channel.abstractchannelhandlercontext.invokebind(abstractchannelhandlercontext.java:506) ~[?:?]
at io.netty.channel.abstractchannelhandlercontext.bind(abstractchannelhandlercontext.java:491) ~[?:?]
at io.netty.channel.defaultchannelpipeline.bind(defaultchannelpipeline.java:973) ~[?:?]
at io.netty.channel.abstractchannel.bind(abstractchannel.java:260) ~[?:?]
at io.netty.bootstrap.abstractbootstrap$2.run(abstractbootstrap.java:356) ~[?:?]
at io.netty.util.concurrent.abstracteventexecutor.safeexecute(abstracteventexecutor.java:164) ~[?:?]
at io.netty.util.concurrent.singlethreadeventexecutor.runalltasks(singlethreadeventexecutor.java:469) ~[?:?]
at io.netty.channel.nio.nioeventloop.run(nioeventloop.java:500) ~[?:?]
at io.netty.util.concurrent.singlethreadeventexecutor$4.run(singlethreadeventexecutor.java:986) ~[?:?]
at io.netty.util.internal.threadexecutormap$2.run(threadexecutormap.java:74) ~[?:?]
at java.lang.thread.run(thread.java:834) [?:?]
uncaught exception in thread [main]
bindtransportexception[failed to bind to 192.168.0.0:[9300-9400]]; nested: bindexception[cannot assign requested address];
likely root cause: java.net.bindexception: cannot assign requested address
at java.base/sun.nio.ch.net.bind0(native method)
at java.base/sun.nio.ch.net.bind(net.java:461)
at java.base/sun.nio.ch.net.bind(net.java:453)
at java.base/sun.nio.ch.serversocketchannelimpl.bind(serversocketchannelimpl.java:227)
at io.netty.channel.socket.nio.nioserversocketchannel.dobind(nioserversocketchannel.java:134)
at io.netty.channel.abstractchannel$abstractunsafe.bind(abstractchannel.java:562)
at io.netty.channel.defaultchannelpipeline$headcontext.bind(defaultchannelpipeline.java:1334)
at io.netty.channel.abstractchannelhandlercontext.invokebind(abstractchannelhandlercontext.java:506)
at io.netty.channel.abstractchannelhandlercontext.bind(abstractchannelhandlercontext.java:491)
at io.netty.channel.defaultchannelpipeline.bind(defaultchannelpipeline.java:973)
at io.netty.channel.abstractchannel.bind(abstractchannel.java:260)
at io.netty.bootstrap.abstractbootstrap$2.run(abstractbootstrap.java:356)
at io.netty.util.concurrent.abstracteventexecutor.safeexecute(abstracteventexecutor.java:164)
at io.netty.util.concurrent.singlethreadeventexecutor.runalltasks(singlethreadeventexecutor.java:469)
at io.netty.channel.nio.nioeventloop.run(nioeventloop.java:500)
at io.netty.util.concurrent.singlethreadeventexecutor$4.run(singlethreadeventexecutor.java:986)
at io.netty.util.internal.threadexecutormap$2.run(threadexecutormap.java:74)
at java.base/java.lang.thread.run(thread.java:834)
for complete error details, refer to the log at /elk/logs/elk-cluster.log
[2023-04-19t14:04:44,798][info ][o.e.n.node ] [node1] stopping ...
[2023-04-19t14:04:44,809][info ][o.e.n.node ] [node1] stopped
[2023-04-19t14:04:44,810][info ][o.e.n.node ] [node1] closing ...
[2023-04-19t14:04:44,820][info ][o.e.n.node ] [node1] closed
[2023-04-19t14:04:44,822][info ][o.e.x.m.p.nativecontroller] [node1] native controller process has stopped - no new native processes can be started
**3、memory locking requested for elasticsearch process but memory is not locked故障及处理办法
**报错原因:
请求内存锁定,但内存未锁定导致,此问题和参数配置有关。
我在部署了es后,希望通过服务的方式来启停es,创建了服务配置文件,内容如下:
cat > /usr/lib/systemd/system/elasticsearch.service << eof
[unit]
description=elasticsearch
wants=network-online.target
after=network-online.target
[service]
user=es
group=es
execstart=/usr/local/elasticsearch/bin/elasticsearch
execreload=/bin/kill -hup \$mainpid
limitnofile=65535
killmode=process
restart=no-failure
[install]
wantedby=multi-user.target
eof
然后执行如下命令:
[root@node1 bin]# /bin/systemctl daemon-reload
[root@node1 bin]# /bin/systemctl enable elasticsearch.service
[root@node1 bin]# /bin/systemctl start elasticsearch.service
但在启动时报内存未锁定,启动失败。
**解决办法:
我首先尝试修改了elasticsearch/config下jvm.options文件,将-xms4g及-xmx4g取消前面注释,然后重新启动es服务,依然报同样错误。
后来查阅网上资料,修改/usr/lib/systemd/system/elasticsearch.service配置文件,在[service]块中设置limitmemlock=infinity,此步骤操作后需要重新执行/bin/systemctl daemon-reload,然后启动es服务,这次启动成功。
报错日志:
[2023-04-19t14:29:17,769][info ][o.e.n.node ] [192.168.17.36] initialized
[2023-04-19t14:29:17,769][info ][o.e.n.node ] [192.168.17.36] starting ...
[2023-04-19t14:29:17,776][info ][o.e.x.s.c.f.persistentcache] [192.168.17.36] persistent cache index loaded
[2023-04-19t14:29:17,777][info ][o.e.x.d.l.deprecationindexingcomponent] [192.168.17.36] deprecation component started
[2023-04-19t14:29:17,880][info ][o.e.t.transportservice ] [192.168.17.36] publish_address {192.168.17.36:9300}, bound_addresses {192.168.17.36:9300}
[2023-04-19t14:29:18,017][info ][o.e.b.bootstrapchecks ] [192.168.17.36] bound or publishing to a non-loopback address, enforcing bootstrap checks
[2023-04-19t14:29:18,022][error][o.e.b.bootstrap ] [192.168.17.36] node validation exception
[1] bootstrap checks failed. you must address the points described in the following [1] lines before starting elasticsearch.
bootstrap check failure [1] of [1]: memory locking requested for elasticsearch process but memory is not locked
[2023-04-19t14:29:18,026][info ][o.e.n.node ] [192.168.17.36] stopping ...
[2023-04-19t14:29:18,045][info ][o.e.n.node ] [192.168.17.36] stopped
[2023-04-19t14:29:18,045][info ][o.e.n.node ] [192.168.17.36] closing ...
[2023-04-19t14:29:18,057][info ][o.e.n.node ] [192.168.17.36] closed
[2023-04-19t14:29:18,058][info ][o.e.x.m.p.nativecontroller] [192.168.17.36] native controller process has stopped - no new native processes can be started
本次操作主要是基于elasticsearch 7在rocky 8操作系统上安装部署启动时所遇到的问题。
作为elasticsearch日常运维管理的一部分,后续会根据日常生产及测试中的经验总结更多elasticsearch相关知识进行输出,敬请期待。
千里之行,始于足下。