Linux部署Elasticsearch(二):启动Elasticsearch不成功的几种原因

版权声明:本文为博主原创文章,允许转载不允许复制。 https://blog.csdn.net/qq_30938705/article/details/88017132

启动Elasticsearch时,报了以下错误

Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000085330000, 2060255232, 0) failed; error='Cannot allocate memory' (errno=12)

由于elasticsearch5.0默认分配jvm空间大小为2g,修改jvm空间分配
vim /opt/elasticsearch-5.0.0/config/jvm.options

将如下代码

改成

 即是将jvm空间大小为2g改为512m

保存退出,启动报了如下错误:

2019-02-28 10:24:09,178 main ERROR Unable to create file /opt/elasticsearch-5.0.0/logs/my-application.log java.io.IOException: Permission denied
	at java.io.UnixFileSystem.createFileExclusively(Native Method)
	at java.io.File.createNewFile(File.java:1012)
	at org.apache.logging.log4j.core.appender.rolling.RollingFileManager$RollingFileManagerFactory.createManager(RollingFileManager.java:421)
	at org.apache.logging.log4j.core.appender.rolling.RollingFileManager$RollingFileManagerFactory.createManager(RollingFileManager.java:403)
	at org.apache.logging.log4j.core.appender.AbstractManager.getManager(AbstractManager.java:73)
	at org.apache.logging.log4j.core.appender.OutputStreamManager.getManager(OutputStreamManager.java:81)
	at org.apache.logging.log4j.core.appender.rolling.RollingFileManager.getFileManager(RollingFileManager.java:103)
	at org.apache.logging.log4j.core.appender.RollingFileAppender.createAppender(RollingFileAppender.java:191)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:132)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:918)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:858)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:850)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:479)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:219)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:231)
	at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:496)
	at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:249)
	at org.elasticsearch.common.logging.LogConfigurator.configure(LogConfigurator.java:116)
	at org.elasticsearch.common.logging.LogConfigurator.configure(LogConfigurator.java:83)
	at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:249)
	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:112)
	at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:103)
	at org.elasticsearch.cli.SettingCommand.execute(SettingCommand.java:54)
	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:96)
	at org.elasticsearch.cli.Command.main(Command.java:62)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:80)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:73)

2019-02-28 10:24:09,209 main ERROR Unable to invoke factory method in class class org.apache.logging.log4j.core.appender.RollingFileAppender for element RollingFile. java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:132)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:918)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:858)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:850)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:479)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:219)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:231)
	at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:496)
	at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:249)
	at org.elasticsearch.common.logging.LogConfigurator.configure(LogConfigurator.java:116)
	at org.elasticsearch.common.logging.LogConfigurator.configure(LogConfigurator.java:83)
	at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:249)
	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:112)
	at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:103)
	at org.elasticsearch.cli.SettingCommand.execute(SettingCommand.java:54)
	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:96)
	at org.elasticsearch.cli.Command.main(Command.java:62)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:80)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:73)
Caused by: java.lang.IllegalStateException: ManagerFactory [org.apache.logging.log4j.core.appender.rolling.RollingFileManager$RollingFileManagerFactory@4b14c583] unable to create manager for [/opt/elasticsearch-5.0.0/logs/my-application.log] with data [org.apache.logging.log4j.core.appender.rolling.RollingFileManager$FactoryData@65466a6a[pattern=/opt/elasticsearch-5.0.0/logs/my-application-%d{yyyy-MM-dd}.log, append=true, bufferedIO=true, bufferSize=8192, policy=CompositeTriggeringPolicy(policies=[TimeBasedTriggeringPolicy(nextRolloverMillis=0, interval=1, modulate=true)]), strategy=DefaultRolloverStrategy(min=1, max=7), advertiseURI=null, layout=[%d{ISO8601}][%-5p][%-25c{1.}] %marker%.10000m%n]]
	at org.apache.logging.log4j.core.appender.AbstractManager.getManager(AbstractManager.java:75)
	at org.apache.logging.log4j.core.appender.OutputStreamManager.getManager(OutputStreamManager.java:81)
	at org.apache.logging.log4j.core.appender.rolling.RollingFileManager.getFileManager(RollingFileManager.java:103)
	at org.apache.logging.log4j.core.appender.RollingFileAppender.createAppender(RollingFileAppender.java:191)
	... 23 more

