在启动es的时候出现如下问题,es解压到了/opt/shan/es文件夹中
java.io.FileNotFoundException: /opt/shan/es/logs/elasticsearch_index_indexing_slowlog.json (权限不够)
14:49:00,717 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)2022-08-10 14:49:00,721 main ERROR RollingFileManager (/opt/shan/es/logs/elasticsearch_index_indexing_slowlog.json) java.io.FileNotFoundException: /opt/shan/es/logs/elasticsearch_index_indexing_slowlog.json (权限不够) java.io.FileNotFoundException: /opt/shan/es/logs/elasticsearch_index_indexing_slowlog.json (权限不够)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(FileOutputStream.java:270)
at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
at java.io.FileOutputStream.<init>(FileOutputStream.java:133)
at org.apache.logging.log4j.core.appender.rolling.RollingFileManager$RollingFileManagerFactory.createManager(RollingFileManager.java:746)
at org.apache.logging.log4j.core.appender.rolling.RollingFileManager$RollingFileManagerFactory.createManager(RollingFileManager.java:716)
at or
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)
我们可以得出,是日志的权限不够导致的,修改目录及文件权限即可
1、切换到root用户
su -
2、到安装ES的目录查看如下,(造成这种原因应该是es启动的时候用的是root用户导致的),
修改这些日志的权限可
修改方法(/opt/shan/es为es安装路径,把logs文件夹修改为es用户)
cd /opt/shan/es
chown -R es:es logs/
3、重启es即可