前言
在根据镜像elasticsearch
创建容器的时候,启动容器失败。
查看报错日志
查看日志
这里查看相关容器启动失败日志
docker logs e09
[root@localhost elasticsearch]# docker logs e09
Exception in thread "main" SettingsException[Failed to load settings from [elasticsearch.yml]]; nested: ParsingException[Failed to parse object: expecting token of type [START_OBJECT] but found [VALUE_STRING]];
at org.elasticsearch.common.settings.Settings$Builder.loadFromStream(Settings.java:1189)
at org.elasticsearch.common.settings.Settings$Builder.loadFromPath(Settings.java:1160)
at org.elasticsearch.node.InternalSettingsPreparer.prepareEnvironment(InternalSettingsPreparer.java:75)
at org.elasticsearch.cli.EnvironmentAwareCommand.createEnv(EnvironmentAwareCommand.java:91)
at org.elasticsearch.cli.EnvironmentAwareCommand.createEnv(EnvironmentAwareCommand.java:82)
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:77)
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:112)
at org.elasticsearch.cli.MultiCommand.execute(MultiCommand.java:95)
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:112)
at org.elasticsearch.cli.Command.main(Command.java:77)
at org.elasticsearch.common.settings.KeyStoreCli.main(KeyStoreCli.java:33)
Caused by: ParsingException[Failed to parse object: expecting token of type [START_OBJECT] but found [VALUE_STRING]]
at org.elasticsearch.common.xcontent.XContentParserUtils.parsingException(XContentParserUtils.java:77)
at org.elasticsearch.common.xcontent.XContentParserUtils.ensureExpectedToken(XContentParserUtils.java:70)
at org.elasticsearch.common.settings.Settings.fromXContent(Settings.java:672)
at org.elasticsearch.common.settings.Settings.access$400(Settings.java:75)
at org.elasticsearch.common.settings.Settings$Builder.loadFromStream(Settings.java:1185)
... 10 more
Exception in thread "main" SettingsException[Failed to load settings from [elasticsearch.yml]]; nested: ParsingException[Failed to parse object: expecting token of type [START_OBJECT] but found [VALUE_STRING]];
at org.elasticsearch.common.settings.Settings$Builder.loadFromStream(Settings.java:1189)
at org.elasticsearch.common.settings.Settings$Builder.loadFromPath(Settings.java:1160)
at org.elasticsearch.node.InternalSettingsPreparer.prepareEnvironment(InternalSettingsPreparer.java:75)
at org.elasticsearch.cli.EnvironmentAwareCommand.createEnv(EnvironmentAwareCommand.java:91)
at org.elasticsearch.cli.EnvironmentAwareCommand.createEnv(EnvironmentAwareCommand.java:82)
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:122)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:80)
Caused by: ParsingException[Failed to parse object: expecting token of type [START_OBJECT] but found [VALUE_STRING]]
at org.elasticsearch.common.xcontent.XContentParserUtils.parsingException(XContentParserUtils.java:77)
at org.elasticsearch.common.xcontent.XContentParserUtils.ensureExpectedToken(XContentParserUtils.java:70)
at org.elasticsearch.common.settings.Settings.fromXContent(Settings.java:672)
at org.elasticsearch.common.settings.Settings.access$400(Settings.java:75)
at org.elasticsearch.common.settings.Settings$Builder.loadFromStream(Settings.java:1185)
... 9 more
排查问题
是说在启动时在解析elasticsearch.yml出现错误,查看自己外部挂载的elasticsearch.yml配置文件(如没有挂载配置文件,则需去容器内查找)
/mydata/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml \
-v /mydata/elasticsearch/dada:/usr/share/elasticsearch/dada \
-v /mydata/elasticsearch/plugins:/usr/share/elasticsearch/plugins \
-d elasticsearch:7.17.2
解决方法
修改 elasticsearch.yml
中的配置。空格要特别注意
启动成功
重新启动容器
docker start e09e7a49ae97
资料参考:原因+解决方法