2019-02-28 10:24:09,217 main ERROR Unable to create file /opt/elasticsearch-5.0.0/logs/my-application_deprecation.log java.io.IOException: Permission denied
	at java.io.UnixFileSystem.createFileExclusively(Native Method)
	at java.io.File.createNewFile(File.java:1012)
	at org.apache.logging.log4j.core.appender.rolling.RollingFileManager$RollingFileManagerFactory.createManager(RollingFileManager.java:421)
	at org.apache.logging.log4j.core.appender.rolling.RollingFileManager$RollingFileManagerFactory.createManager(RollingFileManager.java:403)
	at org.apache.logging.log4j.core.appender.AbstractManager.getManager(AbstractManager.java:73)
	at org.apache.logging.log4j.core.appender.OutputStreamManager.getManager(OutputStreamManager.java:81)
	at org.apache.logging.log4j.core.appender.rolling.RollingFileManager.getFileManager(RollingFileManager.java:103)
	at org.apache.logging.log4j.core.appender.RollingFileAppender.createAppender(RollingFileAppender.java:191)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:132)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:918)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:858)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:850)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:479)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:219)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:231)
	at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:496)
	at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:249)
	at org.elasticsearch.common.logging.LogConfigurator.configure(LogConfigurator.java:116)
	at org.elasticsearch.common.logging.LogConfigurator.configure(LogConfigurator.java:83)
	at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:249)
	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:112)
	at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:103)
	at org.elasticsearch.cli.SettingCommand.execute(SettingCommand.java:54)
	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:96)
	at org.elasticsearch.cli.Command.main(Command.java:62)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:80)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:73)

2019-02-28 10:24:09,229 main ERROR Unable to invoke factory method in class class org.apache.logging.log4j.core.appender.RollingFileAppender for element RollingFile. java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:132)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:918)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:858)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:850)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:479)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:219)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:231)
	at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:496)
	at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:249)
	at org.elasticsearch.common.logging.LogConfigurator.configure(LogConfigurator.java:116)
	at org.elasticsearch.common.logging.LogConfigurator.configure(LogConfigurator.java:83)
	at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:249)
	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:112)
	at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:103)
	at org.elasticsearch.cli.SettingCommand.execute(SettingCommand.java:54)
	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:96)
	at org.elasticsearch.cli.Command.main(Command.java:62)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:80)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:73)
Caused by: java.lang.IllegalStateException: ManagerFactory [org.apache.logging.log4j.core.appender.rolling.RollingFileManager$RollingFileManagerFactory@4b14c583] unable to create manager for [/opt/elasticsearch-5.0.0/logs/my-application_deprecation.log] with data [org.apache.logging.log4j.core.appender.rolling.RollingFileManager$FactoryData@5be6e01c[pattern=/opt/elasticsearch-5.0.0/logs/my-application_deprecation-%i.log.gz, append=true, bufferedIO=true, bufferSize=8192, policy=CompositeTriggeringPolicy(policies=[SizeBasedTriggeringPolicy(size=1073741824)]), strategy=DefaultRolloverStrategy(min=1, max=4), advertiseURI=null, layout=[%d{ISO8601}][%-5p][%-25c{1.}] %marker%.10000m%n]]
	at org.apache.logging.log4j.core.appender.AbstractManager.getManager(AbstractManager.java:75)
	at org.apache.logging.log4j.core.appender.OutputStreamManager.getManager(OutputStreamManager.java:81)
	at org.apache.logging.log4j.core.appender.rolling.RollingFileManager.getFileManager(RollingFileManager.java:103)
	at org.apache.logging.log4j.core.appender.RollingFileAppender.createAppender(RollingFileAppender.java:191)
	... 23 more

2019-02-28 10:24:09,232 main ERROR Unable to create file /opt/elasticsearch-5.0.0/logs/my-application_index_search_slowlog.log java.io.IOException: Permission denied
	at java.io.UnixFileSystem.createFileExclusively(Native Method)
	at java.io.File.createNewFile(File.java:1012)
	at org.apache.logging.log4j.core.appender.rolling.RollingFileManager$RollingFileManagerFactory.createManager(RollingFileManager.java:421)
	at org.apache.logging.log4j.core.appender.rolling.RollingFileManager$RollingFileManagerFactory.createManager(RollingFileManager.java:403)
	at org.apache.logging.log4j.core.appender.AbstractManager.getManager(AbstractManager.java:73)
	at org.apache.logging.log4j.core.appender.OutputStreamManager.getManager(OutputStreamManager.java:81)
	at org.apache.logging.log4j.core.appender.rolling.RollingFileManager.getFileManager(RollingFileManager.java:103)
	at org.apache.logging.log4j.core.appender.RollingFileAppender.createAppender(RollingFileAppender.java:191)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:132)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:918)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:858)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:850)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:479)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:219)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:231)
	at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:496)
	at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:249)
	at org.elasticsearch.common.logging.LogConfigurator.configure(LogConfigurator.java:116)
	at org.elasticsearch.common.logging.LogConfigurator.configure(LogConfigurator.java:83)
	at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:249)
	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:112)
	at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:103)
	at org.elasticsearch.cli.SettingCommand.execute(SettingCommand.java:54)
	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:96)
	at org.elasticsearch.cli.Command.main(Command.java:62)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:80)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:73)

2019-02-28 10:24:09,236 main ERROR Unable to invoke factory method in class class org.apache.logging.log4j.core.appender.RollingFileAppender for element RollingFile. java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:132)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:918)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:858)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:850)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:479)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:219)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:231)
	at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:496)
	at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:249)
	at org.elasticsearch.common.logging.LogConfigurator.configure(LogConfigurator.java:116)
	at org.elasticsearch.common.logging.LogConfigurator.configure(LogConfigurator.java:83)
	at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:249)
	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:112)
	at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:103)
	at org.elasticsearch.cli.SettingCommand.execute(SettingCommand.java:54)
	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:96)
	at org.elasticsearch.cli.Command.main(Command.java:62)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:80)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:73)
Caused by: java.lang.IllegalStateException: ManagerFactory [org.apache.logging.log4j.core.appender.rolling.RollingFileManager$RollingFileManagerFactory@4b14c583] unable to create manager for [/opt/elasticsearch-5.0.0/logs/my-application_index_search_slowlog.log] with data [org.apache.logging.log4j.core.appender.rolling.RollingFileManager$FactoryData@7ce3cb8e[pattern=/opt/elasticsearch-5.0.0/logs/my-application_index_search_slowlog-%d{yyyy-MM-dd}.log, append=true, bufferedIO=true, bufferSize=8192, policy=CompositeTriggeringPolicy(policies=[TimeBasedTriggeringPolicy(nextRolloverMillis=0, interval=1, modulate=true)]), strategy=DefaultRolloverStrategy(min=1, max=7), advertiseURI=null, layout=[%d{ISO8601}][%-5p][%-25c] %marker%.10000m%n]]
	at org.apache.logging.log4j.core.appender.AbstractManager.getManager(AbstractManager.java:75)
	at org.apache.logging.log4j.core.appender.OutputStreamManager.getManager(OutputStreamManager.java:81)
	at org.apache.logging.log4j.core.appender.rolling.RollingFileManager.getFileManager(RollingFileManager.java:103)
	at org.apache.logging.log4j.core.appender.RollingFileAppender.createAppender(RollingFileAppender.java:191)
	... 23 more

2019-02-28 10:24:09,239 main ERROR Unable to create file /opt/elasticsearch-5.0.0/logs/my-application_index_indexing_slowlog.log java.io.IOException: Permission denied
	at java.io.UnixFileSystem.createFileExclusively(Native Method)
	at java.io.File.createNewFile(File.java:1012)
	at org.apache.logging.log4j.core.appender.rolling.RollingFileManager$RollingFileManagerFactory.createManager(RollingFileManager.java:421)
	at org.apache.logging.log4j.core.appender.rolling.RollingFileManager$RollingFileManagerFactory.createManager(RollingFileManager.java:403)
	at org.apache.logging.log4j.core.appender.AbstractManager.getManager(AbstractManager.java:73)
	at org.apache.logging.log4j.core.appender.OutputStreamManager.getManager(OutputStreamManager.java:81)
	at org.apache.logging.log4j.core.appender.rolling.RollingFileManager.getFileManager(RollingFileManager.java:103)
	at org.apache.logging.log4j.core.appender.RollingFileAppender.createAppender(RollingFileAppender.java:191)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:132)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:918)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:858)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:850)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:479)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:219)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:231)
	at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:496)
	at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:249)
	at org.elasticsearch.common.logging.LogConfigurator.configure(LogConfigurator.java:116)
	at org.elasticsearch.common.logging.LogConfigurator.configure(LogConfigurator.java:83)
	at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:249)
	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:112)
	at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:103)
	at org.elasticsearch.cli.SettingCommand.execute(SettingCommand.java:54)
	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:96)
	at org.elasticsearch.cli.Command.main(Command.java:62)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:80)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:73)

2019-02-28 10:24:09,244 main ERROR Unable to invoke factory method in class class org.apache.logging.log4j.core.appender.RollingFileAppender for element RollingFile. java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:132)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:918)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:858)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:850)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:479)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:219)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:231)
	at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:496)
	at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:249)
	at org.elasticsearch.common.logging.LogConfigurator.configure(LogConfigurator.java:116)
	at org.elasticsearch.common.logging.LogConfigurator.configure(LogConfigurator.java:83)
	at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:249)
	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:112)
	at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:103)
	at org.elasticsearch.cli.SettingCommand.execute(SettingCommand.java:54)
	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:96)
	at org.elasticsearch.cli.Command.main(Command.java:62)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:80)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:73)
Caused by: java.lang.IllegalStateException: ManagerFactory [org.apache.logging.log4j.core.appender.rolling.RollingFileManager$RollingFileManagerFactory@4b14c583] unable to create manager for [/opt/elasticsearch-5.0.0/logs/my-application_index_indexing_slowlog.log] with data [org.apache.logging.log4j.core.appender.rolling.RollingFileManager$FactoryData@69b2283a[pattern=/opt/elasticsearch-5.0.0/logs/my-application_index_indexing_slowlog-%d{yyyy-MM-dd}.log, append=true, bufferedIO=true, bufferSize=8192, policy=CompositeTriggeringPolicy(policies=[TimeBasedTriggeringPolicy(nextRolloverMillis=0, interval=1, modulate=true)]), strategy=DefaultRolloverStrategy(min=1, max=7), advertiseURI=null, layout=[%d{ISO8601}][%-5p][%-25c] %marker%.10000m%n]]
	at org.apache.logging.log4j.core.appender.AbstractManager.getManager(AbstractManager.java:75)
	at org.apache.logging.log4j.core.appender.OutputStreamManager.getManager(OutputStreamManager.java:81)
	at org.apache.logging.log4j.core.appender.rolling.RollingFileManager.getFileManager(RollingFileManager.java:103)
	at org.apache.logging.log4j.core.appender.RollingFileAppender.createAppender(RollingFileAppender.java:191)
	... 23 more

2019-02-28 10:24:09,245 main ERROR Null object returned for RollingFile in Appenders.
2019-02-28 10:24:09,245 main ERROR Null object returned for RollingFile in Appenders.
2019-02-28 10:24:09,246 main ERROR Null object returned for RollingFile in Appenders.
2019-02-28 10:24:09,246 main ERROR Null object returned for RollingFile in Appenders.
2019-02-28 10:24:09,246 main ERROR Unable to locate appender "rolling" for logger config "root"
2019-02-28 10:24:09,246 main ERROR Unable to locate appender "index_indexing_slowlog_rolling" for logger config "index.indexing.slowlog.index"
2019-02-28 10:24:09,246 main ERROR Unable to locate appender "index_search_slowlog_rolling" for logger config "index.search.slowlog"
2019-02-28 10:24:09,247 main ERROR Unable to locate appender "deprecation_rolling" for logger config "org.elasticsearch.deprecation"
[2019-02-28T10:24:09,512][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [node-1] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.IllegalStateException: Unable to access 'path.home' (/opt/elasticsearch-5.0.0/plugins)
	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:116) ~[elasticsearch-5.0.0.jar:5.0.0]
	at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:103) ~[elasticsearch-5.0.0.jar:5.0.0]
	at org.elasticsearch.cli.SettingCommand.execute(SettingCommand.java:54) ~[elasticsearch-5.0.0.jar:5.0.0]
	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:96) ~[elasticsearch-5.0.0.jar:5.0.0]
	at org.elasticsearch.cli.Command.main(Command.java:62) ~[elasticsearch-5.0.0.jar:5.0.0]
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:80) ~[elasticsearch-5.0.0.jar:5.0.0]
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:73) ~[elasticsearch-5.0.0.jar:5.0.0]
Caused by: java.lang.IllegalStateException: Unable to access 'path.home' (/opt/elasticsearch-5.0.0/plugins)
	at org.elasticsearch.bootstrap.Security.addPath(Security.java:316) ~[elasticsearch-5.0.0.jar:5.0.0]
	at org.elasticsearch.bootstrap.Security.addFilePermissions(Security.java:248) ~[elasticsearch-5.0.0.jar:5.0.0]
	at org.elasticsearch.bootstrap.Security.createPermissions(Security.java:214) ~[elasticsearch-5.0.0.jar:5.0.0]
	at org.elasticsearch.bootstrap.Security.configure(Security.java:120) ~[elasticsearch-5.0.0.jar:5.0.0]
	at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:186) ~[elasticsearch-5.0.0.jar:5.0.0]
	at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:286) ~[elasticsearch-5.0.0.jar:5.0.0]
	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:112) ~[elasticsearch-5.0.0.jar:5.0.0]
	... 6 more
Caused by: java.nio.file.AccessDeniedException: /opt/elasticsearch-5.0.0/plugins
	at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84) ~[?:1.8.0_191]
	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102) ~[?:1.8.0_191]
	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107) ~[?:1.8.0_191]
	at sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:384) ~[?:1.8.0_191]
	at java.nio.file.Files.createDirectory(Files.java:674) ~[?:1.8.0_191]
	at java.nio.file.Files.createAndCheckIsDirectory(Files.java:781) ~[?:1.8.0_191]
	at java.nio.file.Files.createDirectories(Files.java:767) ~[?:1.8.0_191]
	at org.elasticsearch.bootstrap.Security.ensureDirectoryExists(Security.java:358) ~[elasticsearch-5.0.0.jar:5.0.0]
	at org.elasticsearch.bootstrap.Security.addPath(Security.java:314) ~[elasticsearch-5.0.0.jar:5.0.0]
	at org.elasticsearch.bootstrap.Security.addFilePermissions(Security.java:248) ~[elasticsearch-5.0.0.jar:5.0.0]
	at org.elasticsearch.bootstrap.Security.createPermissions(Security.java:214) ~[elasticsearch-5.0.0.jar:5.0.0]
	at org.elasticsearch.bootstrap.Security.configure(Security.java:120) ~[elasticsearch-5.0.0.jar:5.0.0]
	at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:186) ~[elasticsearch-5.0.0.jar:5.0.0]
	at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:286) ~[elasticsearch-5.0.0.jar:5.0.0]
	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:112) ~[elasticsearch-5.0.0.jar:5.0.0]
	... 6 more

一:main ERROR Unable to create file /opt/elasticsearch-5.0.0/logs/my-application.log java.io.IOException: Permission denied

创建不了logs、data文件夹,权限不足

看下elasticsearch的部署文件(我这是elasticsearch-5.0.0)的权限是谁的

权限是root:root的,启动时不能用root权限启动的,我在上一篇安装的时候建了elastic:elastic的组和用户,将elasticsearch-5.0.0文件夹添加到elastic权限中

chown -R elastic:elastic elasticsearch-5.0.0

命令解析:

chown [选项]... [所有者][:[组]] 文件...

通过chown改变文件的拥有者和群组。在更改文件的所有者或所属群组时,可以使用用户名称和用户识别码设置。普通用户不能将自己的文件改变成其他的拥有者。其操作权限一般为管理员。

命令参数:

必要参数:

-c 显示更改的部分的信息

-f 忽略错误信息

-h 修复符号链接

-R 处理指定目录以及其子目录下的所有文件

-v 显示详细的处理信息

-deference 作用于符号链接的指向,而不是链接文件本身

选择参数:

--reference=<目录或文件> 把指定的目录/文件作为参考,把操作的文件/目录设置成参考文件/目录相同拥有者和群组

--from=<当前用户:当前群组> 只有当前用户和群组跟指定的用户和群组相同时才进行改变

--help 显示帮助信息

--version 显示版本信

以上chown知识参考自博文https://blog.csdn.net/qq_32331073/article/details/76460192

再看权限

二:main ERROR Unable to invoke factory method in class class org.apache.logging.log4j.core.appender.RollingFileAppender for element RollingFile. java.lang.reflect.InvocationTargetException

安装log4j包

yum  install -y log4j*

解决以上问题后再启动时,报了以下错误

[2019-02-28T10:59:06,762][INFO ][o.e.n.Node               ] [node-1] initializing ...
[2019-02-28T10:59:06,920][INFO ][o.e.e.NodeEnvironment    ] [node-1] using [1] data paths, mounts [[/ (rootfs)]], net usable_space [32.1gb], net total_space [39.2gb], spins? [unknown], types [rootfs]
[2019-02-28T10:59:06,921][INFO ][o.e.e.NodeEnvironment    ] [node-1] heap size [503.6mb], compressed ordinary object pointers [true]
[2019-02-28T10:59:06,927][INFO ][o.e.n.Node               ] [node-1] version[5.0.0], pid[16708], build[253032b/2016-10-26T04:37:51.531Z], OS[Linux/3.10.0-693.2.2.el7.x86_64/amd64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/1.8.0_191/25.191-b12]
[2019-02-28T10:59:09,062][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [aggs-matrix-stats]
[2019-02-28T10:59:09,063][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [ingest-common]
[2019-02-28T10:59:09,063][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [lang-expression]
[2019-02-28T10:59:09,063][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [lang-groovy]
[2019-02-28T10:59:09,063][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [lang-mustache]
[2019-02-28T10:59:09,063][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [lang-painless]
[2019-02-28T10:59:09,063][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [percolator]
[2019-02-28T10:59:09,063][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [reindex]
[2019-02-28T10:59:09,063][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [transport-netty3]
[2019-02-28T10:59:09,063][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [transport-netty4]
[2019-02-28T10:59:09,064][INFO ][o.e.p.PluginsService     ] [node-1] no plugins loaded
[2019-02-28T10:59:10,996][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [node-1] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.IllegalArgumentException: unknown setting [bootstrp.system_call_filter] please check that any required plugins are installed, or check the breaking changes documentation for removed settings
	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:116) ~[elasticsearch-5.0.0.jar:5.0.0]
	at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:103) ~[elasticsearch-5.0.0.jar:5.0.0]
	at org.elasticsearch.cli.SettingCommand.execute(SettingCommand.java:54) ~[elasticsearch-5.0.0.jar:5.0.0]
	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:96) ~[elasticsearch-5.0.0.jar:5.0.0]
	at org.elasticsearch.cli.Command.main(Command.java:62) ~[elasticsearch-5.0.0.jar:5.0.0]
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:80) ~[elasticsearch-5.0.0.jar:5.0.0]
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:73) ~[elasticsearch-5.0.0.jar:5.0.0]
Caused by: java.lang.IllegalArgumentException: unknown setting [bootstrp.system_call_filter] please check that any required plugins are installed, or check the breaking changes documentation for removed settings
	at org.elasticsearch.common.settings.AbstractScopedSettings.validate(AbstractScopedSettings.java:271) ~[elasticsearch-5.0.0.jar:5.0.0]
	at org.elasticsearch.common.settings.AbstractScopedSettings.validate(AbstractScopedSettings.java:239) ~[elasticsearch-5.0.0.jar:5.0.0]
	at org.elasticsearch.common.settings.SettingsModule.<init>(SettingsModule.java:138) ~[elasticsearch-5.0.0.jar:5.0.0]
	at org.elasticsearch.node.Node.<init>(Node.java:311) ~[elasticsearch-5.0.0.jar:5.0.0]
	at org.elasticsearch.node.Node.<init>(Node.java:220) ~[elasticsearch-5.0.0.jar:5.0.0]
	at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:191) ~[elasticsearch-5.0.0.jar:5.0.0]
	at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:191) ~[elasticsearch-5.0.0.jar:5.0.0]
	at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:286) ~[elasticsearch-5.0.0.jar:5.0.0]
	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:112) ~[elasticsearch-5.0.0.jar:5.0.0]
	... 6 more

 在elasticsearch.yuml注释bootstrp.system_call_filter这句,因为这个是ES5.2 后的版本默认使用 bootstrap.system_call_filter 检测,我用的5.0.0,再启动,成功了,但是访问不到

修改network.host为0.0.0.0以及discovery.zen.ping.unicast.hosts改为服务器地址后,启动后报以下问题

[elastic@izwz93bc56k6c7z4vznmifz bin]$ ./elasticsearch
[2019-02-28T11:58:05,303][INFO ][o.e.n.Node               ] [node-1] initializing ...
[2019-02-28T11:58:05,416][INFO ][o.e.e.NodeEnvironment    ] [node-1] using [1] data paths, mounts [[/ (rootfs)]], net usable_space [32.1gb], net total_space [39.2gb], spins? [unknown], types [rootfs]
[2019-02-28T11:58:05,417][INFO ][o.e.e.NodeEnvironment    ] [node-1] heap size [503.6mb], compressed ordinary object pointers [true]
[2019-02-28T11:58:05,420][INFO ][o.e.n.Node               ] [node-1] version[5.0.0], pid[19931], build[253032b/2016-10-26T04:37:51.531Z], OS[Linux/3.10.0-693.2.2.el7.x86_64/amd64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/1.8.0_191/25.191-b12]
[2019-02-28T11:58:07,447][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [aggs-matrix-stats]
[2019-02-28T11:58:07,447][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [ingest-common]
[2019-02-28T11:58:07,447][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [lang-expression]
[2019-02-28T11:58:07,448][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [lang-groovy]
[2019-02-28T11:58:07,448][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [lang-mustache]
[2019-02-28T11:58:07,448][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [lang-painless]
[2019-02-28T11:58:07,448][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [percolator]
[2019-02-28T11:58:07,448][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [reindex]
[2019-02-28T11:58:07,448][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [transport-netty3]
[2019-02-28T11:58:07,448][INFO ][o.e.p.PluginsService     ] [node-1] loaded module [transport-netty4]
[2019-02-28T11:58:07,448][INFO ][o.e.p.PluginsService     ] [node-1] no plugins loaded
[2019-02-28T11:58:12,599][INFO ][o.e.n.Node               ] [node-1] initialized
[2019-02-28T11:58:12,599][INFO ][o.e.n.Node               ] [node-1] starting ...
[2019-02-28T11:58:12,996][INFO ][o.e.t.TransportService   ] [node-1] publish_address {172.18.50.148:9300}, bound_addresses {0.0.0.0:9300}
[2019-02-28T11:58:13,000][INFO ][o.e.b.BootstrapCheck     ] [node-1] bound or publishing to a non-loopback or non-link-local address, enforcing bootstrap checks
ERROR: bootstrap checks failed
max file descriptors [65535] for elasticsearch process likely too low, increase to at least [65536]
[2019-02-28T11:58:13,029][INFO ][o.e.n.Node               ] [node-1] stopping ...
[2019-02-28T11:58:13,145][INFO ][o.e.n.Node               ] [node-1] stopped
[2019-02-28T11:58:13,145][INFO ][o.e.n.Node               ] [node-1] closing ...
[2019-02-28T11:58:13,159][INFO ][o.e.n.Node               ] [node-1] closed
[1]+  Killed                  ./elasticsearch

启动失败,bootstrap检查没有通过,报错

ERROR: bootstrap checks failed
max file descriptors [65535] for elasticsearch process likely too low, increase to at least [65536]

进入root用户,编辑/etc/security/limits.conf,修改或者追加以下内容:

* soft nofile 65536
* hard nofile 65536

保存,此文件修改后需要重新登录用户,才会生效

所有重新进入elastic用户,启动elasticsearch服务

启动成功,登录http:xxx.9200,或者http://xxx.9200/?pretty 显示如下内容说明elasticsearch启动成功

 

我是初学者,如有不对之处,还望各位大佬多多指教。

 

展开阅读全文

没有更多推荐了,返回首页